Updated hack to avoid recursive loops.
[python-purple] / libpurple / account.pxd
1 #
2 #  Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
3 #
4 #  This file is part of python-purple.
5 #
6 #  python-purple is free software: you can redistribute it and/or modify
7 #  it under the terms of the GNU General Public License as published by
8 #  the Free Software Foundation, either version 3 of the License, or
9 #  (at your option) any later version.
10 #
11 #  python-purple is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #  GNU General Public License for more details.
15 #
16 #  You should have received a copy of the GNU General Public License
17 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 cimport glib
21
22 # hack to avoid recursive loops by cython
23 cdef extern from "libpurple/blist.h":
24     ctypedef struct PurpleBuddy
25     ctypedef struct PurpleGroup
26
27 cdef extern from "libpurple/connection.h":
28     ctypedef struct PurpleConnection
29     ctypedef struct PurpleConnectionErrorInfo
30
31 cdef extern from "libpurple/log.h":
32     ctypedef struct PurpleLog
33
34 cdef extern from "libpurple/proxy.h":
35     ctypedef struct PurpleProxyInfo
36
37 cdef extern from "libpurple/status.h":
38     ctypedef struct PurpleStatus
39     ctypedef struct PurpleStatusType
40     ctypedef struct PurpleStatusPrimitive
41     ctypedef struct PurplePresence
42
43 cdef extern from "libpurple/account.h":
44     ctypedef struct PurpleAccountUiOps
45     ctypedef struct PurpleAccount
46
47     ctypedef glib.gboolean (*PurpleFilterAccountFunc) (PurpleAccount *account)
48     ctypedef void (*PurpleAccountRequestAuthorizationCb) (void *)
49     ctypedef void (*PurpleAccountRegistrationCb) (PurpleAccount *account, \
50             glib.gboolean succeeded, void *user_data)
51     ctypedef void (*PurpleAccountUnregistrationCb) (PurpleAccount *account, \
52             glib.gboolean succeeded, void *user_data)
53
54     ctypedef enum PurpleAccountRequestType:
55         PURPLE_ACCOUNT_REQUEST_AUTHORIZATION = 0
56
57     ctypedef struct PurpleAccountUiOps:
58         void (*notify_added) (PurpleAccount *account, char *remote_user, \
59                 char *id, char *alias, char *message)
60         void (*status_changed) (PurpleAccount *account, PurpleStatus *status)
61         void (*request_add) (PurpleAccount *account, char *remote_user, \
62                 char *id, char *alias, char *message)
63         void *(*request_authorize) (PurpleAccount *account, \
64                 char *remote_user, char *id, char *alias, \
65                 char *message, glib.gboolean on_list, \
66                 PurpleAccountRequestAuthorizationCb authorize_cb, \
67                 PurpleAccountRequestAuthorizationCb deny_cb, void *user_data)
68         void (*close_account_request) (void *ui_handle)
69
70     ctypedef struct PurpleAccount:
71         char *username
72         char *alias
73         char *password
74         char *user_info
75         char *buddy_icon_path
76         glib.gboolean remember_pass
77         char *protocol_id
78         PurpleConnection *gc
79         glib.gboolean disconnecting
80         glib.GHashTable *settings
81         glib.GHashTable *ui_settings
82         PurpleProxyInfo *proxy_info
83         glib.GSList *permit
84         glib.GSList *deny
85         int perm_deny
86         PurplePresence *presence
87         PurpleLog *system_log
88         void *ui_data
89         PurpleAccountRegistrationCb registration_cb
90         void *registration_cb_user_data
91         glib.gpointer priv
92
93     # Account API
94     PurpleAccount *purple_account_new(char *username, char *protocol_id)
95     void purple_account_destroy(PurpleAccount *account)
96     void purple_account_connect(PurpleAccount *account)
97     void purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data)
98     void purple_account_register(PurpleAccount *account)
99     void purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data)
100     void purple_account_disconnect(PurpleAccount *account)
101     void purple_account_notify_added(PurpleAccount *account, \
102             char *remote_user, char *id, char *alias, \
103             char *message)
104     void purple_account_request_add(PurpleAccount *account, \
105             char *remote_user, char *id, char *alias, \
106             char *message)
107     void *purple_account_request_authorization(PurpleAccount *account, \
108             char *remote_user, char *id, char *alias, \
109             char *message, glib.gboolean on_list, \
110             PurpleAccountRequestAuthorizationCb auth_cb, \
111             PurpleAccountRequestAuthorizationCb deny_cb, void *user_data)
112     void purple_account_request_close_with_account(PurpleAccount *account)
113     void purple_account_request_close(void *ui_handle)
114     void purple_account_request_password(PurpleAccount *account, \
115             glib.GCallback ok_cb, glib.GCallback cancel_cb, void *user_data)
116     void purple_account_request_change_password(PurpleAccount *account)
117     void purple_account_request_change_user_info(PurpleAccount *account)
118     void purple_account_set_username(PurpleAccount *account, char *username)
119     void purple_account_set_password(PurpleAccount *account, char *password)
120     void purple_account_set_alias(PurpleAccount *account, char *alias)
121     void purple_account_set_user_info(PurpleAccount *account, char *user_info)
122     void purple_account_set_buddy_icon_path(PurpleAccount *account, char *path)
123     void purple_account_set_protocol_id(PurpleAccount *account, \
124             char *protocol_id)
125     void purple_account_set_connection(PurpleAccount *account, \
126             PurpleConnection *gc)
127     void purple_account_set_remember_password(PurpleAccount *account, \
128             glib.gboolean value)
129     void purple_account_set_check_mail(PurpleAccount *account, \
130             glib.gboolean value)
131     void purple_account_set_enabled(PurpleAccount *account, \
132             char *ui, glib.gboolean value)
133     void purple_account_set_proxy_info(PurpleAccount *account, \
134             PurpleProxyInfo *info)
135     void purple_account_set_status_types(PurpleAccount *account, \
136             glib.GList *status_types)
137     void purple_account_set_status_list(PurpleAccount *account, \
138             char *status_id, glib.gboolean active, glib.GList *attrs)
139     void purple_account_set_status(PurpleAccount *account, \
140             char *status_id, glib.gboolean active, ...)
141     void purple_account_set_status_list(PurpleAccount *account, \
142             char *status_id, glib.gboolean active, glib.GList *attrs)
143     void purple_account_clear_settings(PurpleAccount *account)
144     void purple_account_set_int(PurpleAccount *account, char *name, \
145             int value)
146     void purple_account_set_string(PurpleAccount *account, char *name, \
147             char *value)
148     void purple_account_set_bool(PurpleAccount *account, char *name, \
149             glib.gboolean value)
150     void purple_account_set_ui_int(PurpleAccount *account, char *ui, \
151             char *name, int value)
152     void purple_account_set_ui_string(PurpleAccount *account, char *ui, \
153             char *name, char *value)
154     void purple_account_set_ui_bool(PurpleAccount *account, char *ui, \
155             char *name, glib.gboolean value)
156     glib.gboolean purple_account_is_connected(PurpleAccount *account)
157     glib.gboolean purple_account_is_connecting(PurpleAccount *account)
158     glib.gboolean purple_account_is_disconnected(PurpleAccount *account)
159     char *purple_account_get_username(PurpleAccount *account)
160     char *purple_account_get_password(PurpleAccount *account)
161     char *purple_account_get_alias(PurpleAccount *account)
162     char *purple_account_get_user_info(PurpleAccount *account)
163     char *purple_account_get_buddy_icon_path(PurpleAccount *account)
164     char *purple_account_get_protocol_id(PurpleAccount *account)
165     char *purple_account_get_protocol_name(PurpleAccount *account)
166     PurpleConnection *purple_account_get_connection(PurpleAccount *account)
167     glib.gboolean purple_account_get_remember_password(PurpleAccount *account)
168     glib.gboolean purple_account_get_check_mail(PurpleAccount *account)
169     glib.gboolean purple_account_get_enabled(PurpleAccount *account, char *ui)
170     PurpleProxyInfo *purple_account_get_proxy_info(PurpleAccount *account)
171     PurpleStatus *purple_account_get_active_status(PurpleAccount *account)
172     PurpleStatus *purple_account_get_status(PurpleAccount *account, \
173             char *status_id)
174     PurpleStatusType *purple_account_get_status_type(PurpleAccount *account, \
175             char *id)
176     PurpleStatusType *purple_account_get_status_type_with_primitive( \
177             PurpleAccount *account, PurpleStatusPrimitive primitive)
178     PurplePresence *purple_account_get_presence(PurpleAccount *account)
179     glib.gboolean purple_account_is_status_active(PurpleAccount *account, \
180             char *status_id)
181     glib.GList *purple_account_get_status_types(PurpleAccount *account)
182     int purple_account_get_int(PurpleAccount *account, char *name, \
183             int default_value)
184     char *purple_account_get_string(PurpleAccount *account, \
185             char *name, char *default_value)
186     glib.gboolean purple_account_get_bool(PurpleAccount *account, \
187             char *name, glib.gboolean default_value)
188     int purple_account_get_ui_int(PurpleAccount *account, \
189             char *ui, char *name, int default_value)
190     char *purple_account_get_ui_string(PurpleAccount *account, \
191             char *ui, char *name, char *default_value)
192     glib.gboolean purple_account_get_ui_bool(PurpleAccount *account, \
193             char *ui, char *name, glib.gboolean default_value)
194     PurpleLog *purple_account_get_log(PurpleAccount *account, \
195             glib.gboolean create)
196     void purple_account_destroy_log(PurpleAccount *account)
197     void purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy)
198     void purple_account_add_buddies(PurpleAccount *account, \
199             glib.GList *buddies)
200     void purple_account_remove_buddy(PurpleAccount *account, \
201             PurpleBuddy *buddy, PurpleGroup *group)
202     void purple_account_remove_buddies(PurpleAccount *account, \
203             glib.GList *buddies, glib.GList *groups)
204     void purple_account_remove_group(PurpleAccount *account, \
205             PurpleGroup *group)
206     void purple_account_change_password(PurpleAccount *account, \
207             char *orig_pw, char *new_pw)
208     glib.gboolean purple_account_supports_offline_message( \
209             PurpleAccount *account, PurpleBuddy *buddy)
210     PurpleConnectionErrorInfo *purple_account_get_current_error( \
211             PurpleAccount *account)
212     void purple_account_clear_current_error(PurpleAccount *account)
213
214     # Accounts API
215     void purple_accounts_add(PurpleAccount *account)
216     void purple_accounts_remove(PurpleAccount *account)
217     void purple_accounts_delete(PurpleAccount *account)
218     void purple_accounts_reorder(PurpleAccount *account, glib.gint new_index)
219     glib.GList *purple_accounts_get_all()
220     glib.GList *purple_accounts_get_all_active()
221     PurpleAccount *purple_accounts_find(char *name, char *protocol)
222     void purple_accounts_restore_current_statuses()
223
224     # UI Registration Functions
225     void purple_accounts_set_ui_ops(PurpleAccountUiOps *ops)
226     PurpleAccountUiOps *purple_accounts_get_ui_ops()
227
228     # Accounts Subsystem
229     void *purple_accounts_get_handle()
230     void purple_accounts_init()
231     void purple_accounts_uninit()