comparison src/blist.h @ 6695:0c5637b5462e

[gaim-migrate @ 7221] This is contact support. Really. It has a few bugs left in it, like sorting not working, and stuff like that, but it's pretty solid for the most part. I'm not in the mood to do a whole lot of typing, so just use and enjoy. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 02 Sep 2003 03:41:10 +0000
parents 70d5122bc3ff
children 41120df7ed94
comparison
equal deleted inserted replaced
6694:2d2f04c5c7d2 6695:0c5637b5462e
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23 23
24 /* I can't believe I let ChipX86 inspire me to write good code. -Sean */ 24 /* I can't believe I let ChipX86 inspire me to write good code. -Sean */
25 25
26 #ifndef _LIST_H_ 26 #ifndef _BLIST_H_
27 #define _LIST_H_ 27 #define _BLIST_H_
28 28
29 #include <glib.h> 29 #include <glib.h>
30 30
31 typedef struct _GaimBlistNode GaimBlistNode; 31 typedef struct _GaimBlistNode GaimBlistNode;
32 32
33 /* TODO Namespace these! */ 33 typedef struct _GaimBlistChat GaimBlistChat;
34 struct chat; 34 typedef struct _GaimGroup GaimGroup;
35 struct buddy; 35 typedef struct _GaimContact GaimContact;
36 typedef struct _GaimBuddy GaimBuddy;
36 37
37 #include "account.h" 38 #include "account.h"
38 39
39 /**************************************************************************/ 40 /**************************************************************************/
40 /* Enumerations */ 41 /* Enumerations */
41 /**************************************************************************/ 42 /**************************************************************************/
42 enum gaim_blist_node_type { 43 enum gaim_blist_node_type {
43 GAIM_BLIST_GROUP_NODE, 44 GAIM_BLIST_GROUP_NODE,
45 GAIM_BLIST_CONTACT_NODE,
44 GAIM_BLIST_BUDDY_NODE, 46 GAIM_BLIST_BUDDY_NODE,
45 GAIM_BLIST_CHAT_NODE, 47 GAIM_BLIST_CHAT_NODE,
46 GAIM_BLIST_OTHER_NODE 48 GAIM_BLIST_OTHER_NODE
47 }; 49 };
48 50
49 #define GAIM_BLIST_NODE_IS_CHAT(n) ((n)->type == GAIM_BLIST_CHAT_NODE) 51 #define GAIM_BLIST_NODE_IS_CHAT(n) ((n)->type == GAIM_BLIST_CHAT_NODE)
50 #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE) 52 #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE)
53 #define GAIM_BLIST_NODE_IS_CONTACT(n) ((n)->type == GAIM_BLIST_CONTACT_NODE)
51 #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE) 54 #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE)
52 55
53 enum gaim_buddy_presence_state { 56 enum gaim_buddy_presence_state {
54 GAIM_BUDDY_SIGNING_OFF = -1, 57 GAIM_BUDDY_SIGNING_OFF = -1,
55 GAIM_BUDDY_OFFLINE = 0, 58 GAIM_BUDDY_OFFLINE = 0,
56 GAIM_BUDDY_ONLINE, 59 GAIM_BUDDY_ONLINE,
57 GAIM_BUDDY_SIGNING_ON 60 GAIM_BUDDY_SIGNING_ON
58 }; 61 };
59 62
60 #define GAIM_BUDDY_IS_ONLINE(b) ((b)->present == GAIM_BUDDY_ONLINE || \ 63 #define GAIM_BUDDY_IS_ONLINE(b) ((b)->account->gc && \
61 (b)->present == GAIM_BUDDY_SIGNING_ON) 64 ((b)->present == GAIM_BUDDY_ONLINE || \
65 (b)->present == GAIM_BUDDY_SIGNING_ON))
62 66
63 67
64 /**************************************************************************/ 68 /**************************************************************************/
65 /* Data Structures */ 69 /* Data Structures */
66 /**************************************************************************/ 70 /**************************************************************************/
78 }; 82 };
79 83
80 /** 84 /**
81 * A buddy. This contains everything Gaim will ever need to know about someone on the buddy list. Everything. 85 * A buddy. This contains everything Gaim will ever need to know about someone on the buddy list. Everything.
82 */ 86 */
83 struct buddy { 87 struct _GaimBuddy {
84 GaimBlistNode node; /**< The node that this buddy inherits from */ 88 GaimBlistNode node; /**< The node that this buddy inherits from */
85 char *name; /**< The screenname of the buddy. */ 89 char *name; /**< The screenname of the buddy. */
86 char *alias; /**< The user-set alias of the buddy */ 90 char *alias; /**< The user-set alias of the buddy */
87 char *server_alias; /**< The server-specified alias of the buddy. (i.e. MSN "Friendly Names") */ 91 char *server_alias; /**< The server-specified alias of the buddy. (i.e. MSN "Friendly Names") */
88 enum gaim_buddy_presence_state present; /**< This is 0 if the buddy appears offline, 1 if he appears online, and 2 if 92 enum gaim_buddy_presence_state present; /**< This is 0 if the buddy appears offline, 1 if he appears online, and 2 if
89 he has recently signed on */ 93 he has recently signed on */
90 int evil; /**< The warning level */ 94 int evil; /**< The warning level */
91 time_t signon; /**< The time the buddy signed on. */ 95 time_t signon; /**< The time the buddy signed on. */
92 int idle; /**< The time the buddy has been idle in minutes. */ 96 int idle; /**< The time the buddy has been idle in minutes. */
93 int uc; /**< This is a cryptic bitmask that makes sense only to the prpl. This will get changed */ 97 int uc; /**< This is a cryptic bitmask that makes sense only to the prpl. This will get changed */
94 void *proto_data; /**< This allows the prpl to associate whatever data it wants with a buddy */ 98 void *proto_data; /**< This allows the prpl to associate whatever data it wants with a buddy */
95 GaimAccount *account; /**< the account this buddy belongs to */ 99 GaimAccount *account; /**< the account this buddy belongs to */
96 GHashTable *settings; /**< per-buddy settings from the XML buddy list, set by plugins and the likes. */ 100 GHashTable *settings; /**< per-buddy settings from the XML buddy list, set by plugins and the likes. */
97 guint timer; /**< The timer handle. */ 101 guint timer; /**< The timer handle. */
98 }; 102 };
99 103
100 /** 104 /**
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 /**
101 * A group. This contains everything Gaim will ever need to know about a group. 116 * A group. This contains everything Gaim will ever need to know about a group.
102 */ 117 */
103 struct group { 118 struct _GaimGroup {
104 GaimBlistNode node; /**< The node that this group inherits from */ 119 GaimBlistNode node; /**< The node that this group inherits from */
105 char *name; /**< The name of this group. */ 120 char *name; /**< The name of this group. */
106 int totalsize; /**< The number of buddies in this group */ 121 int totalsize; /**< The number of chats and contacts in this group */
107 int currentsize; /**< The number of buddies in this group corresponding to online accounts */ 122 int currentsize; /**< The number of chats and contacts in this group corresponding to online accounts */
108 int online; /**< The number of buddies in this group who are currently online */ 123 int online; /**< The number of chats and contacts in this group who are currently online */
109 GHashTable *settings; /**< per-group settings from the XML buddy list, set by plugins and the likes. */ 124 GHashTable *settings; /**< per-group settings from the XML buddy list, set by plugins and the likes. */
110 }; 125 };
111 126
112 /** 127 /**
113 * A group. This contains everything Gaim needs to put a chat room in the 128 * A chat. This contains everything Gaim needs to put a chat room in the
114 * buddy list. 129 * buddy list.
115 */ 130 */
116 struct chat { 131 struct _GaimBlistChat {
117 GaimBlistNode node; /**< The node that this chat inherits from */ 132 GaimBlistNode node; /**< The node that this chat inherits from */
118 char *alias; /**< The display name of this chat. */ 133 char *alias; /**< The display name of this chat. */
119 GHashTable *components; /**< the stuff the protocol needs to know to join the chat */ 134 GHashTable *components; /**< the stuff the protocol needs to know to join the chat */
120 GaimAccount *account; /**< The account this chat is attached to */ 135 GaimAccount *account; /**< The account this chat is attached to */
121 GHashTable *settings; /**< per-chat settings from the XML buddy list, set by plugins and the likes. */ 136 GHashTable *settings; /**< per-chat settings from the XML buddy list, set by plugins and the likes. */
142 struct gaim_blist_ui_ops 157 struct gaim_blist_ui_ops
143 { 158 {
144 void (*new_list)(struct gaim_buddy_list *list); /**< Sets UI-specific data on a buddy list. */ 159 void (*new_list)(struct gaim_buddy_list *list); /**< Sets UI-specific data on a buddy list. */
145 void (*new_node)(GaimBlistNode *node); /**< Sets UI-specific data on a node. */ 160 void (*new_node)(GaimBlistNode *node); /**< Sets UI-specific data on a node. */
146 void (*show)(struct gaim_buddy_list *list); /**< The core will call this when its finished doing it's core stuff */ 161 void (*show)(struct gaim_buddy_list *list); /**< The core will call this when its finished doing it's core stuff */
147 void (*update)(struct gaim_buddy_list *list, 162 void (*update)(struct gaim_buddy_list *list,
148 GaimBlistNode *node); /**< This will update a node in the buddy list. */ 163 GaimBlistNode *node); /**< This will update a node in the buddy list. */
149 void (*remove)(struct gaim_buddy_list *list, 164 void (*remove)(struct gaim_buddy_list *list,
150 GaimBlistNode *node); /**< This removes a node from the list */ 165 GaimBlistNode *node); /**< This removes a node from the list */
151 void (*destroy)(struct gaim_buddy_list *list); /**< When the list gets destroyed, this gets called to destroy the UI. */ 166 void (*destroy)(struct gaim_buddy_list *list); /**< When the list gets destroyed, this gets called to destroy the UI. */
152 void (*set_visible)(struct gaim_buddy_list *list, 167 void (*set_visible)(struct gaim_buddy_list *list,
207 * This needs to not take an int. 222 * This needs to not take an int.
208 * 223 *
209 * @param buddy The buddy whose status has changed 224 * @param buddy The buddy whose status has changed
210 * @param status The new status in cryptic prpl-understood code 225 * @param status The new status in cryptic prpl-understood code
211 */ 226 */
212 void gaim_blist_update_buddy_status(struct buddy *buddy, int status); 227 void gaim_blist_update_buddy_status(GaimBuddy *buddy, int status);
213 228
214 229
215 /** 230 /**
216 * Updates a buddy's presence. 231 * Updates a buddy's presence.
217 * 232 *
218 * @param buddy The buddy whose presence has changed 233 * @param buddy The buddy whose presence has changed
219 * @param presence The new presence 234 * @param presence The new presence
220 */ 235 */
221 void gaim_blist_update_buddy_presence(struct buddy *buddy, int presence); 236 void gaim_blist_update_buddy_presence(GaimBuddy *buddy, int presence);
222 237
223 238
224 /** 239 /**
225 * Updates a buddy's idle time. 240 * Updates a buddy's idle time.
226 * 241 *
227 * @param buddy The buddy whose idle time has changed 242 * @param buddy The buddy whose idle time has changed
228 * @param idle The buddy's idle time in minutes. 243 * @param idle The buddy's idle time in minutes.
229 */ 244 */
230 void gaim_blist_update_buddy_idle(struct buddy *buddy, int idle); 245 void gaim_blist_update_buddy_idle(GaimBuddy *buddy, int idle);
231 246
232 247
233 /** 248 /**
234 * Updates a buddy's warning level. 249 * Updates a buddy's warning level.
235 * 250 *
236 * @param buddy The buddy whose warning level has changed 251 * @param buddy The buddy whose warning level has changed
237 * @param evil The warning level as an int from 0 to 100 (or higher, I guess... but that'd be weird) 252 * @param evil The warning level as an int from 0 to 100 (or higher, I guess... but that'd be weird)
238 */ 253 */
239 void gaim_blist_update_buddy_evil(struct buddy *buddy, int warning); 254 void gaim_blist_update_buddy_evil(GaimBuddy *buddy, int warning);
240 255
241 /** 256 /**
242 * Updates a buddy's icon. 257 * Updates a buddy's icon.
243 * 258 *
244 * @param buddy The buddy whose buddy icon has changed 259 * @param buddy The buddy whose buddy icon has changed
245 */ 260 */
246 void gaim_blist_update_buddy_icon(struct buddy *buddy); 261 void gaim_blist_update_buddy_icon(GaimBuddy *buddy);
247 262
248 263
249 264
250 /** 265 /**
251 * Renames a buddy in the buddy list. 266 * Renames a buddy in the buddy list.
252 * 267 *
253 * @param buddy The buddy whose name will be changed. 268 * @param buddy The buddy whose name will be changed.
254 * @param name The new name of the buddy. 269 * @param name The new name of the buddy.
255 */ 270 */
256 void gaim_blist_rename_buddy(struct buddy *buddy, const char *name); 271 void gaim_blist_rename_buddy(GaimBuddy *buddy, const char *name);
257 272
258 273
259 /** 274 /**
260 * Aliases a buddy in the buddy list. 275 * Aliases a buddy in the buddy list.
261 * 276 *
262 * @param buddy The buddy whose alias will be changed. 277 * @param buddy The buddy whose alias will be changed.
263 * @param alias The buddy's alias. 278 * @param alias The buddy's alias.
264 */ 279 */
265 void gaim_blist_alias_buddy(struct buddy *buddy, const char *alias); 280 void gaim_blist_alias_buddy(GaimBuddy *buddy, const char *alias);
266 281
267 /** 282 /**
268 * Sets the server-sent alias of a buddy in the buddy list. 283 * Sets the server-sent alias of a buddy in the buddy list.
269 * 284 *
270 * @param buddy The buddy whose alias will be changed. 285 * @param buddy The buddy whose alias will be changed.
271 * @param alias The buddy's "official" alias. 286 * @param alias The buddy's "official" alias.
272 */ 287 */
273 void gaim_blist_server_alias_buddy(struct buddy *buddy, const char *alias); 288 void gaim_blist_server_alias_buddy(GaimBuddy *buddy, const char *alias);
274 289
275 /** 290 /**
276 * Aliases a chat in the buddy list. 291 * Aliases a chat in the buddy list.
277 * 292 *
278 * @param chat The chat whose alias will be changed. 293 * @param chat The chat whose alias will be changed.
279 * @param alias The chat's new alias. 294 * @param alias The chat's new alias.
280 */ 295 */
281 void gaim_blist_alias_chat(struct chat *chat, const char *alias); 296 void gaim_blist_alias_chat(GaimBlistChat *chat, const char *alias);
282 297
283 /** 298 /**
284 * Renames a group 299 * Renames a group
285 * 300 *
286 * @param group The group to rename 301 * @param group The group to rename
287 * @param name The new name 302 * @param name The new name
288 */ 303 */
289 void gaim_blist_rename_group(struct group *group, const char *name); 304 void gaim_blist_rename_group(GaimGroup *group, const char *name);
290 305
291 /** 306 /**
292 * Creates a new chat for the buddy list 307 * Creates a new chat for the buddy list
293 * 308 *
294 * @param account The account this chat will get added to 309 * @param account The account this chat will get added to
295 * @param alias The alias of the new chat 310 * @param alias The alias of the new chat
296 * @param components The info the prpl needs to join the chat 311 * @param components The info the prpl needs to join the chat
297 * @return A newly allocated chat 312 * @return A newly allocated chat
298 */ 313 */
299 struct chat *gaim_chat_new(GaimAccount *account, const char *alias, GHashTable *components); 314 GaimBlistChat *gaim_blist_chat_new(GaimAccount *account, const char *alias, GHashTable *components);
300 315
301 /** 316 /**
302 * Gets the alias of the chat, or the chat name if the alias does not exist 317 * Gets the alias of the chat, or the chat name if the alias does not exist
303 * 318 *
304 * @param chat The chat 319 * @param chat The chat
305 * @return The display name of the chat 320 * @return The display name of the chat
306 */ 321 */
307 char *gaim_chat_get_display_name(struct chat *chat); 322 char *gaim_blist_chat_get_display_name(GaimBlistChat *chat);
308 323
309 /** 324 /**
310 * Adds a new chat to the buddy list. 325 * Adds a new chat to the buddy list.
311 * 326 *
312 * The chat will be inserted right after node or appended to the end 327 * The chat will be inserted right after node or appended to the end
315 * 330 *
316 * @param chat The new chat who gets added 331 * @param chat The new chat who gets added
317 * @param group The group to add the new chat to. 332 * @param group The group to add the new chat to.
318 * @param node The insertion point 333 * @param node The insertion point
319 */ 334 */
320 void gaim_blist_add_chat(struct chat *chat, struct group *group, GaimBlistNode *node); 335 void gaim_blist_add_chat(GaimBlistChat *chat, GaimGroup *group, GaimBlistNode *node);
321 336
322 /** 337 /**
323 * Creates a new buddy 338 * Creates a new buddy
324 * 339 *
325 * @param account The account this buddy will get added to 340 * @param account The account this buddy will get added to
326 * @param screenname The screenname of the new buddy 341 * @param screenname The screenname of the new buddy
327 * @param alias The alias of the new buddy (or NULL if unaliased) 342 * @param alias The alias of the new buddy (or NULL if unaliased)
328 * @return A newly allocated buddy 343 * @return A newly allocated buddy
329 */ 344 */
330 struct buddy *gaim_buddy_new(GaimAccount *account, const char *screenname, const char *alias); 345 GaimBuddy *gaim_buddy_new(GaimAccount *account, const char *screenname, const char *alias);
331 346
332 /** 347 /**
333 * Adds a new buddy to the buddy list. 348 * Adds a new buddy to the buddy list.
334 * 349 *
335 * The buddy will be inserted right after node or appended to the end 350 * The buddy will be inserted right after node or prepended to the
336 * of group if node is NULL. If both are NULL, the buddy will be added to 351 * group if node is NULL. If both are NULL, the buddy will be added to
337 * the "Buddies" group. 352 * the "Buddies" group.
338 * 353 *
339 * @param buddy The new buddy who gets added 354 * @param buddy The new buddy who gets added
340 * @param group The group to add the new buddy to. 355 * @param group The group to add the new buddy to.
341 * @param node The insertion point 356 * @param node The insertion point
342 */ 357 */
343 void gaim_blist_add_buddy(struct buddy *buddy, struct group *group, GaimBlistNode *node); 358 void gaim_blist_add_buddy(GaimBuddy *buddy, GaimContact *contact, GaimGroup *group, GaimBlistNode *node);
344 359
345 /** 360 /**
346 * Creates a new group 361 * Creates a new group
347 * 362 *
348 * You can't have more than one group with the same name. Sorry. If you pass this the 363 * You can't have more than one group with the same name. Sorry. If you pass
349 * name of a group that already exists, it will return that group. 364 * this the * name of a group that already exists, it will return that group.
350 * 365 *
351 * @param name The name of the new group 366 * @param name The name of the new group
352 * @return A new group struct 367 * @return A new group struct
353 */ 368 */
354 struct group *gaim_group_new(const char *name); 369 GaimGroup *gaim_group_new(const char *name);
355 370
356 /** 371 /**
357 * Adds a new group to the buddy list. 372 * Adds a new group to the buddy list.
358 * 373 *
359 * The new group will be inserted after insert or appended to the end of 374 * The new group will be inserted after insert or prepended to the list if
360 * the list if node is NULL. 375 * node is NULL.
361 * 376 *
362 * @param group The group to add the new buddy to. 377 * @param group The group
363 * @param node The insertion point 378 * @param node The insertion point
364 */ 379 */
365 void gaim_blist_add_group(struct group *group, GaimBlistNode *node); 380 void gaim_blist_add_group(GaimGroup *group, GaimBlistNode *node);
381
382 /**
383 * Creates a new contact
384 *
385 * @return A new contact struct
386 */
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);
366 408
367 /** 409 /**
368 * Removes a buddy from the buddy list and frees the memory allocated to it. 410 * Removes a buddy from the buddy list and frees the memory allocated to it.
369 * 411 *
370 * @param buddy The buddy to be removed 412 * @param buddy The buddy to be removed
371 */ 413 */
372 void gaim_blist_remove_buddy(struct buddy *buddy); 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);
373 423
374 /** 424 /**
375 * Removes a chat from the buddy list and frees the memory allocated to it. 425 * Removes a chat from the buddy list and frees the memory allocated to it.
376 * 426 *
377 * @param chat The chat to be removed 427 * @param chat The chat to be removed
378 */ 428 */
379 void gaim_blist_remove_chat(struct chat *chat); 429 void gaim_blist_remove_chat(GaimBlistChat *chat);
380 430
381 /** 431 /**
382 * Removes a group from the buddy list and frees the memory allocated to it and to 432 * Removes a group from the buddy list and frees the memory allocated to it and to
383 * its children 433 * its children
384 * 434 *
385 * @param group The group to be removed 435 * @param group The group to be removed
386 */ 436 */
387 void gaim_blist_remove_group(struct group *group); 437 void gaim_blist_remove_group(GaimGroup *group);
388 438
389 /** 439 /**
390 * Returns the alias of a buddy. 440 * Returns the alias of a buddy.
391 * 441 *
392 * @param buddy The buddy whose name will be returned. 442 * @param buddy The buddy whose name will be returned.
393 * @return The alias (if set), server alias (if option is set), or NULL. 443 * @return The alias (if set), server alias (if option is set), or NULL.
394 */ 444 */
395 char *gaim_get_buddy_alias_only(struct buddy *buddy); 445 const char *gaim_get_buddy_alias_only(GaimBuddy *buddy);
396 446
397 447
398 /** 448 /**
399 * Returns the correct name to display for a buddy. 449 * Returns the correct name to display for a buddy.
400 * 450 *
401 * @param buddy The buddy whose name will be returned. 451 * @param buddy The buddy whose name will be returned.
402 * @return The alias (if set), server alias (if option is set), screenname, or "Unknown" 452 * @return The alias (if set), server alias (if option is set), screenname, or "Unknown"
403 */ 453 */
404 char *gaim_get_buddy_alias(struct buddy *buddy); 454 const char *gaim_get_buddy_alias(GaimBuddy *buddy);
405 455
406 /** 456 /**
407 * Finds the buddy struct given a screenname and an account 457 * Finds the buddy struct given a screenname and an account
408 * 458 *
409 * @param name The buddy's screenname or NULL to search for more buddies with the same screenname 459 * @param name The buddy's screenname or NULL to search for more buddies with the same screenname
410 * as the previous search 460 * as the previous search
411 * @param account The account this buddy belongs to 461 * @param account The account this buddy belongs to
412 * @return The buddy or NULL if the buddy does not exist 462 * @return The buddy or NULL if the buddy does not exist
413 */ 463 */
414 struct buddy *gaim_find_buddy(GaimAccount *account, const char *name); 464 GaimBuddy *gaim_find_buddy(GaimAccount *account, const char *name);
415 465
416 /** 466 /**
417 * Finds all buddies struct given a screenname and an account 467 * Finds all buddies struct given a screenname and an account
418 * 468 *
419 * @param name The buddy's screenname 469 * @param name The buddy's screenname
428 * Finds a group by name 478 * Finds a group by name
429 * 479 *
430 * @param name The groups name 480 * @param name The groups name
431 * @return The group or NULL if the group does not exist 481 * @return The group or NULL if the group does not exist
432 */ 482 */
433 struct group *gaim_find_group(const char *name); 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);
434 493
435 /** 494 /**
436 * Finds a chat by name. 495 * Finds a chat by name.
437 * 496 *
438 * @param name The chat's name. 497 * @param name The chat's name.
439 * 498 *
440 * @return The chat, or @c NULL if the chat does not exist. 499 * @return The chat, or @c NULL if the chat does not exist.
441 */ 500 */
442 struct chat *gaim_blist_find_chat(GaimAccount *account, const char *name); 501 GaimBlistChat *gaim_blist_find_chat(GaimAccount *account, const char *name);
443 502
444 /** 503 /**
445 * Returns the group of which the chat is a member. 504 * Returns the group of which the chat is a member.
446 * 505 *
447 * @param chat The chat. 506 * @param chat The chat.
448 * 507 *
449 * @return The parent group, or @c NULL if the chat is not in a group. 508 * @return The parent group, or @c NULL if the chat is not in a group.
450 */ 509 */
451 struct group *gaim_blist_chat_get_group(struct chat *chat); 510 GaimGroup *gaim_blist_chat_get_group(GaimBlistChat *chat);
452 511
453 /** 512 /**
454 * Returns the group of which the buddy is a member. 513 * Returns the group of which the buddy is a member.
455 * 514 *
456 * @param buddy The buddy 515 * @param buddy The buddy
457 * @return The group or NULL if the buddy is not in a group 516 * @return The group or NULL if the buddy is not in a group
458 */ 517 */
459 struct group *gaim_find_buddys_group(struct buddy *buddy); 518 GaimGroup *gaim_find_buddys_group(GaimBuddy *buddy);
460 519
461 520
462 /** 521 /**
463 * Returns a list of accounts that have buddies in this group 522 * Returns a list of accounts that have buddies in this group
464 * 523 *
465 * @param group The group 524 * @param group The group
466 * @return A list of gaim_accounts 525 * @return A list of gaim_accounts
467 */ 526 */
468 GSList *gaim_group_get_accounts(struct group *g); 527 GSList *gaim_group_get_accounts(GaimGroup *g);
469 528
470 /** 529 /**
471 * Determines whether an account owns any buddies in a given group 530 * Determines whether an account owns any buddies in a given group
472 * 531 *
473 * @param g The group to search through. 532 * @param g The group to search through.
474 * @param account The account. 533 * @param account The account.
475 */ 534 */
476 gboolean gaim_group_on_account(struct group *g, GaimAccount *account); 535 gboolean gaim_group_on_account(GaimGroup *g, GaimAccount *account);
477 536
478 /** 537 /**
479 * Called when an account gets signed on. Tells the UI to update all the 538 * Called when an account gets signed on. Tells the UI to update all the
480 * buddies. 539 * buddies.
481 * 540 *
486 545
487 /** 546 /**
488 * Called when an account gets signed off. Sets the presence of all the buddies to 0 547 * Called when an account gets signed off. Sets the presence of all the buddies to 0
489 * and tells the UI to update them. 548 * and tells the UI to update them.
490 * 549 *
491 * @param account The account 550 * @param account The account
492 */ 551 */
493 void gaim_blist_remove_account(GaimAccount *account); 552 void gaim_blist_remove_account(GaimAccount *account);
494 553
495 554
496 /** 555 /**
498 * 557 *
499 * @param group The group 558 * @param group The group
500 * @param offline Count buddies in offline accounts 559 * @param offline Count buddies in offline accounts
501 * @return The number of buddies in the group 560 * @return The number of buddies in the group
502 */ 561 */
503 int gaim_blist_get_group_size(struct group *group, gboolean offline); 562 int gaim_blist_get_group_size(GaimGroup *group, gboolean offline);
504 563
505 /** 564 /**
506 * Determines the number of online buddies in a group 565 * Determines the number of online buddies in a group
507 * 566 *
508 * @param group The group 567 * @param group The group
509 * @return The number of online buddies in the group, or 0 if the group is NULL 568 * @return The number of online buddies in the group, or 0 if the group is NULL
510 */ 569 */
511 int gaim_blist_get_group_online_count(struct group *group); 570 int gaim_blist_get_group_online_count(GaimGroup *group);
512 571
513 /*@}*/ 572 /*@}*/
514 573
515 /****************************************************************************************/ 574 /****************************************************************************************/
516 /** @name Buddy list file management API */ 575 /** @name Buddy list file management API */
541 * 600 *
542 * @param g The group the data is associated with 601 * @param g The group the data is associated with
543 * @param key The key used to retrieve the data 602 * @param key The key used to retrieve the data
544 * @param value The data to set 603 * @param value The data to set
545 */ 604 */
546 void gaim_group_set_setting(struct group *g, const char *key, const char *value); 605 void gaim_group_set_setting(GaimGroup *g, const char *key, const char *value);
547 606
548 /** 607 /**
549 * Retrieves data from the XML buddy list set by gaim_group_set_setting()) 608 * Retrieves data from the XML buddy list set by gaim_group_set_setting())
550 * 609 *
551 * @param g The group to retrieve data from 610 * @param g The group to retrieve data from
552 * @param key The key to retrieve the data with 611 * @param key The key to retrieve the data with
553 * @return The associated data or NULL if no data is associated 612 * @return The associated data or NULL if no data is associated
554 */ 613 */
555 char *gaim_group_get_setting(struct group *g, const char *key); 614 char *gaim_group_get_setting(GaimGroup *g, const char *key);
556 615
557 /** 616 /**
558 * Associates some data with the chat in the xml buddy list 617 * Associates some data with the chat in the xml buddy list
559 * 618 *
560 * @param b The chat the data is associated with 619 * @param b The chat the data is associated with
561 * @param key The key used to retrieve the data 620 * @param key The key used to retrieve the data
562 * @param value The data to set 621 * @param value The data to set
563 */ 622 */
564 void gaim_chat_set_setting(struct chat *c, const char *key, const char *value); 623 void gaim_blist_chat_set_setting(GaimBlistChat *c, const char *key, const char *value);
565 624
566 /** 625 /**
567 * Retrieves data from the XML buddy list set by gaim_chat_set_setting()) 626 * Retrieves data from the XML buddy list set by gaim_chat_set_setting())
568 * 627 *
569 * @param b The chat to retrieve data from 628 * @param b The chat to retrieve data from
570 * @param key The key to retrieve the data with 629 * @param key The key to retrieve the data with
571 * @return The associated data or NULL if no data is associated 630 * @return The associated data or NULL if no data is associated
572 */ 631 */
573 char *gaim_chat_get_setting(struct chat *c, const char *key); 632 char *gaim_blist_chat_get_setting(GaimBlistChat *c, const char *key);
574 633
575 /** 634 /**
576 * Associates some data with the buddy in the xml buddy list 635 * Associates some data with the buddy in the xml buddy list
577 * 636 *
578 * @param b The buddy the data is associated with 637 * @param b The buddy the data is associated with
579 * @param key The key used to retrieve the data 638 * @param key The key used to retrieve the data
580 * @param value The data to set 639 * @param value The data to set
581 */ 640 */
582 void gaim_buddy_set_setting(struct buddy *b, const char *key, const char *value); 641 void gaim_buddy_set_setting(GaimBuddy *b, const char *key, const char *value);
583 642
584 /** 643 /**
585 * Retrieves data from the XML buddy list set by gaim_buddy_set_setting()) 644 * Retrieves data from the XML buddy list set by gaim_buddy_set_setting())
586 * 645 *
587 * @param b The buddy to retrieve data from 646 * @param b The buddy to retrieve data from
588 * @param key The key to retrieve the data with 647 * @param key The key to retrieve the data with
589 * @return The associated data or NULL if no data is associated 648 * @return The associated data or NULL if no data is associated
590 */ 649 */
591 char *gaim_buddy_get_setting(struct buddy *b, const char *key); 650 char *gaim_buddy_get_setting(GaimBuddy *b, const char *key);
592 651
593 /*@}*/ 652 /*@}*/
594 653
595 /**************************************************************************/ 654 /**************************************************************************/
596 /** @name UI Registration Functions */ 655 /** @name UI Registration Functions */
639 698
640 #ifdef __cplusplus 699 #ifdef __cplusplus
641 } 700 }
642 #endif 701 #endif
643 702
644 #endif /* _LIST_H_ */ 703 #endif /* _BLIST_H_ */