2 # Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
4 # This file is part of python-purple.
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.
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.
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/>.
23 ctypedef char const_char "const char"
25 # hack to avoid recursive loops by cython
26 cdef extern from "libpurple/connection.h":
27 ctypedef struct PurpleConnection:
30 cdef extern from "libpurple/log.h":
31 ctypedef struct PurpleLog:
34 cdef extern from "libpurple/proxy.h":
35 ctypedef struct PurpleProxyInfo:
38 cdef extern from "libpurple/status.h":
39 ctypedef struct PurpleStatus:
42 ctypedef struct PurplePresence:
45 cdef extern from "libpurple/account.h":
46 ctypedef struct PurpleAccountUiOps
47 ctypedef struct PurpleAccount
49 ctypedef glib.gboolean (*PurpleFilterAccountFunc) (PurpleAccount *account)
50 ctypedef void (*PurpleAccountRequestAuthorizationCb) (void *)
51 ctypedef void (*PurpleAccountRegistrationCb) (PurpleAccount *account, \
52 glib.gboolean succeeded, void *user_data)
53 ctypedef void (*PurpleAccountUnregistrationCb) (PurpleAccount *account, \
54 glib.gboolean succeeded, void *user_data)
56 ctypedef enum PurpleAccountRequestType:
57 PURPLE_ACCOUNT_REQUEST_AUTHORIZATION = 0
59 ctypedef struct PurpleAccountUiOps:
60 void (*notify_added) (PurpleAccount *account, const_char *remote_user, \
61 const_char *id, const_char *alias, const_char *message)
62 void (*status_changed) (PurpleAccount *account, PurpleStatus *status)
63 void (*request_add) (PurpleAccount *account, const_char *remote_user, \
64 const_char *id, const_char *alias, const_char *message)
65 void *(*request_authorize) (PurpleAccount *account, \
66 const_char *remote_user, const_char *id, const_char *alias, \
67 const_char *message, glib.gboolean on_list, \
68 PurpleAccountRequestAuthorizationCb authorize_cb, \
69 PurpleAccountRequestAuthorizationCb deny_cb, void *user_data)
70 void (*close_account_request) (void *ui_handle)
72 ctypedef struct PurpleAccount:
78 glib.gboolean remember_pass
81 glib.gboolean disconnecting
82 glib.GHashTable *settings
83 glib.GHashTable *ui_settings
84 PurpleProxyInfo *proxy_info
88 PurplePresence *presence
91 PurpleAccountRegistrationCb registration_cb
92 void *registration_cb_user_data
95 PurpleAccount *c_purple_account_new "purple_account_new" \
96 (char *username, char *protocol_id)
97 void c_purple_account_set_password "purple_account_set_password" \
98 (PurpleAccount *account, char *password)
99 char *c_purple_account_get_password "purple_account_get_password" \
100 (PurpleAccount *account)
101 void c_purple_account_set_enabled "purple_account_set_enabled" \
102 (PurpleAccount *account, char *ui, glib.gboolean value)
103 char *c_purple_account_get_username "purple_account_get_username" \
104 (PurpleAccount *account)
105 glib.GList *c_purple_accounts_get_all_active \
106 "purple_accounts_get_all_active" ()
107 void c_purple_accounts_set_ui_ops "purple_accounts_set_ui_ops" \
108 (PurpleAccountUiOps *ops)
109 glib.gboolean c_purple_account_is_connected "purple_account_is_connected" \
110 (PurpleAccount *account)
111 PurpleProxyInfo *c_purple_account_get_proxy_info \
112 "purple_account_get_proxy_info" (PurpleAccount *account)
113 void c_purple_account_set_proxy_info "purple_account_set_proxy_info" \
114 (PurpleAccount *account, PurpleProxyInfo *info)
115 char *c_purple_account_get_string "purple_account_get_string" \
116 (PurpleAccount *account, char *name, char *default_value)
117 int c_purple_account_get_int "purple_account_get_int" \
118 (PurpleAccount *account, char *name, int default_value)
119 glib.gboolean c_purple_account_get_bool "purple_account_get_bool" \
120 (PurpleAccount *account, char *name, glib.gboolean default_value)
121 void c_purple_account_clear_settings "purple_account_clear_settings" \
122 (PurpleAccount *account)
123 void c_purple_account_set_int "purple_account_set_int" \
124 (PurpleAccount *account, char *name, int value)
125 void c_purple_account_set_string "purple_account_set_string" \
126 (PurpleAccount *account, char *name, char *value)
127 void c_purple_account_set_bool "purple_account_set_bool" \
128 (PurpleAccount *account, char *name, glib.gboolean value)