|
Evan@653
|
1 |
/* |
|
Evan@653
|
2 |
* purple |
|
Evan@653
|
3 |
* |
|
Evan@653
|
4 |
* Purple is the legal property of its developers, whose names are too numerous |
|
Evan@653
|
5 |
* to list here. Please refer to the COPYRIGHT file distributed with this |
|
Evan@653
|
6 |
* source distribution. |
|
Evan@653
|
7 |
* |
|
Evan@653
|
8 |
* This program is free software; you can redistribute it and/or modify |
|
Evan@653
|
9 |
* it under the terms of the GNU General Public License as published by |
|
Evan@653
|
10 |
* the Free Software Foundation; either version 2 of the License, or |
|
Evan@653
|
11 |
* (at your option) any later version. |
|
Evan@653
|
12 |
* |
|
Evan@653
|
13 |
* This program is distributed in the hope that it will be useful, |
|
Evan@653
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
Evan@653
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
Evan@653
|
16 |
* GNU General Public License for more details. |
|
Evan@653
|
17 |
* |
|
Evan@653
|
18 |
* You should have received a copy of the GNU General Public License |
|
Evan@653
|
19 |
* along with this program; if not, write to the Free Software |
|
Evan@653
|
20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
Evan@653
|
21 |
*/ |
|
Evan@653
|
22 |
#ifndef _PURPLE_STATUS_H_ |
|
Evan@653
|
23 |
#define _PURPLE_STATUS_H_ |
|
Evan@653
|
24 |
|
|
Evan@653
|
25 |
/** |
|
Evan@653
|
26 |
* @file status.h Status API |
|
Evan@653
|
27 |
* @ingroup core |
|
Evan@653
|
28 |
* |
|
Evan@653
|
29 |
* A brief explanation of the status API: |
|
Evan@653
|
30 |
* |
|
Evan@653
|
31 |
* PurpleStatusType's are created by each PRPL. They outline the |
|
Evan@653
|
32 |
* available statuses of the protocol. AIM, for example, supports |
|
Evan@653
|
33 |
* an available state with an optional available message, an away |
|
Evan@653
|
34 |
* state with a mandatory message, and an invisible state (which is |
|
Evan@653
|
35 |
* technically "independent" of the other two, but we'll get into |
|
Evan@653
|
36 |
* that later). PurpleStatusTypes are very permanent. They are |
|
Evan@653
|
37 |
* hardcoded in each PRPL and will not change often. And because |
|
Evan@653
|
38 |
* they are hardcoded, they do not need to be saved to any XML file. |
|
Evan@653
|
39 |
* |
|
Evan@653
|
40 |
* A PurpleStatus can be thought of as an "instance" of a PurpleStatusType. |
|
Evan@653
|
41 |
* If you're familiar with object-oriented programming languages |
|
Evan@653
|
42 |
* then this should be immediately clear. Say, for example, that |
|
Evan@653
|
43 |
* one of your AIM buddies has set himself as "away." You have a |
|
Evan@653
|
44 |
* PurpleBuddy node for this person in your buddy list. Purple wants |
|
Evan@653
|
45 |
* to mark this buddy as "away," so it creates a new PurpleStatus. |
|
Evan@653
|
46 |
* The PurpleStatus has its PurpleStatusType set to the "away" state |
|
Evan@653
|
47 |
* for the oscar PRPL. The PurpleStatus also contains the buddy's |
|
Evan@653
|
48 |
* away message. PurpleStatuses are sometimes saved, depending on |
|
Evan@653
|
49 |
* the context. The current PurpleStatuses associated with each of |
|
Evan@653
|
50 |
* your accounts are saved so that the next time you start Purple, |
|
Evan@653
|
51 |
* your accounts will be set to their last known statuses. There |
|
Evan@653
|
52 |
* is also a list of saved statuses that are written to the |
|
zacw@2592
|
53 |
* status.xml file. Also, each PurpleStatus has a "saveable" boolean. |
|
zacw@2592
|
54 |
* If "saveable" is set to FALSE then the status is NEVER saved. |
|
Evan@653
|
55 |
* All PurpleStatuses should be inside a PurplePresence. |
|
Evan@653
|
56 |
* |
|
Evan@653
|
57 |
* |
|
zacw@2592
|
58 |
* A PurpleStatus is either "independent" or "exclusive." |
|
zacw@2592
|
59 |
* Independent statuses can be active or inactive and they don't |
|
Evan@653
|
60 |
* affect anything else. However, you can only have one exclusive |
|
zacw@2592
|
61 |
* status per PurplePresence. If you activate one exclusive status, |
|
Evan@653
|
62 |
* then the previous exclusive status is automatically deactivated. |
|
Evan@653
|
63 |
* |
|
Evan@653
|
64 |
* A PurplePresence is like a collection of PurpleStatuses (plus some |
|
Evan@653
|
65 |
* other random info). For any buddy, or for any one of your accounts, |
|
zacw@2592
|
66 |
* or for any person with which you're chatting, you may know various |
|
Evan@653
|
67 |
* amounts of information. This information is all contained in |
|
Evan@653
|
68 |
* one PurplePresence. If one of your buddies is away and idle, |
|
Evan@653
|
69 |
* then the presence contains the PurpleStatus for their awayness, |
|
Evan@653
|
70 |
* and it contains their current idle time. PurplePresences are |
|
zacw@2592
|
71 |
* never saved to disk. The information they contain is only relevant |
|
Evan@653
|
72 |
* for the current PurpleSession. |
|
Evan@653
|
73 |
*/ |
|
Evan@653
|
74 |
|
|
Evan@653
|
75 |
typedef struct _PurpleStatusType PurpleStatusType; |
|
Evan@653
|
76 |
typedef struct _PurpleStatusAttr PurpleStatusAttr; |
|
Evan@653
|
77 |
typedef struct _PurplePresence PurplePresence; |
|
Evan@653
|
78 |
typedef struct _PurpleStatus PurpleStatus; |
|
Evan@653
|
79 |
|
|
Evan@653
|
80 |
/** |
|
Evan@653
|
81 |
* A context for a presence. |
|
Evan@653
|
82 |
* |
|
zacw@2592
|
83 |
* The context indicates to what the presence applies. |
|
Evan@653
|
84 |
*/ |
|
Evan@653
|
85 |
typedef enum |
|
Evan@653
|
86 |
{ |
|
Evan@653
|
87 |
PURPLE_PRESENCE_CONTEXT_UNSET = 0, |
|
Evan@653
|
88 |
PURPLE_PRESENCE_CONTEXT_ACCOUNT, |
|
Evan@653
|
89 |
PURPLE_PRESENCE_CONTEXT_CONV, |
|
Evan@653
|
90 |
PURPLE_PRESENCE_CONTEXT_BUDDY |
|
Evan@653
|
91 |
|
|
Evan@653
|
92 |
} PurplePresenceContext; |
|
Evan@653
|
93 |
|
|
Evan@653
|
94 |
/** |
|
Evan@653
|
95 |
* A primitive defining the basic structure of a status type. |
|
Evan@653
|
96 |
*/ |
|
Evan@653
|
97 |
/* |
|
Evan@653
|
98 |
* If you add a value to this enum, make sure you update |
|
Evan@653
|
99 |
* the status_primitive_map array in status.c and the special-cases for idle |
|
Evan@653
|
100 |
* and offline-messagable just below it. |
|
Evan@653
|
101 |
*/ |
|
Evan@653
|
102 |
typedef enum |
|
Evan@653
|
103 |
{ |
|
Evan@653
|
104 |
PURPLE_STATUS_UNSET = 0, |
|
Evan@653
|
105 |
PURPLE_STATUS_OFFLINE, |
|
Evan@653
|
106 |
PURPLE_STATUS_AVAILABLE, |
|
Evan@653
|
107 |
PURPLE_STATUS_UNAVAILABLE, |
|
Evan@653
|
108 |
PURPLE_STATUS_INVISIBLE, |
|
Evan@653
|
109 |
PURPLE_STATUS_AWAY, |
|
Evan@653
|
110 |
PURPLE_STATUS_EXTENDED_AWAY, |
|
Evan@653
|
111 |
PURPLE_STATUS_MOBILE, |
|
Evan@653
|
112 |
PURPLE_STATUS_TUNE, |
|
Evan@653
|
113 |
PURPLE_STATUS_NUM_PRIMITIVES |
|
Evan@653
|
114 |
} PurpleStatusPrimitive; |
|
Evan@653
|
115 |
|
|
Evan@653
|
116 |
#include "account.h" |
|
Evan@653
|
117 |
#include "blist.h" |
|
Evan@653
|
118 |
#include "conversation.h" |
|
Evan@653
|
119 |
#include "value.h" |
|
Evan@653
|
120 |
|
|
Evan@653
|
121 |
#define PURPLE_TUNE_ARTIST "tune_artist" |
|
Evan@653
|
122 |
#define PURPLE_TUNE_TITLE "tune_title" |
|
Evan@653
|
123 |
#define PURPLE_TUNE_ALBUM "tune_album" |
|
Evan@653
|
124 |
#define PURPLE_TUNE_GENRE "tune_genre" |
|
Evan@653
|
125 |
#define PURPLE_TUNE_COMMENT "tune_comment" |
|
Evan@653
|
126 |
#define PURPLE_TUNE_TRACK "tune_track" |
|
Evan@653
|
127 |
#define PURPLE_TUNE_TIME "tune_time" |
|
Evan@653
|
128 |
#define PURPLE_TUNE_YEAR "tune_year" |
|
Evan@653
|
129 |
#define PURPLE_TUNE_URL "tune_url" |
|
Evan@653
|
130 |
#define PURPLE_TUNE_FULL "tune_full" |
|
Evan@653
|
131 |
|
|
Evan@653
|
132 |
#ifdef __cplusplus |
|
Evan@653
|
133 |
extern "C" { |
|
Evan@653
|
134 |
#endif |
|
Evan@653
|
135 |
|
|
Evan@653
|
136 |
/**************************************************************************/ |
|
zacw@2592
|
137 |
/** @name PurpleStatusPrimitive API */ |
|
Evan@653
|
138 |
/**************************************************************************/ |
|
Evan@653
|
139 |
/*@{*/ |
|
Evan@653
|
140 |
|
|
Evan@653
|
141 |
/** |
|
Evan@653
|
142 |
* Lookup the id of a primitive status type based on the type. This |
|
Evan@653
|
143 |
* ID is a unique plain-text name of the status, without spaces. |
|
Evan@653
|
144 |
* |
|
Evan@653
|
145 |
* @param type A primitive status type. |
|
Evan@653
|
146 |
* |
|
Evan@653
|
147 |
* @return The unique ID for this type. |
|
Evan@653
|
148 |
*/ |
|
Evan@653
|
149 |
const char *purple_primitive_get_id_from_type(PurpleStatusPrimitive type); |
|
Evan@653
|
150 |
|
|
Evan@653
|
151 |
/** |
|
Evan@653
|
152 |
* Lookup the name of a primitive status type based on the type. This |
|
Evan@653
|
153 |
* name is the plain-English name of the status type. It is usually one |
|
Evan@653
|
154 |
* or two words. |
|
Evan@653
|
155 |
* |
|
Evan@653
|
156 |
* @param type A primitive status type. |
|
Evan@653
|
157 |
* |
|
Evan@653
|
158 |
* @return The name of this type, suitable for users to see. |
|
Evan@653
|
159 |
*/ |
|
Evan@653
|
160 |
const char *purple_primitive_get_name_from_type(PurpleStatusPrimitive type); |
|
Evan@653
|
161 |
|
|
Evan@653
|
162 |
/** |
|
Evan@653
|
163 |
* Lookup the value of a primitive status type based on the id. The |
|
Evan@653
|
164 |
* ID is a unique plain-text name of the status, without spaces. |
|
Evan@653
|
165 |
* |
|
Evan@653
|
166 |
* @param id The unique ID of a primitive status type. |
|
Evan@653
|
167 |
* |
|
Evan@653
|
168 |
* @return The PurpleStatusPrimitive value. |
|
Evan@653
|
169 |
*/ |
|
Evan@653
|
170 |
PurpleStatusPrimitive purple_primitive_get_type_from_id(const char *id); |
|
Evan@653
|
171 |
|
|
Evan@653
|
172 |
/*@}*/ |
|
Evan@653
|
173 |
|
|
Evan@653
|
174 |
/**************************************************************************/ |
|
zacw@2592
|
175 |
/** @name PurpleStatusType API */ |
|
Evan@653
|
176 |
/**************************************************************************/ |
|
Evan@653
|
177 |
/*@{*/ |
|
Evan@653
|
178 |
|
|
Evan@653
|
179 |
/** |
|
Evan@653
|
180 |
* Creates a new status type. |
|
Evan@653
|
181 |
* |
|
Evan@653
|
182 |
* @param primitive The primitive status type. |
|
Evan@653
|
183 |
* @param id The ID of the status type, or @c NULL to use the id of |
|
Evan@653
|
184 |
* the primitive status type. |
|
Evan@653
|
185 |
* @param name The name presented to the user, or @c NULL to use the |
|
Evan@653
|
186 |
* name of the primitive status type. |
|
Evan@653
|
187 |
* @param saveable TRUE if the information set for this status by the |
|
Evan@653
|
188 |
* user can be saved for future sessions. |
|
Evan@653
|
189 |
* @param user_settable TRUE if this is a status the user can manually set. |
|
Evan@653
|
190 |
* @param independent TRUE if this is an independent (non-exclusive) |
|
Evan@653
|
191 |
* status type. |
|
Evan@653
|
192 |
* |
|
Evan@653
|
193 |
* @return A new status type. |
|
Evan@653
|
194 |
*/ |
|
Evan@653
|
195 |
PurpleStatusType *purple_status_type_new_full(PurpleStatusPrimitive primitive, |
|
Evan@653
|
196 |
const char *id, const char *name, |
|
Evan@653
|
197 |
gboolean saveable, |
|
Evan@653
|
198 |
gboolean user_settable, |
|
Evan@653
|
199 |
gboolean independent); |
|
Evan@653
|
200 |
|
|
Evan@653
|
201 |
/** |
|
Evan@700
|
202 |
* Creates a new status type with some default values ( |
|
Evan@700
|
203 |
* saveable and not independent). |
|
Evan@653
|
204 |
* |
|
Evan@653
|
205 |
* @param primitive The primitive status type. |
|
Evan@653
|
206 |
* @param id The ID of the status type, or @c NULL to use the id of |
|
Evan@653
|
207 |
* the primitive status type. |
|
Evan@653
|
208 |
* @param name The name presented to the user, or @c NULL to use the |
|
Evan@653
|
209 |
* name of the primitive status type. |
|
Evan@653
|
210 |
* @param user_settable TRUE if this is a status the user can manually set. |
|
Evan@653
|
211 |
* |
|
Evan@653
|
212 |
* @return A new status type. |
|
Evan@653
|
213 |
*/ |
|
Evan@653
|
214 |
PurpleStatusType *purple_status_type_new(PurpleStatusPrimitive primitive, |
|
Evan@653
|
215 |
const char *id, const char *name, |
|
Evan@653
|
216 |
gboolean user_settable); |
|
Evan@653
|
217 |
|
|
Evan@653
|
218 |
/** |
|
Evan@653
|
219 |
* Creates a new status type with attributes. |
|
Evan@653
|
220 |
* |
|
Evan@653
|
221 |
* @param primitive The primitive status type. |
|
Evan@653
|
222 |
* @param id The ID of the status type, or @c NULL to use the id of |
|
Evan@653
|
223 |
* the primitive status type. |
|
Evan@653
|
224 |
* @param name The name presented to the user, or @c NULL to use the |
|
Evan@653
|
225 |
* name of the primitive status type. |
|
Evan@653
|
226 |
* @param saveable TRUE if the information set for this status by the |
|
Evan@653
|
227 |
* user can be saved for future sessions. |
|
Evan@653
|
228 |
* @param user_settable TRUE if this is a status the user can manually set. |
|
Evan@653
|
229 |
* @param independent TRUE if this is an independent (non-exclusive) |
|
Evan@653
|
230 |
* status type. |
|
Evan@653
|
231 |
* @param attr_id The ID of the first attribute. |
|
Evan@653
|
232 |
* @param attr_name The name of the first attribute. |
|
Evan@653
|
233 |
* @param attr_value The value type of the first attribute attribute. |
|
Evan@653
|
234 |
* @param ... Additional attribute information. |
|
Evan@653
|
235 |
* |
|
Evan@653
|
236 |
* @return A new status type. |
|
Evan@653
|
237 |
*/ |
|
Evan@653
|
238 |
PurpleStatusType *purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, |
|
Evan@653
|
239 |
const char *id, |
|
Evan@653
|
240 |
const char *name, |
|
Evan@653
|
241 |
gboolean saveable, |
|
Evan@653
|
242 |
gboolean user_settable, |
|
Evan@653
|
243 |
gboolean independent, |
|
Evan@653
|
244 |
const char *attr_id, |
|
Evan@653
|
245 |
const char *attr_name, |
|
Evan@653
|
246 |
PurpleValue *attr_value, ...) G_GNUC_NULL_TERMINATED; |
|
Evan@653
|
247 |
|
|
Evan@653
|
248 |
/** |
|
Evan@653
|
249 |
* Destroys a status type. |
|
Evan@653
|
250 |
* |
|
Evan@653
|
251 |
* @param status_type The status type to destroy. |
|
Evan@653
|
252 |
*/ |
|
Evan@653
|
253 |
void purple_status_type_destroy(PurpleStatusType *status_type); |
|
Evan@653
|
254 |
|
|
Evan@1427
|
255 |
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) |
|
Evan@653
|
256 |
/** |
|
Evan@653
|
257 |
* Sets a status type's primary attribute. |
|
Evan@653
|
258 |
* |
|
Evan@653
|
259 |
* The value for the primary attribute is used as the description for |
|
Evan@653
|
260 |
* the particular status type. An example is an away message. The message |
|
Evan@653
|
261 |
* would be the primary attribute. |
|
Evan@653
|
262 |
* |
|
Evan@653
|
263 |
* @param status_type The status type. |
|
Evan@653
|
264 |
* @param attr_id The ID of the primary attribute. |
|
Evan@1427
|
265 |
* |
|
Evan@1427
|
266 |
* @deprecated This function isn't used and should be removed in 3.0.0. |
|
Evan@653
|
267 |
*/ |
|
Evan@653
|
268 |
void purple_status_type_set_primary_attr(PurpleStatusType *status_type, |
|
Evan@653
|
269 |
const char *attr_id); |
|
Evan@1427
|
270 |
#endif |
|
Evan@653
|
271 |
|
|
Evan@1427
|
272 |
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) |
|
Evan@653
|
273 |
/** |
|
Evan@653
|
274 |
* Adds an attribute to a status type. |
|
Evan@653
|
275 |
* |
|
Evan@653
|
276 |
* @param status_type The status type to add the attribute to. |
|
Evan@653
|
277 |
* @param id The ID of the attribute. |
|
Evan@653
|
278 |
* @param name The name presented to the user. |
|
Evan@653
|
279 |
* @param value The value type of this attribute. |
|
Evan@1427
|
280 |
* |
|
Evan@1427
|
281 |
* @deprecated This function isn't needed and should be removed in 3.0.0. |
|
Evan@1427
|
282 |
* Status type attributes should be set when the status type |
|
Evan@1427
|
283 |
* is created, in the call to purple_status_type_new_with_attrs. |
|
Evan@653
|
284 |
*/ |
|
Evan@653
|
285 |
void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, |
|
Evan@653
|
286 |
const char *name, PurpleValue *value); |
|
Evan@1427
|
287 |
#endif |
|
Evan@653
|
288 |
|
|
Evan@1427
|
289 |
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) |
|
Evan@653
|
290 |
/** |
|
Evan@653
|
291 |
* Adds multiple attributes to a status type. |
|
Evan@653
|
292 |
* |
|
Evan@653
|
293 |
* @param status_type The status type to add the attribute to. |
|
Evan@653
|
294 |
* @param id The ID of the first attribute. |
|
Evan@653
|
295 |
* @param name The description of the first attribute. |
|
Evan@653
|
296 |
* @param value The value type of the first attribute attribute. |
|
Evan@653
|
297 |
* @param ... Additional attribute information. |
|
Evan@1427
|
298 |
* |
|
Evan@1427
|
299 |
* @deprecated This function isn't needed and should be removed in 3.0.0. |
|
Evan@1427
|
300 |
* Status type attributes should be set when the status type |
|
Evan@1427
|
301 |
* is created, in the call to purple_status_type_new_with_attrs. |
|
Evan@653
|
302 |
*/ |
|
Evan@653
|
303 |
void purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, |
|
Evan@653
|
304 |
const char *name, PurpleValue *value, ...) G_GNUC_NULL_TERMINATED; |
|
Evan@1427
|
305 |
#endif |
|
Evan@653
|
306 |
|
|
Evan@1427
|
307 |
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) |
|
Evan@653
|
308 |
/** |
|
Evan@653
|
309 |
* Adds multiple attributes to a status type using a va_list. |
|
Evan@653
|
310 |
* |
|
Evan@653
|
311 |
* @param status_type The status type to add the attribute to. |
|
Evan@653
|
312 |
* @param args The va_list of attributes. |
|
Evan@1427
|
313 |
* |
|
Evan@1427
|
314 |
* @deprecated This function isn't needed and should be removed in 3.0.0. |
|
Evan@1427
|
315 |
* Status type attributes should be set when the status type |
|
Evan@1427
|
316 |
* is created, in the call to purple_status_type_new_with_attrs. |
|
Evan@653
|
317 |
*/ |
|
Evan@653
|
318 |
void purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, |
|
Evan@653
|
319 |
va_list args); |
|
Evan@1427
|
320 |
#endif |
|
Evan@653
|
321 |
|
|
Evan@653
|
322 |
/** |
|
Evan@653
|
323 |
* Returns the primitive type of a status type. |
|
Evan@653
|
324 |
* |
|
Evan@653
|
325 |
* @param status_type The status type. |
|
Evan@653
|
326 |
* |
|
Evan@653
|
327 |
* @return The primitive type of the status type. |
|
Evan@653
|
328 |
*/ |
|
Evan@653
|
329 |
PurpleStatusPrimitive purple_status_type_get_primitive( |
|
Evan@653
|
330 |
const PurpleStatusType *status_type); |
|
Evan@653
|
331 |
|
|
Evan@653
|
332 |
/** |
|
Evan@653
|
333 |
* Returns the ID of a status type. |
|
Evan@653
|
334 |
* |
|
Evan@653
|
335 |
* @param status_type The status type. |
|
Evan@653
|
336 |
* |
|
Evan@653
|
337 |
* @return The ID of the status type. |
|
Evan@653
|
338 |
*/ |
|
Evan@653
|
339 |
const char *purple_status_type_get_id(const PurpleStatusType *status_type); |
|
Evan@653
|
340 |
|
|
Evan@653
|
341 |
/** |
|
Evan@653
|
342 |
* Returns the name of a status type. |
|
Evan@653
|
343 |
* |
|
Evan@653
|
344 |
* @param status_type The status type. |
|
Evan@653
|
345 |
* |
|
Evan@653
|
346 |
* @return The name of the status type. |
|
Evan@653
|
347 |
*/ |
|
Evan@653
|
348 |
const char *purple_status_type_get_name(const PurpleStatusType *status_type); |
|
Evan@653
|
349 |
|
|
Evan@653
|
350 |
/** |
|
Evan@653
|
351 |
* Returns whether or not the status type is saveable. |
|
Evan@653
|
352 |
* |
|
Evan@653
|
353 |
* @param status_type The status type. |
|
Evan@653
|
354 |
* |
|
Evan@653
|
355 |
* @return TRUE if user-defined statuses based off this type are saveable. |
|
Evan@653
|
356 |
* FALSE otherwise. |
|
Evan@653
|
357 |
*/ |
|
Evan@653
|
358 |
gboolean purple_status_type_is_saveable(const PurpleStatusType *status_type); |
|
Evan@653
|
359 |
|
|
Evan@653
|
360 |
/** |
|
Evan@653
|
361 |
* Returns whether or not the status type can be set or modified by the |
|
Evan@653
|
362 |
* user. |
|
Evan@653
|
363 |
* |
|
Evan@653
|
364 |
* @param status_type The status type. |
|
Evan@653
|
365 |
* |
|
Evan@653
|
366 |
* @return TRUE if the status type can be set or modified by the user. |
|
Evan@653
|
367 |
* FALSE if it's a protocol-set setting. |
|
Evan@653
|
368 |
*/ |
|
Evan@653
|
369 |
gboolean purple_status_type_is_user_settable(const PurpleStatusType *status_type); |
|
Evan@653
|
370 |
|
|
Evan@653
|
371 |
/** |
|
Evan@653
|
372 |
* Returns whether or not the status type is independent. |
|
Evan@653
|
373 |
* |
|
Evan@653
|
374 |
* Independent status types are non-exclusive. If other status types on |
|
Evan@653
|
375 |
* the same hierarchy level are set, this one will not be affected. |
|
Evan@653
|
376 |
* |
|
Evan@653
|
377 |
* @param status_type The status type. |
|
Evan@653
|
378 |
* |
|
Evan@653
|
379 |
* @return TRUE if the status type is independent, or FALSE otherwise. |
|
Evan@653
|
380 |
*/ |
|
Evan@653
|
381 |
gboolean purple_status_type_is_independent(const PurpleStatusType *status_type); |
|
Evan@653
|
382 |
|
|
Evan@653
|
383 |
/** |
|
Evan@653
|
384 |
* Returns whether the status type is exclusive. |
|
Evan@653
|
385 |
* |
|
Evan@653
|
386 |
* @param status_type The status type. |
|
Evan@653
|
387 |
* |
|
Evan@653
|
388 |
* @return TRUE if the status type is exclusive, FALSE otherwise. |
|
Evan@653
|
389 |
*/ |
|
Evan@653
|
390 |
gboolean purple_status_type_is_exclusive(const PurpleStatusType *status_type); |
|
Evan@653
|
391 |
|
|
Evan@653
|
392 |
/** |
|
Evan@653
|
393 |
* Returns whether or not a status type is available. |
|
Evan@653
|
394 |
* |
|
Evan@653
|
395 |
* Available status types are online and possibly invisible, but not away. |
|
Evan@653
|
396 |
* |
|
Evan@653
|
397 |
* @param status_type The status type. |
|
Evan@653
|
398 |
* |
|
Evan@653
|
399 |
* @return TRUE if the status is available, or FALSE otherwise. |
|
Evan@653
|
400 |
*/ |
|
Evan@653
|
401 |
gboolean purple_status_type_is_available(const PurpleStatusType *status_type); |
|
Evan@653
|
402 |
|
|
Evan@1427
|
403 |
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) |
|
Evan@653
|
404 |
/** |
|
Evan@653
|
405 |
* Returns a status type's primary attribute ID. |
|
Evan@653
|
406 |
* |
|
Evan@653
|
407 |
* @param type The status type. |
|
Evan@653
|
408 |
* |
|
Evan@653
|
409 |
* @return The primary attribute's ID. |
|
Evan@1427
|
410 |
* |
|
Evan@1427
|
411 |
* @deprecated This function isn't used and should be removed in 3.0.0. |
|
Evan@653
|
412 |
*/ |
|
Evan@653
|
413 |
const char *purple_status_type_get_primary_attr(const PurpleStatusType *type); |
|
Evan@1427
|
414 |
#endif |
|
Evan@653
|
415 |
|
|
Evan@653
|
416 |
/** |
|
Evan@653
|
417 |
* Returns the attribute with the specified ID. |
|
Evan@653
|
418 |
* |
|
Evan@653
|
419 |
* @param status_type The status type containing the attribute. |
|
Evan@653
|
420 |
* @param id The ID of the desired attribute. |
|
Evan@653
|
421 |
* |
|
Evan@653
|
422 |
* @return The attribute, if found. NULL otherwise. |
|
Evan@653
|
423 |
*/ |
|
Evan@653
|
424 |
PurpleStatusAttr *purple_status_type_get_attr(const PurpleStatusType *status_type, |
|
Evan@653
|
425 |
const char *id); |
|
Evan@653
|
426 |
|
|
Evan@653
|
427 |
/** |
|
Evan@653
|
428 |
* Returns a list of all attributes in a status type. |
|
Evan@653
|
429 |
* |
|
Evan@653
|
430 |
* @param status_type The status type. |
|
Evan@653
|
431 |
* |
|
Evan@653
|
432 |
* @constreturn The list of attributes. |
|
Evan@653
|
433 |
*/ |
|
Evan@653
|
434 |
GList *purple_status_type_get_attrs(const PurpleStatusType *status_type); |
|
Evan@653
|
435 |
|
|
Evan@653
|
436 |
/** |
|
Evan@653
|
437 |
* Find the PurpleStatusType with the given id. |
|
Evan@653
|
438 |
* |
|
Evan@653
|
439 |
* @param status_types A list of status types. Often account->status_types. |
|
Evan@653
|
440 |
* @param id The unique ID of the status type you wish to find. |
|
Evan@653
|
441 |
* |
|
Evan@653
|
442 |
* @return The status type with the given ID, or NULL if one could |
|
Evan@653
|
443 |
* not be found. |
|
Evan@653
|
444 |
*/ |
|
Evan@653
|
445 |
const PurpleStatusType *purple_status_type_find_with_id(GList *status_types, |
|
Evan@653
|
446 |
const char *id); |
|
Evan@653
|
447 |
|
|
Evan@653
|
448 |
/*@}*/ |
|
Evan@653
|
449 |
|
|
Evan@653
|
450 |
/**************************************************************************/ |
|
Evan@653
|
451 |
/** @name PurpleStatusAttr API */ |
|
Evan@653
|
452 |
/**************************************************************************/ |
|
Evan@653
|
453 |
/*@{*/ |
|
Evan@653
|
454 |
|
|
Evan@653
|
455 |
/** |
|
Evan@653
|
456 |
* Creates a new status attribute. |
|
Evan@653
|
457 |
* |
|
Evan@653
|
458 |
* @param id The ID of the attribute. |
|
Evan@653
|
459 |
* @param name The name presented to the user. |
|
Evan@653
|
460 |
* @param value_type The type of data contained in the attribute. |
|
Evan@653
|
461 |
* |
|
Evan@653
|
462 |
* @return A new status attribute. |
|
Evan@653
|
463 |
*/ |
|
Evan@653
|
464 |
PurpleStatusAttr *purple_status_attr_new(const char *id, const char *name, |
|
Evan@653
|
465 |
PurpleValue *value_type); |
|
Evan@653
|
466 |
|
|
Evan@653
|
467 |
/** |
|
Evan@653
|
468 |
* Destroys a status attribute. |
|
Evan@653
|
469 |
* |
|
Evan@653
|
470 |
* @param attr The status attribute to destroy. |
|
Evan@653
|
471 |
*/ |
|
Evan@653
|
472 |
void purple_status_attr_destroy(PurpleStatusAttr *attr); |
|
Evan@653
|
473 |
|
|
Evan@653
|
474 |
/** |
|
Evan@653
|
475 |
* Returns the ID of a status attribute. |
|
Evan@653
|
476 |
* |
|
Evan@653
|
477 |
* @param attr The status attribute. |
|
Evan@653
|
478 |
* |
|
Evan@653
|
479 |
* @return The status attribute's ID. |
|
Evan@653
|
480 |
*/ |
|
Evan@653
|
481 |
const char *purple_status_attr_get_id(const PurpleStatusAttr *attr); |
|
Evan@653
|
482 |
|
|
Evan@653
|
483 |
/** |
|
Evan@653
|
484 |
* Returns the name of a status attribute. |
|
Evan@653
|
485 |
* |
|
Evan@653
|
486 |
* @param attr The status attribute. |
|
Evan@653
|
487 |
* |
|
Evan@653
|
488 |
* @return The status attribute's name. |
|
Evan@653
|
489 |
*/ |
|
Evan@653
|
490 |
const char *purple_status_attr_get_name(const PurpleStatusAttr *attr); |
|
Evan@653
|
491 |
|
|
Evan@653
|
492 |
/** |
|
Evan@653
|
493 |
* Returns the value of a status attribute. |
|
Evan@653
|
494 |
* |
|
Evan@653
|
495 |
* @param attr The status attribute. |
|
Evan@653
|
496 |
* |
|
Evan@653
|
497 |
* @return The status attribute's value. |
|
Evan@653
|
498 |
*/ |
|
Evan@653
|
499 |
PurpleValue *purple_status_attr_get_value(const PurpleStatusAttr *attr); |
|
Evan@653
|
500 |
|
|
Evan@653
|
501 |
/*@}*/ |
|
Evan@653
|
502 |
|
|
Evan@653
|
503 |
/**************************************************************************/ |
|
Evan@653
|
504 |
/** @name PurpleStatus API */ |
|
Evan@653
|
505 |
/**************************************************************************/ |
|
Evan@653
|
506 |
/*@{*/ |
|
Evan@653
|
507 |
|
|
Evan@653
|
508 |
/** |
|
Evan@653
|
509 |
* Creates a new status. |
|
Evan@653
|
510 |
* |
|
Evan@653
|
511 |
* @param status_type The type of status. |
|
Evan@653
|
512 |
* @param presence The parent presence. |
|
Evan@653
|
513 |
* |
|
Evan@653
|
514 |
* @return The new status. |
|
Evan@653
|
515 |
*/ |
|
Evan@653
|
516 |
PurpleStatus *purple_status_new(PurpleStatusType *status_type, |
|
Evan@653
|
517 |
PurplePresence *presence); |
|
Evan@653
|
518 |
|
|
Evan@653
|
519 |
/** |
|
Evan@653
|
520 |
* Destroys a status. |
|
Evan@653
|
521 |
* |
|
Evan@653
|
522 |
* @param status The status to destroy. |
|
Evan@653
|
523 |
*/ |
|
Evan@653
|
524 |
void purple_status_destroy(PurpleStatus *status); |
|
Evan@653
|
525 |
|
|
Evan@653
|
526 |
/** |
|
Evan@653
|
527 |
* Sets whether or not a status is active. |
|
Evan@653
|
528 |
* |
|
Evan@653
|
529 |
* This should only be called by the account, conversation, and buddy APIs. |
|
Evan@653
|
530 |
* |
|
Evan@653
|
531 |
* @param status The status. |
|
Evan@653
|
532 |
* @param active The active state. |
|
Evan@653
|
533 |
*/ |
|
Evan@653
|
534 |
void purple_status_set_active(PurpleStatus *status, gboolean active); |
|
Evan@653
|
535 |
|
|
Evan@653
|
536 |
/** |
|
Evan@653
|
537 |
* Sets whether or not a status is active. |
|
Evan@653
|
538 |
* |
|
Evan@653
|
539 |
* This should only be called by the account, conversation, and buddy APIs. |
|
Evan@653
|
540 |
* |
|
Evan@653
|
541 |
* @param status The status. |
|
Evan@653
|
542 |
* @param active The active state. |
|
Evan@653
|
543 |
* @param args A list of attributes to set on the status. This list is |
|
Evan@653
|
544 |
* composed of key/value pairs, where each key is a valid |
|
Evan@653
|
545 |
* attribute name for this PurpleStatusType. The list should |
|
Evan@653
|
546 |
* be NULL terminated. |
|
Evan@653
|
547 |
*/ |
|
Evan@653
|
548 |
void purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active, |
|
Evan@653
|
549 |
va_list args); |
|
Evan@653
|
550 |
|
|
Evan@653
|
551 |
/** |
|
Evan@653
|
552 |
* Sets whether or not a status is active. |
|
Evan@653
|
553 |
* |
|
Evan@653
|
554 |
* This should only be called by the account, conversation, and buddy APIs. |
|
Evan@653
|
555 |
* |
|
Evan@653
|
556 |
* @param status The status. |
|
Evan@653
|
557 |
* @param active The active state. |
|
Evan@653
|
558 |
* @param attrs A list of attributes to set on the status. This list is |
|
Evan@653
|
559 |
* composed of key/value pairs, where each key is a valid |
|
Evan@653
|
560 |
* attribute name for this PurpleStatusType. The list is |
|
Evan@653
|
561 |
* not modified or freed by this function. |
|
Evan@653
|
562 |
*/ |
|
Evan@653
|
563 |
void purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, |
|
Evan@653
|
564 |
GList *attrs); |
|
Evan@653
|
565 |
|
|
Evan@1427
|
566 |
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) |
|
Evan@653
|
567 |
/** |
|
Evan@653
|
568 |
* Sets the boolean value of an attribute in a status with the specified ID. |
|
Evan@653
|
569 |
* |
|
Evan@653
|
570 |
* @param status The status. |
|
Evan@653
|
571 |
* @param id The attribute ID. |
|
Evan@653
|
572 |
* @param value The boolean value. |
|
Evan@1427
|
573 |
* |
|
Evan@1427
|
574 |
* @deprecated This function is only used by status.c and should be made |
|
Evan@1427
|
575 |
* static in 3.0.0. |
|
Evan@653
|
576 |
*/ |
|
Evan@653
|
577 |
void purple_status_set_attr_boolean(PurpleStatus *status, const char *id, |
|
Evan@653
|
578 |
gboolean value); |
|
Evan@1427
|
579 |
#endif |
|
Evan@653
|
580 |
|
|
Evan@1427
|
581 |
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) |
|
Evan@653
|
582 |
/** |
|
Evan@653
|
583 |
* Sets the integer value of an attribute in a status with the specified ID. |
|
Evan@653
|
584 |
* |
|
Evan@653
|
585 |
* @param status The status. |
|
Evan@653
|
586 |
* @param id The attribute ID. |
|
Evan@653
|
587 |
* @param value The integer value. |
|
Evan@1427
|
588 |
* |
|
Evan@1427
|
589 |
* @deprecated This function is only used by status.c and should be made |
|
Evan@1427
|
590 |
* static in 3.0.0. |
|
Evan@653
|
591 |
*/ |
|
Evan@653
|
592 |
void purple_status_set_attr_int(PurpleStatus *status, const char *id, |
|
Evan@653
|
593 |
int value); |
|
Evan@1427
|
594 |
#endif |
|
Evan@653
|
595 |
|
|
Evan@1427
|
596 |
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) |
|
Evan@653
|
597 |
/** |
|
Evan@653
|
598 |
* Sets the string value of an attribute in a status with the specified ID. |
|
Evan@653
|
599 |
* |
|
Evan@653
|
600 |
* @param status The status. |
|
Evan@653
|
601 |
* @param id The attribute ID. |
|
Evan@653
|
602 |
* @param value The string value. |
|
Evan@1427
|
603 |
* |
|
Evan@1427
|
604 |
* @deprecated This function is only used by status.c and should be made |
|
Evan@1427
|
605 |
* static in 3.0.0. |
|
Evan@653
|
606 |
*/ |
|
Evan@653
|
607 |
void purple_status_set_attr_string(PurpleStatus *status, const char *id, |
|
Evan@653
|
608 |
const char *value); |
|
Evan@1427
|
609 |
#endif |
|
Evan@653
|
610 |
|
|
Evan@653
|
611 |
/** |
|
Evan@653
|
612 |
* Returns the status's type. |
|
Evan@653
|
613 |
* |
|
Evan@653
|
614 |
* @param status The status. |
|
Evan@653
|
615 |
* |
|
Evan@653
|
616 |
* @return The status's type. |
|
Evan@653
|
617 |
*/ |
|
Evan@653
|
618 |
PurpleStatusType *purple_status_get_type(const PurpleStatus *status); |
|
Evan@653
|
619 |
|
|
Evan@653
|
620 |
/** |
|
Evan@653
|
621 |
* Returns the status's presence. |
|
Evan@653
|
622 |
* |
|
Evan@653
|
623 |
* @param status The status. |
|
Evan@653
|
624 |
* |
|
Evan@653
|
625 |
* @return The status's presence. |
|
Evan@653
|
626 |
*/ |
|
Evan@653
|
627 |
PurplePresence *purple_status_get_presence(const PurpleStatus *status); |
|
Evan@653
|
628 |
|
|
Evan@653
|
629 |
/** |
|
Evan@653
|
630 |
* Returns the status's type ID. |
|
Evan@653
|
631 |
* |
|
Evan@653
|
632 |
* This is a convenience method for |
|
Evan@653
|
633 |
* purple_status_type_get_id(purple_status_get_type(status)). |
|
Evan@653
|
634 |
* |
|
Evan@653
|
635 |
* @param status The status. |
|
Evan@653
|
636 |
* |
|
Evan@653
|
637 |
* @return The status's ID. |
|
Evan@653
|
638 |
*/ |
|
Evan@653
|
639 |
const char *purple_status_get_id(const PurpleStatus *status); |
|
Evan@653
|
640 |
|
|
Evan@653
|
641 |
/** |
|
Evan@653
|
642 |
* Returns the status's name. |
|
Evan@653
|
643 |
* |
|
Evan@653
|
644 |
* This is a convenience method for |
|
Evan@653
|
645 |
* purple_status_type_get_name(purple_status_get_type(status)). |
|
Evan@653
|
646 |
* |
|
Evan@653
|
647 |
* @param status The status. |
|
Evan@653
|
648 |
* |
|
Evan@653
|
649 |
* @return The status's name. |
|
Evan@653
|
650 |
*/ |
|
Evan@653
|
651 |
const char *purple_status_get_name(const PurpleStatus *status); |
|
Evan@653
|
652 |
|
|
Evan@653
|
653 |
/** |
|
Evan@653
|
654 |
* Returns whether or not a status is independent. |
|
Evan@653
|
655 |
* |
|
Evan@653
|
656 |
* This is a convenience method for |
|
Evan@653
|
657 |
* purple_status_type_is_independent(purple_status_get_type(status)). |
|
Evan@653
|
658 |
* |
|
Evan@653
|
659 |
* @param status The status. |
|
Evan@653
|
660 |
* |
|
Evan@653
|
661 |
* @return TRUE if the status is independent, or FALSE otherwise. |
|
Evan@653
|
662 |
*/ |
|
Evan@653
|
663 |
gboolean purple_status_is_independent(const PurpleStatus *status); |
|
Evan@653
|
664 |
|
|
Evan@653
|
665 |
/** |
|
Evan@653
|
666 |
* Returns whether or not a status is exclusive. |
|
Evan@653
|
667 |
* |
|
Evan@653
|
668 |
* This is a convenience method for |
|
Evan@653
|
669 |
* purple_status_type_is_exclusive(purple_status_get_type(status)). |
|
Evan@653
|
670 |
* |
|
Evan@653
|
671 |
* @param status The status. |
|
Evan@653
|
672 |
* |
|
Evan@653
|
673 |
* @return TRUE if the status is exclusive, FALSE otherwise. |
|
Evan@653
|
674 |
*/ |
|
Evan@653
|
675 |
gboolean purple_status_is_exclusive(const PurpleStatus *status); |
|
Evan@653
|
676 |
|
|
Evan@653
|
677 |
/** |
|
Evan@653
|
678 |
* Returns whether or not a status is available. |
|
Evan@653
|
679 |
* |
|
Evan@653
|
680 |
* Available statuses are online and possibly invisible, but not away or idle. |
|
Evan@653
|
681 |
* |
|
Evan@653
|
682 |
* This is a convenience method for |
|
Evan@653
|
683 |
* purple_status_type_is_available(purple_status_get_type(status)). |
|
Evan@653
|
684 |
* |
|
Evan@653
|
685 |
* @param status The status. |
|
Evan@653
|
686 |
* |
|
Evan@653
|
687 |
* @return TRUE if the status is available, or FALSE otherwise. |
|
Evan@653
|
688 |
*/ |
|
Evan@653
|
689 |
gboolean purple_status_is_available(const PurpleStatus *status); |
|
Evan@653
|
690 |
|
|
Evan@653
|
691 |
/** |
|
Evan@653
|
692 |
* Returns the active state of a status. |
|
Evan@653
|
693 |
* |
|
Evan@653
|
694 |
* @param status The status. |
|
Evan@653
|
695 |
* |
|
Evan@653
|
696 |
* @return The active state of the status. |
|
Evan@653
|
697 |
*/ |
|
Evan@653
|
698 |
gboolean purple_status_is_active(const PurpleStatus *status); |
|
Evan@653
|
699 |
|
|
Evan@653
|
700 |
/** |
|
Evan@653
|
701 |
* Returns whether or not a status is considered 'online' |
|
Evan@653
|
702 |
* |
|
Evan@653
|
703 |
* @param status The status. |
|
Evan@653
|
704 |
* |
|
Evan@653
|
705 |
* @return TRUE if the status is considered online, FALSE otherwise |
|
Evan@653
|
706 |
*/ |
|
Evan@653
|
707 |
gboolean purple_status_is_online(const PurpleStatus *status); |
|
Evan@653
|
708 |
|
|
Evan@653
|
709 |
/** |
|
Evan@653
|
710 |
* Returns the value of an attribute in a status with the specified ID. |
|
Evan@653
|
711 |
* |
|
Evan@653
|
712 |
* @param status The status. |
|
Evan@653
|
713 |
* @param id The attribute ID. |
|
Evan@653
|
714 |
* |
|
Evan@653
|
715 |
* @return The value of the attribute. |
|
Evan@653
|
716 |
*/ |
|
Evan@653
|
717 |
PurpleValue *purple_status_get_attr_value(const PurpleStatus *status, |
|
Evan@653
|
718 |
const char *id); |
|
Evan@653
|
719 |
|
|
Evan@653
|
720 |
/** |
|
Evan@653
|
721 |
* Returns the boolean value of an attribute in a status with the specified ID. |
|
Evan@653
|
722 |
* |
|
Evan@653
|
723 |
* @param status The status. |
|
Evan@653
|
724 |
* @param id The attribute ID. |
|
Evan@653
|
725 |
* |
|
Evan@653
|
726 |
* @return The boolean value of the attribute. |
|
Evan@653
|
727 |
*/ |
|
Evan@653
|
728 |
gboolean purple_status_get_attr_boolean(const PurpleStatus *status, |
|
Evan@653
|
729 |
const char *id); |
|
Evan@653
|
730 |
|
|
Evan@653
|
731 |
/** |
|
Evan@653
|
732 |
* Returns the integer value of an attribute in a status with the specified ID. |
|
Evan@653
|
733 |
* |
|
Evan@653
|
734 |
* @param status The status. |
|
Evan@653
|
735 |
* @param id The attribute ID. |
|
Evan@653
|
736 |
* |
|
Evan@653
|
737 |
* @return The integer value of the attribute. |
|
Evan@653
|
738 |
*/ |
|
Evan@653
|
739 |
int purple_status_get_attr_int(const PurpleStatus *status, const char *id); |
|
Evan@653
|
740 |
|
|
Evan@653
|
741 |
/** |
|
Evan@653
|
742 |
* Returns the string value of an attribute in a status with the specified ID. |
|
Evan@653
|
743 |
* |
|
Evan@653
|
744 |
* @param status The status. |
|
Evan@653
|
745 |
* @param id The attribute ID. |
|
Evan@653
|
746 |
* |
|
Evan@653
|
747 |
* @return The string value of the attribute. |
|
Evan@653
|
748 |
*/ |
|
Evan@653
|
749 |
const char *purple_status_get_attr_string(const PurpleStatus *status, |
|
Evan@653
|
750 |
const char *id); |
|
Evan@653
|
751 |
|
|
Evan@653
|
752 |
/** |
|
Evan@653
|
753 |
* Compares two statuses for availability. |
|
Evan@653
|
754 |
* |
|
Evan@653
|
755 |
* @param status1 The first status. |
|
Evan@653
|
756 |
* @param status2 The second status. |
|
Evan@653
|
757 |
* |
|
Evan@653
|
758 |
* @return -1 if @a status1 is more available than @a status2. |
|
Evan@653
|
759 |
* 0 if @a status1 is equal to @a status2. |
|
Evan@653
|
760 |
* 1 if @a status2 is more available than @a status1. |
|
Evan@653
|
761 |
*/ |
|
Evan@653
|
762 |
gint purple_status_compare(const PurpleStatus *status1, const PurpleStatus *status2); |
|
Evan@653
|
763 |
|
|
Evan@653
|
764 |
/*@}*/ |
|
Evan@653
|
765 |
|
|
Evan@653
|
766 |
/**************************************************************************/ |
|
Evan@653
|
767 |
/** @name PurplePresence API */ |
|
Evan@653
|
768 |
/**************************************************************************/ |
|
Evan@653
|
769 |
/*@{*/ |
|
Evan@653
|
770 |
|
|
Evan@653
|
771 |
/** |
|
Evan@653
|
772 |
* Creates a new presence. |
|
Evan@653
|
773 |
* |
|
Evan@653
|
774 |
* @param context The presence context. |
|
Evan@653
|
775 |
* |
|
Evan@653
|
776 |
* @return A new presence. |
|
Evan@653
|
777 |
*/ |
|
Evan@653
|
778 |
PurplePresence *purple_presence_new(PurplePresenceContext context); |
|
Evan@653
|
779 |
|
|
Evan@653
|
780 |
/** |
|
Evan@653
|
781 |
* Creates a presence for an account. |
|
Evan@653
|
782 |
* |
|
Evan@653
|
783 |
* @param account The account. |
|
Evan@653
|
784 |
* |
|
Evan@653
|
785 |
* @return The new presence. |
|
Evan@653
|
786 |
*/ |
|
Evan@653
|
787 |
PurplePresence *purple_presence_new_for_account(PurpleAccount *account); |
|
Evan@653
|
788 |
|
|
Evan@653
|
789 |
/** |
|
Evan@653
|
790 |
* Creates a presence for a conversation. |
|
Evan@653
|
791 |
* |
|
Evan@653
|
792 |
* @param conv The conversation. |
|
Evan@653
|
793 |
* |
|
Evan@653
|
794 |
* @return The new presence. |
|
Evan@653
|
795 |
*/ |
|
Evan@653
|
796 |
PurplePresence *purple_presence_new_for_conv(PurpleConversation *conv); |
|
Evan@653
|
797 |
|
|
Evan@653
|
798 |
/** |
|
Evan@653
|
799 |
* Creates a presence for a buddy. |
|
Evan@653
|
800 |
* |
|
Evan@653
|
801 |
* @param buddy The buddy. |
|
Evan@653
|
802 |
* |
|
Evan@653
|
803 |
* @return The new presence. |
|
Evan@653
|
804 |
*/ |
|
Evan@653
|
805 |
PurplePresence *purple_presence_new_for_buddy(PurpleBuddy *buddy); |
|
Evan@653
|
806 |
|
|
Evan@653
|
807 |
/** |
|
Evan@653
|
808 |
* Destroys a presence. |
|
Evan@653
|
809 |
* |
|
Evan@653
|
810 |
* All statuses added to this list will be destroyed along with |
|
Evan@653
|
811 |
* the presence. |
|
Evan@653
|
812 |
* |
|
Evan@653
|
813 |
* @param presence The presence to destroy. |
|
Evan@653
|
814 |
*/ |
|
Evan@653
|
815 |
void purple_presence_destroy(PurplePresence *presence); |
|
Evan@653
|
816 |
|
|
Evan@1427
|
817 |
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) |
|
Evan@653
|
818 |
/** |
|
Evan@653
|
819 |
* Adds a status to a presence. |
|
Evan@653
|
820 |
* |
|
Evan@653
|
821 |
* @param presence The presence. |
|
Evan@653
|
822 |
* @param status The status to add. |
|
Evan@1427
|
823 |
* |
|
Evan@1427
|
824 |
* @deprecated This function is only used by purple_presence_add_list, |
|
Evan@1427
|
825 |
* and both should be removed in 3.0.0. |
|
Evan@653
|
826 |
*/ |
|
Evan@653
|
827 |
void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status); |
|
Evan@1427
|
828 |
#endif |
|
Evan@653
|
829 |
|
|
Evan@1427
|
830 |
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) |
|
Evan@653
|
831 |
/** |
|
Evan@653
|
832 |
* Adds a list of statuses to the presence. |
|
Evan@653
|
833 |
* |
|
Evan@653
|
834 |
* @param presence The presence. |
|
Evan@653
|
835 |
* @param source_list The source list of statuses to add, which is not |
|
Evan@653
|
836 |
* modified or freed by this function. |
|
Evan@1427
|
837 |
* |
|
Evan@1427
|
838 |
* @deprecated This function isn't used and should be removed in 3.0.0. |
|
Evan@653
|
839 |
*/ |
|
Evan@653
|
840 |
void purple_presence_add_list(PurplePresence *presence, GList *source_list); |
|
Evan@1427
|
841 |
#endif |
|
Evan@653
|
842 |
|
|
Evan@653
|
843 |
/** |
|
Evan@653
|
844 |
* Sets the active state of a status in a presence. |
|
Evan@653
|
845 |
* |
|
Evan@653
|
846 |
* Only independent statuses can be set unactive. Normal statuses can only |
|
Evan@653
|
847 |
* be set active, so if you wish to disable a status, set another |
|
Evan@653
|
848 |
* non-independent status to active, or use purple_presence_switch_status(). |
|
Evan@653
|
849 |
* |
|
Evan@653
|
850 |
* @param presence The presence. |
|
Evan@653
|
851 |
* @param status_id The ID of the status. |
|
Evan@653
|
852 |
* @param active The active state. |
|
Evan@653
|
853 |
*/ |
|
Evan@653
|
854 |
void purple_presence_set_status_active(PurplePresence *presence, |
|
Evan@653
|
855 |
const char *status_id, gboolean active); |
|
Evan@653
|
856 |
|
|
Evan@653
|
857 |
/** |
|
Evan@653
|
858 |
* Switches the active status in a presence. |
|
Evan@653
|
859 |
* |
|
Evan@653
|
860 |
* This is similar to purple_presence_set_status_active(), except it won't |
|
Evan@653
|
861 |
* activate independent statuses. |
|
Evan@653
|
862 |
* |
|
Evan@653
|
863 |
* @param presence The presence. |
|
Evan@653
|
864 |
* @param status_id The status ID to switch to. |
|
Evan@653
|
865 |
*/ |
|
Evan@653
|
866 |
void purple_presence_switch_status(PurplePresence *presence, |
|
Evan@653
|
867 |
const char *status_id); |
|
Evan@653
|
868 |
|
|
Evan@653
|
869 |
/** |
|
Evan@653
|
870 |
* Sets the idle state and time on a presence. |
|
Evan@653
|
871 |
* |
|
Evan@653
|
872 |
* @param presence The presence. |
|
Evan@653
|
873 |
* @param idle The idle state. |
|
Evan@653
|
874 |
* @param idle_time The idle time, if @a idle is TRUE. This |
|
Evan@653
|
875 |
* is the time at which the user became idle, |
|
Evan@653
|
876 |
* in seconds since the epoch. If this value is |
|
Evan@653
|
877 |
* unknown then 0 should be used. |
|
Evan@653
|
878 |
*/ |
|
Evan@653
|
879 |
void purple_presence_set_idle(PurplePresence *presence, gboolean idle, |
|
Evan@653
|
880 |
time_t idle_time); |
|
Evan@653
|
881 |
|
|
Evan@653
|
882 |
/** |
|
Evan@653
|
883 |
* Sets the login time on a presence. |
|
Evan@653
|
884 |
* |
|
Evan@653
|
885 |
* @param presence The presence. |
|
Evan@653
|
886 |
* @param login_time The login time. |
|
Evan@653
|
887 |
*/ |
|
Evan@653
|
888 |
void purple_presence_set_login_time(PurplePresence *presence, time_t login_time); |
|
Evan@653
|
889 |
|
|
Evan@653
|
890 |
|
|
Evan@653
|
891 |
/** |
|
Evan@653
|
892 |
* Returns the presence's context. |
|
Evan@653
|
893 |
* |
|
Evan@653
|
894 |
* @param presence The presence. |
|
Evan@653
|
895 |
* |
|
Evan@653
|
896 |
* @return The presence's context. |
|
Evan@653
|
897 |
*/ |
|
Evan@653
|
898 |
PurplePresenceContext purple_presence_get_context(const PurplePresence *presence); |
|
Evan@653
|
899 |
|
|
Evan@653
|
900 |
/** |
|
Evan@653
|
901 |
* Returns a presence's account. |
|
Evan@653
|
902 |
* |
|
Evan@653
|
903 |
* @param presence The presence. |
|
Evan@653
|
904 |
* |
|
Evan@653
|
905 |
* @return The presence's account. |
|
Evan@653
|
906 |
*/ |
|
Evan@653
|
907 |
PurpleAccount *purple_presence_get_account(const PurplePresence *presence); |
|
Evan@653
|
908 |
|
|
Evan@653
|
909 |
/** |
|
Evan@653
|
910 |
* Returns a presence's conversation. |
|
Evan@653
|
911 |
* |
|
Evan@653
|
912 |
* @param presence The presence. |
|
Evan@653
|
913 |
* |
|
Evan@653
|
914 |
* @return The presence's conversation. |
|
Evan@653
|
915 |
*/ |
|
Evan@653
|
916 |
PurpleConversation *purple_presence_get_conversation(const PurplePresence *presence); |
|
Evan@653
|
917 |
|
|
Evan@653
|
918 |
/** |
|
Evan@653
|
919 |
* Returns a presence's chat user. |
|
Evan@653
|
920 |
* |
|
Evan@653
|
921 |
* @param presence The presence. |
|
Evan@653
|
922 |
* |
|
Evan@653
|
923 |
* @return The chat's user. |
|
Evan@653
|
924 |
*/ |
|
Evan@653
|
925 |
const char *purple_presence_get_chat_user(const PurplePresence *presence); |
|
Evan@653
|
926 |
|
|
Evan@653
|
927 |
/** |
|
Evan@653
|
928 |
* Returns the presence's buddy. |
|
Evan@653
|
929 |
* |
|
Evan@653
|
930 |
* @param presence The presence. |
|
Evan@653
|
931 |
* |
|
Evan@653
|
932 |
* @return The presence's buddy. |
|
Evan@653
|
933 |
*/ |
|
Evan@653
|
934 |
PurpleBuddy *purple_presence_get_buddy(const PurplePresence *presence); |
|
Evan@653
|
935 |
|
|
Evan@653
|
936 |
/** |
|
Evan@653
|
937 |
* Returns all the statuses in a presence. |
|
Evan@653
|
938 |
* |
|
Evan@653
|
939 |
* @param presence The presence. |
|
Evan@653
|
940 |
* |
|
Evan@653
|
941 |
* @constreturn The statuses. |
|
Evan@653
|
942 |
*/ |
|
Evan@653
|
943 |
GList *purple_presence_get_statuses(const PurplePresence *presence); |
|
Evan@653
|
944 |
|
|
Evan@653
|
945 |
/** |
|
Evan@653
|
946 |
* Returns the status with the specified ID from a presence. |
|
Evan@653
|
947 |
* |
|
Evan@653
|
948 |
* @param presence The presence. |
|
Evan@653
|
949 |
* @param status_id The ID of the status. |
|
Evan@653
|
950 |
* |
|
Evan@653
|
951 |
* @return The status if found, or NULL. |
|
Evan@653
|
952 |
*/ |
|
Evan@653
|
953 |
PurpleStatus *purple_presence_get_status(const PurplePresence *presence, |
|
Evan@653
|
954 |
const char *status_id); |
|
Evan@653
|
955 |
|
|
Evan@653
|
956 |
/** |
|
Evan@653
|
957 |
* Returns the active exclusive status from a presence. |
|
Evan@653
|
958 |
* |
|
Evan@653
|
959 |
* @param presence The presence. |
|
Evan@653
|
960 |
* |
|
Evan@653
|
961 |
* @return The active exclusive status. |
|
Evan@653
|
962 |
*/ |
|
Evan@653
|
963 |
PurpleStatus *purple_presence_get_active_status(const PurplePresence *presence); |
|
Evan@653
|
964 |
|
|
Evan@653
|
965 |
/** |
|
Evan@653
|
966 |
* Returns whether or not a presence is available. |
|
Evan@653
|
967 |
* |
|
Evan@653
|
968 |
* Available presences are online and possibly invisible, but not away or idle. |
|
Evan@653
|
969 |
* |
|
Evan@653
|
970 |
* @param presence The presence. |
|
Evan@653
|
971 |
* |
|
Evan@653
|
972 |
* @return TRUE if the presence is available, or FALSE otherwise. |
|
Evan@653
|
973 |
*/ |
|
Evan@653
|
974 |
gboolean purple_presence_is_available(const PurplePresence *presence); |
|
Evan@653
|
975 |
|
|
Evan@653
|
976 |
/** |
|
Evan@653
|
977 |
* Returns whether or not a presence is online. |
|
Evan@653
|
978 |
* |
|
Evan@653
|
979 |
* @param presence The presence. |
|
Evan@653
|
980 |
* |
|
Evan@653
|
981 |
* @return TRUE if the presence is online, or FALSE otherwise. |
|
Evan@653
|
982 |
*/ |
|
Evan@653
|
983 |
gboolean purple_presence_is_online(const PurplePresence *presence); |
|
Evan@653
|
984 |
|
|
Evan@653
|
985 |
/** |
|
Evan@653
|
986 |
* Returns whether or not a status in a presence is active. |
|
Evan@653
|
987 |
* |
|
Evan@653
|
988 |
* A status is active if itself or any of its sub-statuses are active. |
|
Evan@653
|
989 |
* |
|
Evan@653
|
990 |
* @param presence The presence. |
|
Evan@653
|
991 |
* @param status_id The ID of the status. |
|
Evan@653
|
992 |
* |
|
Evan@653
|
993 |
* @return TRUE if the status is active, or FALSE. |
|
Evan@653
|
994 |
*/ |
|
Evan@653
|
995 |
gboolean purple_presence_is_status_active(const PurplePresence *presence, |
|
Evan@653
|
996 |
const char *status_id); |
|
Evan@653
|
997 |
|
|
Evan@653
|
998 |
/** |
|
Evan@653
|
999 |
* Returns whether or not a status with the specified primitive type |
|
Evan@653
|
1000 |
* in a presence is active. |
|
Evan@653
|
1001 |
* |
|
Evan@653
|
1002 |
* A status is active if itself or any of its sub-statuses are active. |
|
Evan@653
|
1003 |
* |
|
Evan@653
|
1004 |
* @param presence The presence. |
|
Evan@653
|
1005 |
* @param primitive The status primitive. |
|
Evan@653
|
1006 |
* |
|
Evan@653
|
1007 |
* @return TRUE if the status is active, or FALSE. |
|
Evan@653
|
1008 |
*/ |
|
Evan@653
|
1009 |
gboolean purple_presence_is_status_primitive_active( |
|
Evan@653
|
1010 |
const PurplePresence *presence, PurpleStatusPrimitive primitive); |
|
Evan@653
|
1011 |
|
|
Evan@653
|
1012 |
/** |
|
Evan@653
|
1013 |
* Returns whether or not a presence is idle. |
|
Evan@653
|
1014 |
* |
|
Evan@653
|
1015 |
* @param presence The presence. |
|
Evan@653
|
1016 |
* |
|
Evan@653
|
1017 |
* @return TRUE if the presence is idle, or FALSE otherwise. |
|
Evan@653
|
1018 |
* If the presence is offline (purple_presence_is_online() |
|
Evan@653
|
1019 |
* returns FALSE) then FALSE is returned. |
|
Evan@653
|
1020 |
*/ |
|
Evan@653
|
1021 |
gboolean purple_presence_is_idle(const PurplePresence *presence); |
|
Evan@653
|
1022 |
|
|
Evan@653
|
1023 |
/** |
|
Evan@653
|
1024 |
* Returns the presence's idle time. |
|
Evan@653
|
1025 |
* |
|
Evan@653
|
1026 |
* @param presence The presence. |
|
Evan@653
|
1027 |
* |
|
Evan@653
|
1028 |
* @return The presence's idle time. |
|
Evan@653
|
1029 |
*/ |
|
Evan@653
|
1030 |
time_t purple_presence_get_idle_time(const PurplePresence *presence); |
|
Evan@653
|
1031 |
|
|
Evan@653
|
1032 |
/** |
|
Evan@653
|
1033 |
* Returns the presence's login time. |
|
Evan@653
|
1034 |
* |
|
Evan@653
|
1035 |
* @param presence The presence. |
|
Evan@653
|
1036 |
* |
|
Evan@653
|
1037 |
* @return The presence's login time. |
|
Evan@653
|
1038 |
*/ |
|
Evan@653
|
1039 |
time_t purple_presence_get_login_time(const PurplePresence *presence); |
|
Evan@653
|
1040 |
|
|
Evan@653
|
1041 |
/** |
|
Evan@653
|
1042 |
* Compares two presences for availability. |
|
Evan@653
|
1043 |
* |
|
Evan@653
|
1044 |
* @param presence1 The first presence. |
|
Evan@653
|
1045 |
* @param presence2 The second presence. |
|
Evan@653
|
1046 |
* |
|
Evan@653
|
1047 |
* @return -1 if @a presence1 is more available than @a presence2. |
|
Evan@653
|
1048 |
* 0 if @a presence1 is equal to @a presence2. |
|
Evan@653
|
1049 |
* 1 if @a presence1 is less available than @a presence2. |
|
Evan@653
|
1050 |
*/ |
|
Evan@653
|
1051 |
gint purple_presence_compare(const PurplePresence *presence1, |
|
Evan@653
|
1052 |
const PurplePresence *presence2); |
|
Evan@653
|
1053 |
|
|
Evan@653
|
1054 |
/*@}*/ |
|
Evan@653
|
1055 |
|
|
Evan@653
|
1056 |
/**************************************************************************/ |
|
Evan@653
|
1057 |
/** @name Status subsystem */ |
|
Evan@653
|
1058 |
/**************************************************************************/ |
|
Evan@653
|
1059 |
/*@{*/ |
|
Evan@653
|
1060 |
|
|
Evan@653
|
1061 |
/** |
|
Evan@653
|
1062 |
* Get the handle for the status subsystem. |
|
Evan@653
|
1063 |
* |
|
Evan@653
|
1064 |
* @return the handle to the status subsystem |
|
Evan@653
|
1065 |
*/ |
|
Evan@653
|
1066 |
void *purple_status_get_handle(void); |
|
Evan@653
|
1067 |
|
|
Evan@653
|
1068 |
/** |
|
Evan@653
|
1069 |
* Initializes the status subsystem. |
|
Evan@653
|
1070 |
*/ |
|
Evan@653
|
1071 |
void purple_status_init(void); |
|
Evan@653
|
1072 |
|
|
Evan@653
|
1073 |
/** |
|
Evan@653
|
1074 |
* Uninitializes the status subsystem. |
|
Evan@653
|
1075 |
*/ |
|
Evan@653
|
1076 |
void purple_status_uninit(void); |
|
Evan@653
|
1077 |
|
|
Evan@653
|
1078 |
/*@}*/ |
|
Evan@653
|
1079 |
|
|
Evan@653
|
1080 |
#ifdef __cplusplus |
|
Evan@653
|
1081 |
} |
|
Evan@653
|
1082 |
#endif |
|
Evan@653
|
1083 |
|
|
Evan@653
|
1084 |
#endif /* _PURPLE_STATUS_H_ */ |