Mercurial > pidgin
annotate src/blist.h @ 6713:6c871a20d9eb
[gaim-migrate @ 7239]
Tcl had better work now ... next I'll start figuring out how Tk might
be bustinated.
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Tue, 02 Sep 2003 23:34:08 +0000 |
parents | 0c5637b5462e |
children | 41120df7ed94 |
rev | line source |
---|---|
5228 | 1 /** |
5497 | 2 * @file blist.h Buddy List API |
5228 | 3 * @ingroup core |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2003, Sean Egan <sean.egan@binghamton.edu> | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
8 * |
5228 | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 | |
24 /* I can't believe I let ChipX86 inspire me to write good code. -Sean */ | |
25 | |
6695 | 26 #ifndef _BLIST_H_ |
27 #define _BLIST_H_ | |
5228 | 28 |
29 #include <glib.h> | |
30 | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
31 typedef struct _GaimBlistNode GaimBlistNode; |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
32 |
6695 | 33 typedef struct _GaimBlistChat GaimBlistChat; |
34 typedef struct _GaimGroup GaimGroup; | |
35 typedef struct _GaimContact GaimContact; | |
36 typedef struct _GaimBuddy GaimBuddy; | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
37 |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
38 #include "account.h" |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
39 |
5228 | 40 /**************************************************************************/ |
41 /* Enumerations */ | |
42 /**************************************************************************/ | |
43 enum gaim_blist_node_type { | |
44 GAIM_BLIST_GROUP_NODE, | |
6695 | 45 GAIM_BLIST_CONTACT_NODE, |
5228 | 46 GAIM_BLIST_BUDDY_NODE, |
5234 | 47 GAIM_BLIST_CHAT_NODE, |
6063 | 48 GAIM_BLIST_OTHER_NODE |
5228 | 49 }; |
50 | |
5234 | 51 #define GAIM_BLIST_NODE_IS_CHAT(n) ((n)->type == GAIM_BLIST_CHAT_NODE) |
5228 | 52 #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE) |
6695 | 53 #define GAIM_BLIST_NODE_IS_CONTACT(n) ((n)->type == GAIM_BLIST_CONTACT_NODE) |
5228 | 54 #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE) |
55 | |
56 enum gaim_buddy_presence_state { | |
57 GAIM_BUDDY_SIGNING_OFF = -1, | |
58 GAIM_BUDDY_OFFLINE = 0, | |
59 GAIM_BUDDY_ONLINE, | |
6063 | 60 GAIM_BUDDY_SIGNING_ON |
5228 | 61 }; |
62 | |
6695 | 63 #define GAIM_BUDDY_IS_ONLINE(b) ((b)->account->gc && \ |
64 ((b)->present == GAIM_BUDDY_ONLINE || \ | |
65 (b)->present == GAIM_BUDDY_SIGNING_ON)) | |
5228 | 66 |
67 | |
68 /**************************************************************************/ | |
69 /* Data Structures */ | |
70 /**************************************************************************/ | |
71 | |
72 /** | |
73 * A Buddy list node. This can represent a group, a buddy, or anything else. This is a base class for struct buddy and | |
74 * struct group and for anything else that wants to put itself in the buddy list. */ | |
75 struct _GaimBlistNode { | |
76 enum gaim_blist_node_type type; /**< The type of node this is */ | |
77 GaimBlistNode *prev; /**< The sibling before this buddy. */ | |
78 GaimBlistNode *next; /**< The sibling after this buddy. */ | |
79 GaimBlistNode *parent; /**< The parent of this node */ | |
80 GaimBlistNode *child; /**< The child of this node */ | |
81 void *ui_data; /**< The UI can put data here. */ | |
82 }; | |
83 | |
84 /** | |
85 * A buddy. This contains everything Gaim will ever need to know about someone on the buddy list. Everything. | |
86 */ | |
6695 | 87 struct _GaimBuddy { |
5228 | 88 GaimBlistNode node; /**< The node that this buddy inherits from */ |
89 char *name; /**< The screenname of the buddy. */ | |
90 char *alias; /**< The user-set alias of the buddy */ | |
6695 | 91 char *server_alias; /**< The server-specified alias of the buddy. (i.e. MSN "Friendly Names") */ |
5228 | 92 enum gaim_buddy_presence_state present; /**< This is 0 if the buddy appears offline, 1 if he appears online, and 2 if |
93 he has recently signed on */ | |
94 int evil; /**< The warning level */ | |
95 time_t signon; /**< The time the buddy signed on. */ | |
96 int idle; /**< The time the buddy has been idle in minutes. */ | |
97 int uc; /**< This is a cryptic bitmask that makes sense only to the prpl. This will get changed */ | |
98 void *proto_data; /**< This allows the prpl to associate whatever data it wants with a buddy */ | |
6695 | 99 GaimAccount *account; /**< the account this buddy belongs to */ |
5228 | 100 GHashTable *settings; /**< per-buddy settings from the XML buddy list, set by plugins and the likes. */ |
101 guint timer; /**< The timer handle. */ | |
102 }; | |
103 | |
104 /** | |
6695 | 105 * A contact. This contains everything Gaim will ever need to know about a contact. |
106 */ | |
107 struct _GaimContact { | |
108 GaimBlistNode node; /**< The node that this contact inherits from. */ | |
109 int totalsize; /**< The number of buddies in this contact */ | |
110 int currentsize; /**< The number of buddies in this contact corresponding to online accounts */ | |
111 int online; /**< The number of buddies in this contact who are currently online */ | |
112 }; | |
113 | |
114 | |
115 /** | |
5228 | 116 * A group. This contains everything Gaim will ever need to know about a group. |
117 */ | |
6695 | 118 struct _GaimGroup { |
5228 | 119 GaimBlistNode node; /**< The node that this group inherits from */ |
120 char *name; /**< The name of this group. */ | |
6695 | 121 int totalsize; /**< The number of chats and contacts in this group */ |
122 int currentsize; /**< The number of chats and contacts in this group corresponding to online accounts */ | |
123 int online; /**< The number of chats and contacts in this group who are currently online */ | |
5228 | 124 GHashTable *settings; /**< per-group settings from the XML buddy list, set by plugins and the likes. */ |
125 }; | |
126 | |
5234 | 127 /** |
6695 | 128 * A chat. This contains everything Gaim needs to put a chat room in the |
5234 | 129 * buddy list. |
130 */ | |
6695 | 131 struct _GaimBlistChat { |
5234 | 132 GaimBlistNode node; /**< The node that this chat inherits from */ |
133 char *alias; /**< The display name of this chat. */ | |
134 GHashTable *components; /**< the stuff the protocol needs to know to join the chat */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
135 GaimAccount *account; /**< The account this chat is attached to */ |
5906 | 136 GHashTable *settings; /**< per-chat settings from the XML buddy list, set by plugins and the likes. */ |
5234 | 137 }; |
138 | |
5228 | 139 |
140 /** | |
141 * The Buddy List | |
142 */ | |
143 struct gaim_buddy_list { | |
144 GaimBlistNode *root; /**< The first node in the buddy list */ | |
5247 | 145 GHashTable *buddies; /**< Every buddy in this list */ |
5228 | 146 struct gaim_blist_ui_ops *ui_ops; /**< The UI operations for the buddy list */ |
147 | |
148 void *ui_data; /**< UI-specific data. */ | |
149 }; | |
150 | |
151 /** | |
152 * Buddy list UI operations. | |
153 * | |
154 * Any UI representing a buddy list must assign a filled-out gaim_window_ops | |
155 * structure to the buddy list core. | |
156 */ | |
157 struct gaim_blist_ui_ops | |
158 { | |
159 void (*new_list)(struct gaim_buddy_list *list); /**< Sets UI-specific data on a buddy list. */ | |
160 void (*new_node)(GaimBlistNode *node); /**< Sets UI-specific data on a node. */ | |
161 void (*show)(struct gaim_buddy_list *list); /**< The core will call this when its finished doing it's core stuff */ | |
6695 | 162 void (*update)(struct gaim_buddy_list *list, |
5228 | 163 GaimBlistNode *node); /**< This will update a node in the buddy list. */ |
164 void (*remove)(struct gaim_buddy_list *list, | |
165 GaimBlistNode *node); /**< This removes a node from the list */ | |
166 void (*destroy)(struct gaim_buddy_list *list); /**< When the list gets destroyed, this gets called to destroy the UI. */ | |
167 void (*set_visible)(struct gaim_buddy_list *list, | |
168 gboolean show); /**< Hides or unhides the buddy list */ | |
169 | |
170 }; | |
171 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
172 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
173 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
174 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
175 |
5228 | 176 /**************************************************************************/ |
177 /** @name Buddy List API */ | |
178 /**************************************************************************/ | |
179 /*@{*/ | |
180 | |
181 /** | |
182 * Creates a new buddy list | |
183 */ | |
184 struct gaim_buddy_list *gaim_blist_new(); | |
185 | |
186 /** | |
187 * Sets the main buddy list. | |
188 * | |
189 * @return The main buddy list. | |
190 */ | |
191 void gaim_set_blist(struct gaim_buddy_list *blist); | |
192 | |
193 /** | |
194 * Returns the main buddy list. | |
195 * | |
196 * @return The main buddy list. | |
197 */ | |
198 struct gaim_buddy_list *gaim_get_blist(void); | |
199 | |
200 /** | |
201 * Shows the buddy list, creating a new one if necessary. | |
202 * | |
203 */ | |
204 void gaim_blist_show(); | |
205 | |
206 | |
207 /** | |
208 * Destroys the buddy list window. | |
209 */ | |
210 void gaim_blist_destroy(); | |
211 | |
212 /** | |
213 * Hides or unhides the buddy list. | |
214 * | |
215 * @param show Whether or not to show the buddy list | |
216 */ | |
217 void gaim_blist_set_visible(gboolean show); | |
218 | |
219 /** | |
220 * Updates a buddy's status. | |
5234 | 221 * |
5228 | 222 * This needs to not take an int. |
223 * | |
224 * @param buddy The buddy whose status has changed | |
225 * @param status The new status in cryptic prpl-understood code | |
226 */ | |
6695 | 227 void gaim_blist_update_buddy_status(GaimBuddy *buddy, int status); |
5228 | 228 |
229 | |
230 /** | |
231 * Updates a buddy's presence. | |
232 * | |
233 * @param buddy The buddy whose presence has changed | |
234 * @param presence The new presence | |
235 */ | |
6695 | 236 void gaim_blist_update_buddy_presence(GaimBuddy *buddy, int presence); |
5228 | 237 |
238 | |
239 /** | |
240 * Updates a buddy's idle time. | |
241 * | |
242 * @param buddy The buddy whose idle time has changed | |
243 * @param idle The buddy's idle time in minutes. | |
244 */ | |
6695 | 245 void gaim_blist_update_buddy_idle(GaimBuddy *buddy, int idle); |
5228 | 246 |
247 | |
248 /** | |
249 * Updates a buddy's warning level. | |
250 * | |
251 * @param buddy The buddy whose warning level has changed | |
252 * @param evil The warning level as an int from 0 to 100 (or higher, I guess... but that'd be weird) | |
253 */ | |
6695 | 254 void gaim_blist_update_buddy_evil(GaimBuddy *buddy, int warning); |
5228 | 255 |
256 /** | |
257 * Updates a buddy's icon. | |
258 * | |
259 * @param buddy The buddy whose buddy icon has changed | |
260 */ | |
6695 | 261 void gaim_blist_update_buddy_icon(GaimBuddy *buddy); |
5228 | 262 |
263 | |
264 | |
265 /** | |
266 * Renames a buddy in the buddy list. | |
267 * | |
268 * @param buddy The buddy whose name will be changed. | |
269 * @param name The new name of the buddy. | |
270 */ | |
6695 | 271 void gaim_blist_rename_buddy(GaimBuddy *buddy, const char *name); |
5228 | 272 |
273 | |
274 /** | |
275 * Aliases a buddy in the buddy list. | |
276 * | |
277 * @param buddy The buddy whose alias will be changed. | |
278 * @param alias The buddy's alias. | |
279 */ | |
6695 | 280 void gaim_blist_alias_buddy(GaimBuddy *buddy, const char *alias); |
5228 | 281 |
5234 | 282 /** |
6059 | 283 * Sets the server-sent alias of a buddy in the buddy list. |
6058 | 284 * |
285 * @param buddy The buddy whose alias will be changed. | |
286 * @param alias The buddy's "official" alias. | |
287 */ | |
6695 | 288 void gaim_blist_server_alias_buddy(GaimBuddy *buddy, const char *alias); |
6058 | 289 |
290 /** | |
5234 | 291 * Aliases a chat in the buddy list. |
292 * | |
293 * @param chat The chat whose alias will be changed. | |
294 * @param alias The chat's new alias. | |
295 */ | |
6695 | 296 void gaim_blist_alias_chat(GaimBlistChat *chat, const char *alias); |
5228 | 297 |
298 /** | |
299 * Renames a group | |
300 * | |
301 * @param group The group to rename | |
302 * @param name The new name | |
303 */ | |
6695 | 304 void gaim_blist_rename_group(GaimGroup *group, const char *name); |
5228 | 305 |
5234 | 306 /** |
307 * Creates a new chat for the buddy list | |
308 * | |
309 * @param account The account this chat will get added to | |
310 * @param alias The alias of the new chat | |
311 * @param components The info the prpl needs to join the chat | |
312 * @return A newly allocated chat | |
313 */ | |
6695 | 314 GaimBlistChat *gaim_blist_chat_new(GaimAccount *account, const char *alias, GHashTable *components); |
5234 | 315 |
316 /** | |
6034 | 317 * Gets the alias of the chat, or the chat name if the alias does not exist |
318 * | |
319 * @param chat The chat | |
320 * @return The display name of the chat | |
321 */ | |
6695 | 322 char *gaim_blist_chat_get_display_name(GaimBlistChat *chat); |
6034 | 323 |
324 /** | |
5234 | 325 * Adds a new chat to the buddy list. |
326 * | |
327 * The chat will be inserted right after node or appended to the end | |
328 * of group if node is NULL. If both are NULL, the buddy will be added to | |
329 * the "Chats" group. | |
330 * | |
331 * @param chat The new chat who gets added | |
332 * @param group The group to add the new chat to. | |
333 * @param node The insertion point | |
334 */ | |
6695 | 335 void gaim_blist_add_chat(GaimBlistChat *chat, GaimGroup *group, GaimBlistNode *node); |
5228 | 336 |
337 /** | |
338 * Creates a new buddy | |
339 * | |
340 * @param account The account this buddy will get added to | |
341 * @param screenname The screenname of the new buddy | |
342 * @param alias The alias of the new buddy (or NULL if unaliased) | |
343 * @return A newly allocated buddy | |
344 */ | |
6695 | 345 GaimBuddy *gaim_buddy_new(GaimAccount *account, const char *screenname, const char *alias); |
5228 | 346 |
347 /** | |
348 * Adds a new buddy to the buddy list. | |
349 * | |
6695 | 350 * The buddy will be inserted right after node or prepended to the |
351 * group if node is NULL. If both are NULL, the buddy will be added to | |
5228 | 352 * the "Buddies" group. |
353 * | |
354 * @param buddy The new buddy who gets added | |
355 * @param group The group to add the new buddy to. | |
6695 | 356 * @param node The insertion point |
5228 | 357 */ |
6695 | 358 void gaim_blist_add_buddy(GaimBuddy *buddy, GaimContact *contact, GaimGroup *group, GaimBlistNode *node); |
5228 | 359 |
360 /** | |
361 * Creates a new group | |
362 * | |
6695 | 363 * You can't have more than one group with the same name. Sorry. If you pass |
364 * this the * name of a group that already exists, it will return that group. | |
5228 | 365 * |
366 * @param name The name of the new group | |
6695 | 367 * @return A new group struct |
5228 | 368 */ |
6695 | 369 GaimGroup *gaim_group_new(const char *name); |
5228 | 370 |
371 /** | |
372 * Adds a new group to the buddy list. | |
373 * | |
6695 | 374 * The new group will be inserted after insert or prepended to the list if |
375 * node is NULL. | |
376 * | |
377 * @param group The group | |
378 * @param node The insertion point | |
379 */ | |
380 void gaim_blist_add_group(GaimGroup *group, GaimBlistNode *node); | |
381 | |
382 /** | |
383 * Creates a new contact | |
5228 | 384 * |
6695 | 385 * @return A new contact struct |
5228 | 386 */ |
6695 | 387 GaimContact *gaim_contact_new(); |
388 | |
389 /** | |
390 * Adds a new contact to the buddy list. | |
391 * | |
392 * The new contact will be inserted after insert or prepended to the list if | |
393 * node is NULL. | |
394 * | |
395 * @param contact The contact | |
396 * @param group The group to add the contact to | |
397 * @param node The insertion point | |
398 */ | |
399 void gaim_blist_add_contact(GaimContact *contact, GaimGroup *group, GaimBlistNode *node); | |
400 | |
401 /** | |
402 * Returns the highest priority buddy for a given contact. | |
403 * | |
404 * @param contact The contact | |
405 * @return The highest priority buddy | |
406 */ | |
407 GaimBuddy *gaim_contact_get_priority_buddy(GaimContact *contact); | |
5228 | 408 |
409 /** | |
410 * Removes a buddy from the buddy list and frees the memory allocated to it. | |
411 * | |
412 * @param buddy The buddy to be removed | |
413 */ | |
6695 | 414 void gaim_blist_remove_buddy(GaimBuddy *buddy); |
415 | |
416 /** | |
417 * Removes a contact, and any buddies it contains, and frees the memory | |
418 * allocated to it. | |
419 * | |
420 * @param contact The contact to be removed | |
421 */ | |
422 void gaim_blist_remove_contact(GaimContact *contact); | |
5228 | 423 |
424 /** | |
5234 | 425 * Removes a chat from the buddy list and frees the memory allocated to it. |
426 * | |
427 * @param chat The chat to be removed | |
428 */ | |
6695 | 429 void gaim_blist_remove_chat(GaimBlistChat *chat); |
5234 | 430 |
431 /** | |
5228 | 432 * Removes a group from the buddy list and frees the memory allocated to it and to |
433 * its children | |
434 * | |
435 * @param group The group to be removed | |
436 */ | |
6695 | 437 void gaim_blist_remove_group(GaimGroup *group); |
5228 | 438 |
439 /** | |
440 * Returns the alias of a buddy. | |
441 * | |
442 * @param buddy The buddy whose name will be returned. | |
443 * @return The alias (if set), server alias (if option is set), or NULL. | |
444 */ | |
6695 | 445 const char *gaim_get_buddy_alias_only(GaimBuddy *buddy); |
5228 | 446 |
447 | |
448 /** | |
449 * Returns the correct name to display for a buddy. | |
450 * | |
451 * @param buddy The buddy whose name will be returned. | |
452 * @return The alias (if set), server alias (if option is set), screenname, or "Unknown" | |
453 */ | |
6695 | 454 const char *gaim_get_buddy_alias(GaimBuddy *buddy); |
5228 | 455 |
456 /** | |
457 * Finds the buddy struct given a screenname and an account | |
458 * | |
5758 | 459 * @param name The buddy's screenname or NULL to search for more buddies with the same screenname |
460 * as the previous search | |
5228 | 461 * @param account The account this buddy belongs to |
462 * @return The buddy or NULL if the buddy does not exist | |
463 */ | |
6695 | 464 GaimBuddy *gaim_find_buddy(GaimAccount *account, const char *name); |
6245 | 465 |
466 /** | |
467 * Finds all buddies struct given a screenname and an account | |
468 * | |
469 * @param name The buddy's screenname | |
470 * @param account The account this buddy belongs to | |
471 * | |
472 * @return A GSList of buddies (which must be freed), or NULL if the buddy doesn't exist | |
473 */ | |
474 GSList *gaim_find_buddies(GaimAccount *account, const char *name); | |
475 | |
5228 | 476 |
477 /** | |
478 * Finds a group by name | |
479 * | |
480 * @param name The groups name | |
481 * @return The group or NULL if the group does not exist | |
482 */ | |
6695 | 483 GaimGroup *gaim_find_group(const char *name); |
484 | |
485 /** | |
486 * Finds a contact | |
487 * | |
488 * @param group The group to look in | |
489 * @param name The name to look for | |
490 * @return The contact or NULL if the contact does not exist | |
491 */ | |
492 GaimContact *gaim_find_contact(GaimGroup *group, const char *name); | |
5228 | 493 |
494 /** | |
6456
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
495 * Finds a chat by name. |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
496 * |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
497 * @param name The chat's name. |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
498 * |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
499 * @return The chat, or @c NULL if the chat does not exist. |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
500 */ |
6695 | 501 GaimBlistChat *gaim_blist_find_chat(GaimAccount *account, const char *name); |
6456
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
502 |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
503 /** |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
504 * Returns the group of which the chat is a member. |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
505 * |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
506 * @param chat The chat. |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
507 * |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
508 * @return The parent group, or @c NULL if the chat is not in a group. |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
509 */ |
6695 | 510 GaimGroup *gaim_blist_chat_get_group(GaimBlistChat *chat); |
6456
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
511 |
ccfdf9f2cdd1
[gaim-migrate @ 6965]
Christian Hammond <chipx86@chipx86.com>
parents:
6245
diff
changeset
|
512 /** |
5228 | 513 * Returns the group of which the buddy is a member. |
514 * | |
515 * @param buddy The buddy | |
516 * @return The group or NULL if the buddy is not in a group | |
517 */ | |
6695 | 518 GaimGroup *gaim_find_buddys_group(GaimBuddy *buddy); |
5228 | 519 |
520 | |
521 /** | |
522 * Returns a list of accounts that have buddies in this group | |
523 * | |
524 * @param group The group | |
525 * @return A list of gaim_accounts | |
526 */ | |
6695 | 527 GSList *gaim_group_get_accounts(GaimGroup *g); |
5228 | 528 |
529 /** | |
530 * Determines whether an account owns any buddies in a given group | |
531 * | |
532 * @param g The group to search through. | |
533 * @param account The account. | |
534 */ | |
6695 | 535 gboolean gaim_group_on_account(GaimGroup *g, GaimAccount *account); |
5228 | 536 |
537 /** | |
5234 | 538 * Called when an account gets signed on. Tells the UI to update all the |
539 * buddies. | |
540 * | |
541 * @param account The account | |
542 */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
543 void gaim_blist_add_account(GaimAccount *account); |
5234 | 544 |
545 | |
546 /** | |
5228 | 547 * Called when an account gets signed off. Sets the presence of all the buddies to 0 |
548 * and tells the UI to update them. | |
549 * | |
6695 | 550 * @param account The account |
5228 | 551 */ |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
552 void gaim_blist_remove_account(GaimAccount *account); |
5228 | 553 |
554 | |
555 /** | |
556 * Determines the total size of a group | |
557 * | |
558 * @param group The group | |
559 * @param offline Count buddies in offline accounts | |
560 * @return The number of buddies in the group | |
561 */ | |
6695 | 562 int gaim_blist_get_group_size(GaimGroup *group, gboolean offline); |
5228 | 563 |
564 /** | |
565 * Determines the number of online buddies in a group | |
566 * | |
567 * @param group The group | |
568 * @return The number of online buddies in the group, or 0 if the group is NULL | |
569 */ | |
6695 | 570 int gaim_blist_get_group_online_count(GaimGroup *group); |
5228 | 571 |
572 /*@}*/ | |
573 | |
574 /****************************************************************************************/ | |
575 /** @name Buddy list file management API */ | |
576 /****************************************************************************************/ | |
577 | |
578 /*@{*/ | |
579 /** | |
580 * Saves the buddy list to file | |
581 */ | |
582 void gaim_blist_save(); | |
583 | |
584 /** | |
585 * Parses the toc-style buddy list used in older versions of Gaim and for SSI in toc.c | |
586 * | |
587 * @param account This is the account that the buddies and groups from config will get added to | |
588 * @param config This is the toc-style buddy list data | |
589 */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
590 void parse_toc_buddy_list(GaimAccount *account, char *config); |
5228 | 591 |
592 | |
593 /** | |
594 * Loads the buddy list from ~/.gaim/blist.xml. | |
595 */ | |
596 void gaim_blist_load(); | |
597 | |
598 /** | |
599 * Associates some data with the group in the xml buddy list | |
600 * | |
601 * @param g The group the data is associated with | |
602 * @param key The key used to retrieve the data | |
603 * @param value The data to set | |
604 */ | |
6695 | 605 void gaim_group_set_setting(GaimGroup *g, const char *key, const char *value); |
5228 | 606 |
607 /** | |
608 * Retrieves data from the XML buddy list set by gaim_group_set_setting()) | |
609 * | |
610 * @param g The group to retrieve data from | |
611 * @param key The key to retrieve the data with | |
612 * @return The associated data or NULL if no data is associated | |
613 */ | |
6695 | 614 char *gaim_group_get_setting(GaimGroup *g, const char *key); |
5228 | 615 |
5906 | 616 /** |
617 * Associates some data with the chat in the xml buddy list | |
618 * | |
619 * @param b The chat the data is associated with | |
620 * @param key The key used to retrieve the data | |
621 * @param value The data to set | |
622 */ | |
6695 | 623 void gaim_blist_chat_set_setting(GaimBlistChat *c, const char *key, const char *value); |
5906 | 624 |
625 /** | |
626 * Retrieves data from the XML buddy list set by gaim_chat_set_setting()) | |
627 * | |
628 * @param b The chat to retrieve data from | |
629 * @param key The key to retrieve the data with | |
630 * @return The associated data or NULL if no data is associated | |
631 */ | |
6695 | 632 char *gaim_blist_chat_get_setting(GaimBlistChat *c, const char *key); |
5228 | 633 |
634 /** | |
635 * Associates some data with the buddy in the xml buddy list | |
636 * | |
637 * @param b The buddy the data is associated with | |
638 * @param key The key used to retrieve the data | |
639 * @param value The data to set | |
640 */ | |
6695 | 641 void gaim_buddy_set_setting(GaimBuddy *b, const char *key, const char *value); |
5228 | 642 |
643 /** | |
644 * Retrieves data from the XML buddy list set by gaim_buddy_set_setting()) | |
645 * | |
646 * @param b The buddy to retrieve data from | |
647 * @param key The key to retrieve the data with | |
648 * @return The associated data or NULL if no data is associated | |
649 */ | |
6695 | 650 char *gaim_buddy_get_setting(GaimBuddy *b, const char *key); |
5228 | 651 |
652 /*@}*/ | |
653 | |
654 /**************************************************************************/ | |
655 /** @name UI Registration Functions */ | |
656 /**************************************************************************/ | |
657 /*@{*/ | |
658 | |
659 /** | |
660 * Sets the UI operations structure to be used for the buddy list. | |
661 * | |
662 * @param ops The ops struct. | |
663 */ | |
664 void gaim_set_blist_ui_ops(struct gaim_blist_ui_ops *ops); | |
665 | |
666 /** | |
667 * Returns the UI operations structure to be used for the buddy list. | |
668 * | |
669 * @return The UI operations structure. | |
670 */ | |
671 struct gaim_blist_ui_ops *gaim_get_blist_ui_ops(void); | |
672 | |
673 /*@}*/ | |
674 | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
675 /**************************************************************************/ |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
676 /** @name Buddy List Subsystem */ |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
677 /**************************************************************************/ |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
678 /*@{*/ |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
679 |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
680 /** |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
681 * Returns the handle for the buddy list subsystem. |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
682 * |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
683 * @return The buddy list subsystem handle. |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
684 */ |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
685 void *gaim_blist_get_handle(void); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
686 |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
687 /** |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
688 * Initializes the buddy list subsystem. |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
689 */ |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
690 void gaim_blist_init(void); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
691 |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
692 /** |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
693 * Uninitializes the buddy list subsystem. |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
694 */ |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
695 void gaim_blist_uninit(void); |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
696 |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
697 /*@}*/ |
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6456
diff
changeset
|
698 |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
699 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
700 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
701 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
702 |
6695 | 703 #endif /* _BLIST_H_ */ |