src/blist.h

changeset 5234
8320a1cb0274
parent 5228
83adaad2deb1
child 5247
f318e9d10c86
equal deleted inserted replaced
5233:bb9f6f5ccdc7 5234:8320a1cb0274
1 /** 1 /**
2 * @file blist.h Buddy List API 2 * @file list.h Buddy List API
3 * @ingroup core 3 * @ingroup core
4 * 4 *
5 * gaim 5 * gaim
6 * 6 *
7 * Copyright (C) 2003, Sean Egan <sean.egan@binghamton.edu> 7 * Copyright (C) 2003, Sean Egan <sean.egan@binghamton.edu>
32 /* Enumerations */ 32 /* Enumerations */
33 /**************************************************************************/ 33 /**************************************************************************/
34 enum gaim_blist_node_type { 34 enum gaim_blist_node_type {
35 GAIM_BLIST_GROUP_NODE, 35 GAIM_BLIST_GROUP_NODE,
36 GAIM_BLIST_BUDDY_NODE, 36 GAIM_BLIST_BUDDY_NODE,
37 GAIM_BLIST_CHAT_NODE,
37 GAIM_BLIST_OTHER_NODE, 38 GAIM_BLIST_OTHER_NODE,
38 }; 39 };
39 40
41 #define GAIM_BLIST_NODE_IS_CHAT(n) ((n)->type == GAIM_BLIST_CHAT_NODE)
40 #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE) 42 #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE)
41 #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE) 43 #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE)
42 44
43 enum gaim_buddy_presence_state { 45 enum gaim_buddy_presence_state {
44 GAIM_BUDDY_SIGNING_OFF = -1, 46 GAIM_BUDDY_SIGNING_OFF = -1,
95 GaimBlistNode node; /**< The node that this group inherits from */ 97 GaimBlistNode node; /**< The node that this group inherits from */
96 char *name; /**< The name of this group. */ 98 char *name; /**< The name of this group. */
97 GHashTable *settings; /**< per-group settings from the XML buddy list, set by plugins and the likes. */ 99 GHashTable *settings; /**< per-group settings from the XML buddy list, set by plugins and the likes. */
98 }; 100 };
99 101
102 /**
103 * A group. This contains everything Gaim needs to put a chat room in the
104 * buddy list.
105 */
106 struct chat {
107 GaimBlistNode node; /**< The node that this chat inherits from */
108 char *alias; /**< The display name of this chat. */
109 GHashTable *components; /**< the stuff the protocol needs to know to join the chat */
110 struct gaim_account *account; /**< The account this chat is attached to */
111 };
112
100 113
101 /** 114 /**
102 * The Buddy List 115 * The Buddy List
103 */ 116 */
104 struct gaim_buddy_list { 117 struct gaim_buddy_list {
172 */ 185 */
173 void gaim_blist_set_visible(gboolean show); 186 void gaim_blist_set_visible(gboolean show);
174 187
175 /** 188 /**
176 * Updates a buddy's status. 189 * Updates a buddy's status.
177 * 190 *
178 * This needs to not take an int. 191 * This needs to not take an int.
179 * 192 *
180 * @param buddy The buddy whose status has changed 193 * @param buddy The buddy whose status has changed
181 * @param status The new status in cryptic prpl-understood code 194 * @param status The new status in cryptic prpl-understood code
182 */ 195 */
233 * @param buddy The buddy whose alias will be changed. 246 * @param buddy The buddy whose alias will be changed.
234 * @param alias The buddy's alias. 247 * @param alias The buddy's alias.
235 */ 248 */
236 void gaim_blist_alias_buddy(struct buddy *buddy, const char *alias); 249 void gaim_blist_alias_buddy(struct buddy *buddy, const char *alias);
237 250
251 /**
252 * Aliases a chat in the buddy list.
253 *
254 * @param chat The chat whose alias will be changed.
255 * @param alias The chat's new alias.
256 */
257 void gaim_blist_alias_chat(struct chat *chat, const char *alias);
238 258
239 /** 259 /**
240 * Renames a group 260 * Renames a group
241 * 261 *
242 * @param group The group to rename 262 * @param group The group to rename
243 * @param name The new name 263 * @param name The new name
244 */ 264 */
245 void gaim_blist_rename_group(struct group *group, const char *name); 265 void gaim_blist_rename_group(struct group *group, const char *name);
246 266
267 /**
268 * Creates a new chat for the buddy list
269 *
270 * @param account The account this chat will get added to
271 * @param alias The alias of the new chat
272 * @param components The info the prpl needs to join the chat
273 * @return A newly allocated chat
274 */
275 struct chat *gaim_chat_new(struct gaim_account *account, const char *alias, GHashTable *components);
276
277 /**
278 * Adds a new chat to the buddy list.
279 *
280 * The chat will be inserted right after node or appended to the end
281 * of group if node is NULL. If both are NULL, the buddy will be added to
282 * the "Chats" group.
283 *
284 * @param chat The new chat who gets added
285 * @param group The group to add the new chat to.
286 * @param node The insertion point
287 */
288 void gaim_blist_add_chat(struct chat *chat, struct group *group, GaimBlistNode *node);
247 289
248 /** 290 /**
249 * Creates a new buddy 291 * Creates a new buddy
250 * 292 *
251 * @param account The account this buddy will get added to 293 * @param account The account this buddy will get added to
296 * @param buddy The buddy to be removed 338 * @param buddy The buddy to be removed
297 */ 339 */
298 void gaim_blist_remove_buddy(struct buddy *buddy); 340 void gaim_blist_remove_buddy(struct buddy *buddy);
299 341
300 /** 342 /**
343 * Removes a chat from the buddy list and frees the memory allocated to it.
344 *
345 * @param chat The chat to be removed
346 */
347 void gaim_blist_remove_chat(struct chat *chat);
348
349 /**
301 * Removes a group from the buddy list and frees the memory allocated to it and to 350 * Removes a group from the buddy list and frees the memory allocated to it and to
302 * its children 351 * its children
303 * 352 *
304 * @param group The group to be removed 353 * @param group The group to be removed
305 */ 354 */
363 * @param account The account. 412 * @param account The account.
364 */ 413 */
365 gboolean gaim_group_on_account(struct group *g, struct gaim_account *account); 414 gboolean gaim_group_on_account(struct group *g, struct gaim_account *account);
366 415
367 /** 416 /**
417 * Called when an account gets signed on. Tells the UI to update all the
418 * buddies.
419 *
420 * @param account The account
421 */
422 void gaim_blist_add_account(struct gaim_account *account);
423
424
425 /**
368 * Called when an account gets signed off. Sets the presence of all the buddies to 0 426 * Called when an account gets signed off. Sets the presence of all the buddies to 0
369 * and tells the UI to update them. 427 * and tells the UI to update them.
370 * 428 *
371 * @param account The account 429 * @param account The account
372 */ 430 */

mercurial