libpurple/buddylist.h

changeset 42725
ceb13f1de2d2
parent 42722
4e20540308d7
equal deleted inserted replaced
42724:2794bb8587d3 42725:ceb13f1de2d2
27 #ifndef PURPLE_BUDDY_LIST_H 27 #ifndef PURPLE_BUDDY_LIST_H
28 #define PURPLE_BUDDY_LIST_H 28 #define PURPLE_BUDDY_LIST_H
29 29
30 /* I can't believe I let ChipX86 inspire me to write good code. -Sean */ 30 /* I can't believe I let ChipX86 inspire me to write good code. -Sean */
31 31
32 #include "buddy.h"
33 #include "purpleaccount.h" 32 #include "purpleaccount.h"
34 #include "purpleversion.h" 33 #include "purpleversion.h"
35 34
36 #define PURPLE_TYPE_BUDDY_LIST (purple_buddy_list_get_type()) 35 #define PURPLE_TYPE_BUDDY_LIST (purple_buddy_list_get_type())
37 typedef struct _PurpleBuddyList PurpleBuddyList; 36 typedef struct _PurpleBuddyList PurpleBuddyList;
249 */ 248 */
250 PURPLE_AVAILABLE_IN_ALL 249 PURPLE_AVAILABLE_IN_ALL
251 void purple_blist_set_visible(gboolean show); 250 void purple_blist_set_visible(gboolean show);
252 251
253 /** 252 /**
254 * purple_blist_update_buddies_cache:
255 * @buddy: The buddy whose name will be changed.
256 * @new_name: The new name of the buddy.
257 *
258 * Updates the buddies hash table when a buddy has been renamed. This only
259 * updates the cache, the caller is responsible for the actual renaming of
260 * the buddy after updating the cache.
261 *
262 * Since: 3.0
263 */
264 PURPLE_AVAILABLE_IN_3_0
265 void purple_blist_update_buddies_cache(PurpleBuddy *buddy, const char *new_name);
266
267 /**
268 * purple_blist_update_groups_cache: 253 * purple_blist_update_groups_cache:
269 * @group: The group whose name will be changed. 254 * @group: The group whose name will be changed.
270 * @new_name: The new name of the group. 255 * @new_name: The new name of the group.
271 * 256 *
272 * Updates the groups hash table when a group has been renamed. This only 257 * Updates the groups hash table when a group has been renamed. This only
275 * 260 *
276 * Since: 3.0 261 * Since: 3.0
277 */ 262 */
278 PURPLE_AVAILABLE_IN_3_0 263 PURPLE_AVAILABLE_IN_3_0
279 void purple_blist_update_groups_cache(PurpleGroup *group, const char *new_name); 264 void purple_blist_update_groups_cache(PurpleGroup *group, const char *new_name);
280
281 /**
282 * purple_blist_add_buddy:
283 * @buddy: The new buddy who gets added
284 * @contact: The optional contact to place the buddy in.
285 * @group: The group to add the new buddy to.
286 * @node: The insertion point. Pass in NULL to add the node as
287 * the first child in the given group.
288 *
289 * Adds a new buddy to the buddy list.
290 *
291 * The buddy will be inserted right after node or prepended to the
292 * group if node is NULL. If both are NULL, the buddy will be added to
293 * the default group.
294 *
295 * Since: 2.0
296 */
297 PURPLE_AVAILABLE_IN_ALL
298 void purple_blist_add_buddy(PurpleBuddy *buddy, PurpleMetaContact *contact, PurpleGroup *group, PurpleBlistNode *node);
299 265
300 /** 266 /**
301 * purple_blist_add_group: 267 * purple_blist_add_group:
302 * @group: The group 268 * @group: The group
303 * @node: The insertion point 269 * @node: The insertion point
327 */ 293 */
328 PURPLE_AVAILABLE_IN_ALL 294 PURPLE_AVAILABLE_IN_ALL
329 void purple_blist_add_contact(PurpleMetaContact *contact, PurpleGroup *group, PurpleBlistNode *node); 295 void purple_blist_add_contact(PurpleMetaContact *contact, PurpleGroup *group, PurpleBlistNode *node);
330 296
331 /** 297 /**
332 * purple_blist_remove_buddy:
333 * @buddy: The buddy to be removed
334 *
335 * Removes a buddy from the buddy list and frees the memory allocated to it.
336 * This doesn't actually try to remove the buddy from the server list.
337 *
338 * See purple_account_remove_buddy().
339 *
340 * Since: 2.0
341 */
342 PURPLE_AVAILABLE_IN_ALL
343 void purple_blist_remove_buddy(PurpleBuddy *buddy);
344
345 /**
346 * purple_blist_remove_contact: 298 * purple_blist_remove_contact:
347 * @contact: The contact to be removed 299 * @contact: The contact to be removed
348 * 300 *
349 * Removes a contact, and any buddies it contains, and frees the memory 301 * Removes a contact, and any buddies it contains, and frees the memory
350 * allocated to it. This calls purple_blist_remove_buddy and therefore 302 * allocated to it. This calls purple_blist_remove_buddy and therefore
368 */ 320 */
369 PURPLE_AVAILABLE_IN_ALL 321 PURPLE_AVAILABLE_IN_ALL
370 void purple_blist_remove_group(PurpleGroup *group); 322 void purple_blist_remove_group(PurpleGroup *group);
371 323
372 /** 324 /**
373 * purple_blist_find_buddy:
374 * @account: The account this buddy belongs to
375 * @name: The buddy's name
376 *
377 * Finds the buddy struct given a name and an account
378 *
379 * Returns: (transfer none): The buddy or %NULL if the buddy does not exist.
380 *
381 * Since: 3.0
382 */
383 PURPLE_AVAILABLE_IN_3_0
384 PurpleBuddy *purple_blist_find_buddy(PurpleAccount *account, const char *name);
385
386 /**
387 * purple_blist_find_buddy_in_group:
388 * @account: The account this buddy belongs to
389 * @name: The buddy's name
390 * @group: The group to look in
391 *
392 * Finds the buddy struct given a name, an account, and a group
393 *
394 * Returns: (transfer none): The buddy or %NULL if the buddy does not exist in
395 * the group.
396 *
397 * Since: 3.0
398 */
399 PURPLE_AVAILABLE_IN_3_0
400 PurpleBuddy *purple_blist_find_buddy_in_group(PurpleAccount *account, const char *name,
401 PurpleGroup *group);
402
403 /**
404 * purple_blist_find_buddies:
405 * @account: The account this buddy belongs to
406 * @name: The buddy's name (or NULL to return all buddies for the account)
407 *
408 * Finds all PurpleBuddy structs given a name and an account
409 *
410 * Returns: (element-type PurpleBuddy) (transfer container): %NULL if the buddy
411 * doesn't exist, or a GSList of PurpleBuddy structs.
412 *
413 * Since: 3.0
414 */
415 PURPLE_AVAILABLE_IN_3_0
416 GSList *purple_blist_find_buddies(PurpleAccount *account, const char *name);
417
418 /**
419 * purple_blist_find_group: 325 * purple_blist_find_group:
420 * @name: The group's name 326 * @name: The group's name
421 * 327 *
422 * Finds a group by name 328 * Finds a group by name
423 * 329 *
437 * 343 *
438 * Since: 3.0 344 * Since: 3.0
439 */ 345 */
440 PURPLE_AVAILABLE_IN_3_0 346 PURPLE_AVAILABLE_IN_3_0
441 PurpleGroup *purple_blist_get_default_group(void); 347 PurpleGroup *purple_blist_get_default_group(void);
442
443 /**
444 * purple_blist_add_account:
445 * @account: The account
446 *
447 * Called when an account connects. Tells the UI to update all the
448 * buddies.
449 *
450 * Since: 2.0
451 */
452 PURPLE_AVAILABLE_IN_ALL
453 void purple_blist_add_account(PurpleAccount *account);
454
455 /**
456 * purple_blist_remove_account:
457 * @account: The account
458 *
459 * Called when an account disconnects. Sets the presence of all the buddies to 0
460 * and tells the UI to update them.
461 *
462 * Since: 2.0
463 */
464 PURPLE_AVAILABLE_IN_ALL
465 void purple_blist_remove_account(PurpleAccount *account);
466 348
467 /** 349 /**
468 * purple_blist_walk: 350 * purple_blist_walk:
469 * @group_func: (scope call): The callback for groups 351 * @group_func: (scope call): The callback for groups
470 * @meta_contact_func: (scope call): The callback for meta-contacts 352 * @meta_contact_func: (scope call): The callback for meta-contacts

mercurial