comparison libpurple/blist.h @ 25877:1260a3fb60f4

propagate from branch 'im.pidgin.pidgin' (head b8d6086aef6b2e65d86e8ce60220ab7f460d5079) to branch 'im.pidgin.pidgin.next.minor' (head c165595260a2efa0ca23704ada46a303e0412e19)
author Richard Laager <rlaager@wiktel.com>
date Fri, 12 Dec 2008 20:03:58 +0000
parents 2b8c85f74ede d8452c0bec7b
children d25cbbea7fe5
comparison
equal deleted inserted replaced
24710:d1d9d085d626 25877:1260a3fb60f4
73 { 73 {
74 PURPLE_BLIST_NODE_FLAG_NO_SAVE = 1 << 0 /**< node should not be saved with the buddy list */ 74 PURPLE_BLIST_NODE_FLAG_NO_SAVE = 1 << 0 /**< node should not be saved with the buddy list */
75 75
76 } PurpleBlistNodeFlags; 76 } PurpleBlistNodeFlags;
77 77
78 #define PURPLE_BLIST_NODE(obj) ((PurpleBlistNode *)(obj))
79
78 #define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (purple_blist_node_get_flags((PurpleBlistNode*)(b)) & (f)) 80 #define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (purple_blist_node_get_flags((PurpleBlistNode*)(b)) & (f))
79 #define PURPLE_BLIST_NODE_SHOULD_SAVE(b) (! PURPLE_BLIST_NODE_HAS_FLAG(b, PURPLE_BLIST_NODE_FLAG_NO_SAVE)) 81 #define PURPLE_BLIST_NODE_SHOULD_SAVE(b) (! PURPLE_BLIST_NODE_HAS_FLAG(b, PURPLE_BLIST_NODE_FLAG_NO_SAVE))
80 82
81 #define PURPLE_BLIST_NODE_NAME(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CHAT_NODE ? purple_chat_get_name((PurpleChat*)n) : \ 83 #define PURPLE_BLIST_NODE_NAME(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CHAT_NODE ? purple_chat_get_name((PurpleChat*)n) : \
82 purple_blist_node_get_type(n) == PURPLE_BLIST_BUDDY_NODE ? purple_buddy_get_name((PurpleBuddy*)n) : NULL) 84 purple_blist_node_get_type(n) == PURPLE_BLIST_BUDDY_NODE ? purple_buddy_get_name((PurpleBuddy*)n) : NULL)
85
86 #define PURPLE_GROUP(obj) ((PurpleGroup *)(obj))
87 #define PURPLE_CONTACT(obj) ((PurpleContact *)(obj))
88 #define PURPLE_BUDDY(obj) ((PurpleBuddy *)(obj))
89 #define PURPLE_CHAT(obj) ((PurpleChat *)(obj))
83 90
84 #include "account.h" 91 #include "account.h"
85 #include "buddyicon.h" 92 #include "buddyicon.h"
86 #include "status.h" 93 #include "status.h"
87 94
154 char *alias; /**< The display name of this chat. */ 161 char *alias; /**< The display name of this chat. */
155 GHashTable *components; /**< the stuff the protocol needs to know to join the chat */ 162 GHashTable *components; /**< the stuff the protocol needs to know to join the chat */
156 PurpleAccount *account; /**< The account this chat is attached to */ 163 PurpleAccount *account; /**< The account this chat is attached to */
157 }; 164 };
158 165
159 #endif /* PURPLE_HIDE_STRUCTS && PURPLE_BLIST_STRUCTS */
160
161
162 /** 166 /**
163 * The Buddy List 167 * The Buddy List
164 */ 168 */
165 struct _PurpleBuddyList { 169 struct _PurpleBuddyList {
166 PurpleBlistNode *root; /**< The first node in the buddy list */ 170 PurpleBlistNode *root; /**< The first node in the buddy list */
167 GHashTable *buddies; /**< Every buddy in this list */ 171 GHashTable *buddies; /**< Every buddy in this list */
168 void *ui_data; /**< UI-specific data. */ 172 void *ui_data; /**< UI-specific data. */
169 }; 173 };
174
175 #endif /* PURPLE_HIDE_STRUCTS && PURPLE_BLIST_STRUCTS */
170 176
171 /** 177 /**
172 * Buddy list UI operations. 178 * Buddy list UI operations.
173 * 179 *
174 * Any UI representing a buddy list must assign a filled-out PurpleBlistUiOps 180 * Any UI representing a buddy list must assign a filled-out PurpleBlistUiOps
234 * @return The root node. 240 * @return The root node.
235 */ 241 */
236 PurpleBlistNode *purple_blist_get_root(void); 242 PurpleBlistNode *purple_blist_get_root(void);
237 243
238 /** 244 /**
245 * Returns the hash table of every buddy in the list.
246 *
247 * @return The hash table of every buddy in the list.
248 * @since 2.6.0
249 */
250 GHashTable *purple_blist_get_buddies(void);
251
252 /**
253 * Returns the UI data for the list.
254 *
255 * @return The UI data for the list.
256 * @since 2.6.0
257 */
258 void *purple_blist_get_ui_data(void);
259
260 /**
261 * Sets the UI data for the list.
262 *
263 * @param ui_data The UI data for the list.
264 * @since 2.6.0
265 */
266 void purple_blist_set_ui_data(void *ui_data);
267
268 /**
239 * Returns the next node of a given node. This function is to be used to iterate 269 * Returns the next node of a given node. This function is to be used to iterate
240 * over the tree returned by purple_get_blist. 270 * over the tree returned by purple_get_blist.
241 * 271 *
242 * @param node A node. 272 * @param node A node.
243 * @param offline Whether to include nodes for offline accounts 273 * @param offline Whether to include nodes for offline accounts
300 * @see purple_blist_node_next 330 * @see purple_blist_node_next
301 */ 331 */
302 PurpleBlistNode *purple_blist_node_get_sibling_prev(PurpleBlistNode *node); 332 PurpleBlistNode *purple_blist_node_get_sibling_prev(PurpleBlistNode *node);
303 333
304 /** 334 /**
335 * Returns the UI data of a given node.
336 *
337 * @param node The node.
338 * @return The UI data.
339 * @since 2.6.0
340 */
341 void *purple_blist_node_get_ui_data(const PurpleBlistNode *node);
342
343 /**
344 * Sets the UI data of a given node.
345 *
346 * @param node The node.
347 * @param ui_data The UI data.
348 * @since 2.6.0
349 */
350 void purple_blist_node_set_ui_data(PurpleBlistNode *node, void *ui_data);
351
352 /**
305 * Shows the buddy list, creating a new one if necessary. 353 * Shows the buddy list, creating a new one if necessary.
306 */ 354 */
307 void purple_blist_show(void); 355 void purple_blist_show(void);
308 356
309 357
468 * @return The buddy icon. 516 * @return The buddy icon.
469 */ 517 */
470 PurpleBuddyIcon *purple_buddy_get_icon(const PurpleBuddy *buddy); 518 PurpleBuddyIcon *purple_buddy_get_icon(const PurpleBuddy *buddy);
471 519
472 /** 520 /**
521 * Returns a buddy's protocol-specific data.
522 *
523 * This should only be called from the associated prpl.
524 *
525 * @param buddy The buddy.
526 * @return The protocol data.
527 *
528 * @see purple_buddy_set_protocol_data()
529 * @since 2.6.0
530 */
531 gpointer purple_buddy_get_protocol_data(const PurpleBuddy *buddy);
532
533 /**
534 * Sets a buddy's protocol-specific data.
535 *
536 * This should only be called from the associated prpl.
537 *
538 * @param buddy The buddy.
539 * @param data The data.
540 *
541 * @see purple_buddy_get_protocol_data()
542 * @since 2.6.0
543 */
544 void purple_buddy_set_protocol_data(PurpleBuddy *buddy, gpointer data);
545
546 /**
473 * Returns a buddy's contact. 547 * Returns a buddy's contact.
474 * 548 *
475 * @param buddy The buddy. 549 * @param buddy The buddy.
476 * 550 *
477 * @return The buddy's contact. 551 * @return The buddy's contact.
657 * @return The appropriate name or alias, or NULL. 731 * @return The appropriate name or alias, or NULL.
658 * 732 *
659 */ 733 */
660 const char *purple_buddy_get_contact_alias(PurpleBuddy *buddy); 734 const char *purple_buddy_get_contact_alias(PurpleBuddy *buddy);
661 735
736 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_)
662 /** 737 /**
663 * Returns the correct alias for this user, ignoring server aliases. Used 738 * Returns the correct alias for this user, ignoring server aliases. Used
664 * when a user-recognizable name is required. In order: buddy's alias; buddy's 739 * when a user-recognizable name is required. In order: buddy's alias; buddy's
665 * contact alias; buddy's user name. 740 * contact alias; buddy's user name.
666 * 741 *
667 * @param buddy The buddy whose alias will be returned. 742 * @param buddy The buddy whose alias will be returned.
668 * @return The appropriate name or alias. 743 * @return The appropriate name or alias.
744 * @deprecated Try purple_buddy_get_alias(), if server aliases are okay.
669 */ 745 */
670 const char *purple_buddy_get_local_alias(PurpleBuddy *buddy); 746 const char *purple_buddy_get_local_alias(PurpleBuddy *buddy);
747 #endif
671 748
672 /** 749 /**
673 * Returns the correct name to display for a buddy. In order of precedence: 750 * Returns the correct name to display for a buddy. In order of precedence:
674 * the buddy's alias; the buddy's server alias; the buddy's contact alias; 751 * the buddy's alias; the buddy's server alias; the buddy's contact alias;
675 * the buddy's user name. 752 * the buddy's user name.
676 * 753 *
677 * @param buddy The buddy whose name will be returned. 754 * @param buddy The buddy whose name will be returned.
678 * @return The appropriate name or alias, or NULL 755 * @return The appropriate name or alias, or NULL
679 */ 756 */
680 const char *purple_buddy_get_alias(PurpleBuddy *buddy); 757 const char *purple_buddy_get_alias(PurpleBuddy *buddy);
758
759 /**
760 * Returns the local alias for the buddy, or @c NULL if none exists.
761 *
762 * @param buddy The buddy
763 * @return The local alias for the buddy
764 * @since 2.6.0
765 */
766 const char *purple_buddy_get_local_buddy_alias(PurpleBuddy *buddy);
681 767
682 /** 768 /**
683 * Returns the correct name to display for a blist chat. 769 * Returns the correct name to display for a blist chat.
684 * 770 *
685 * @param chat The chat whose name will be returned. 771 * @param chat The chat whose name will be returned.