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/>.
28 ctypedef long int time_t
29 ctypedef void* va_list
31 cdef extern from "libpurple/status.h":
32 ctypedef struct PurpleStatusType
33 ctypedef struct PurpleStatusAttr
34 ctypedef struct PurplePresence
35 ctypedef struct PurpleStatus
37 ctypedef enum PurplePresenceContext:
38 PURPLE_PRESENCE_CONTEXT_UNSET = 0
39 PURPLE_PRESENCE_CONTEXT_ACCOUNT
40 PURPLE_PRESENCE_CONTEXT_CONV
41 PURPLE_PRESENCE_CONTEXT_BUDDY
43 ctypedef enum PurpleStatusPrimitive:
44 PURPLE_STATUS_UNSET = 0
46 PURPLE_STATUS_AVAILABLE
47 PURPLE_STATUS_UNAVAILABLE
48 PURPLE_STATUS_INVISIBLE
50 PURPLE_STATUS_EXTENDED_AWAY
53 PURPLE_STATUS_NUM_PRIMITIVES
55 ctypedef struct PurpleStatusType:
56 PurpleStatusPrimitive primitive
60 glib.gboolean saveable
61 glib.gboolean user_settable
62 glib.gboolean independent
65 ctypedef struct PurpleStatusAttr:
68 value.PurpleValue *value_type
70 ctypedef struct __ChatType:
71 conversation.PurpleConversation *conv
74 ctypedef struct __BuddyType:
75 account.PurpleAccount *account
77 blist.PurpleBuddy *buddy
79 ctypedef union __UnionType:
80 account.PurpleAccount *account
84 ctypedef struct PurplePresence:
85 PurplePresenceContext context
90 glib.GHashTable *status_table
91 PurpleStatus *active_status
94 ctypedef struct PurpleStatus:
95 PurpleStatusType *type
96 PurplePresence *presence
99 glib.GHashTable *attr_values
101 ctypedef struct PurpleStatusBuddyKey:
102 account.PurpleAccount *account
105 # PurpleStatusPrimitive API
106 char *purple_primitive_get_id_from_type(PurpleStatusPrimitive type)
107 char *purple_primitive_get_name_from_type(PurpleStatusPrimitive type)
108 PurpleStatusPrimitive purple_primitive_get_type_from_id(char *id)
110 # PurpleStatusType API
111 PurpleStatusType *purple_status_type_new_full( \
112 PurpleStatusPrimitive primitive, char *id, char *name, \
113 glib.gboolean saveable, glib.gboolean user_settable, \
114 glib.gboolean independent)
115 PurpleStatusType *purple_status_type_new(PurpleStatusPrimitive primitive, \
116 char *id, char *name, glib.gboolean user_settable)
117 PurpleStatusType *purple_status_type_new_with_attrs( \
118 PurpleStatusPrimitive primitive,
119 char *id, char *name, glib.gboolean saveable, \
120 glib.gboolean user_settable, glib.gboolean independent, \
121 char *attr_id, char *attr_name, value.PurpleValue *attr_value, ...)
122 void purple_status_type_destroy(PurpleStatusType *status_type)
123 void purple_status_type_set_primary_attr(PurpleStatusType *status_type, \
125 void purple_status_type_add_attr(PurpleStatusType *status_type, char *id, \
126 char *name, value.PurpleValue *value_)
127 void purple_status_type_add_attrs(PurpleStatusType *status_type, \
128 char *id, char *name, value.PurpleValue *value_, ...)
129 void purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, \
131 PurpleStatusPrimitive purple_status_type_get_primitive( \
132 PurpleStatusType *status_type)
133 char *purple_status_type_get_id(PurpleStatusType *status_type)
134 char *purple_status_type_get_name(PurpleStatusType *status_type)
135 glib.gboolean purple_status_type_is_saveable(PurpleStatusType *status_type)
136 glib.gboolean purple_status_type_is_user_settable( \
137 PurpleStatusType *status_type)
138 glib.gboolean purple_status_type_is_independent( \
139 PurpleStatusType *status_type)
140 glib.gboolean purple_status_type_is_exclusive( \
141 PurpleStatusType *status_type)
142 glib.gboolean purple_status_type_is_available( \
143 PurpleStatusType *status_type)
144 char *purple_status_type_get_primary_attr(PurpleStatusType *type)
145 PurpleStatusAttr *purple_status_type_get_attr( \
146 PurpleStatusType *status_type, char *id)
147 glib.GList *purple_status_type_get_attrs(PurpleStatusType *status_type)
148 PurpleStatusType *purple_status_type_find_with_id( \
149 glib.GList *status_types, char *id)
151 # PurpleStatusAttr API
152 PurpleStatusAttr *purple_status_attr_new(char *id, char *name, \
153 value.PurpleValue *value_type)
154 void purple_status_attr_destroy(PurpleStatusAttr *attr)
155 char *purple_status_attr_get_id(PurpleStatusAttr *attr)
156 char *purple_status_attr_get_name(PurpleStatusAttr *attr)
157 value.PurpleValue *purple_status_attr_get_value(PurpleStatusAttr *attr)
160 PurpleStatus *purple_status_new(PurpleStatusType *status_type, \
161 PurplePresence *presence)
162 void purple_status_destroy(PurpleStatus *status)
163 void purple_status_set_active(PurpleStatus *status, glib.gboolean active)
164 void purple_status_set_active_with_attrs(PurpleStatus *status, \
165 glib.gboolean active, va_list args)
166 void purple_status_set_active_with_attrs_list(PurpleStatus *status, \
167 glib.gboolean active, glib.GList *attrs)
168 void purple_status_set_attr_boolean(PurpleStatus *status, char *id, \
169 glib.gboolean value_)
170 void purple_status_set_attr_int(PurpleStatus *status, char *id, int value_)
171 void purple_status_set_attr_string(PurpleStatus *status, char *id, \
173 PurpleStatusType *purple_status_get_type(PurpleStatus *status)
174 PurplePresence *purple_status_get_presence(PurpleStatus *status)
175 char *purple_status_get_id(PurpleStatus *status)
176 char *purple_status_get_name(PurpleStatus *status)
177 glib.gboolean purple_status_is_independent(PurpleStatus *status)
178 glib.gboolean purple_status_is_exclusive(PurpleStatus *status)
179 glib.gboolean purple_status_is_available(PurpleStatus *status)
180 glib.gboolean purple_status_is_active(PurpleStatus *status)
181 glib.gboolean purple_status_is_online(PurpleStatus *status)
182 value.PurpleValue *purple_status_get_attr_value(PurpleStatus *status, \
184 glib.gboolean purple_status_get_attr_boolean(PurpleStatus *status, \
186 int purple_status_get_attr_int(PurpleStatus *status, char *id)
187 char *purple_status_get_attr_string(PurpleStatus *status, char *id)
188 glib.gint purple_status_compare(PurpleStatus *status1, \
189 PurpleStatus *status2)
192 PurplePresence *purple_presence_new(PurplePresenceContext context)
193 PurplePresence *purple_presence_new_for_account( \
194 account.PurpleAccount *account)
195 PurplePresence *purple_presence_new_for_conv( \
196 conversation.PurpleConversation *conv)
197 PurplePresence *purple_presence_new_for_buddy(blist.PurpleBuddy *buddy)
198 void purple_presence_destroy(PurplePresence *presence)
199 void purple_presence_add_status(PurplePresence *presence, \
200 PurpleStatus *status)
201 void purple_presence_add_list(PurplePresence *presence, \
202 glib.GList *source_list)
203 void purple_presence_set_status_active(PurplePresence *presence, \
204 char *status_id, glib.gboolean active)
205 void purple_presence_switch_status(PurplePresence *presence, \
207 void purple_presence_set_idle(PurplePresence *presence, \
208 glib.gboolean idle, time_t idle_time)
209 void purple_presence_set_login_time(PurplePresence *presence, \
211 PurplePresenceContext purple_presence_get_context(PurplePresence *presence)
212 account.PurpleAccount *purple_presence_get_account( \
213 PurplePresence *presence)
214 conversation.PurpleConversation *purple_presence_get_conversation( \
215 PurplePresence *presence)
216 char *purple_presence_get_chat_user(PurplePresence *presence)
217 blist.PurpleBuddy *purple_presence_get_buddy(PurplePresence *presence)
218 glib.GList *purple_presence_get_statuses(PurplePresence *presence)
219 PurpleStatus *purple_presence_get_status(PurplePresence *presence, \
221 PurpleStatus *purple_presence_get_active_status(PurplePresence *presence)
222 glib.gboolean purple_presence_is_available(PurplePresence *presence)
223 glib.gboolean purple_presence_is_online(PurplePresence *presence)
224 glib.gboolean purple_presence_is_status_active(PurplePresence *presence, \
226 glib.gboolean purple_presence_is_status_primitive_active( \
227 PurplePresence *presence, PurpleStatusPrimitive primitive)
228 glib.gboolean purple_presence_is_idle(PurplePresence *presence)
229 time_t purple_presence_get_idle_time(PurplePresence *presence)
230 time_t purple_presence_get_login_time(PurplePresence *presence)
231 glib.gint purple_presence_compare(PurplePresence *presence1, \
232 PurplePresence *presence2)
235 void *purple_status_get_handle()
236 void purple_status_init()
237 void purple_status_uninit()