comparison src/blist.h @ 9944:e4a27c9aec4c

[gaim-migrate @ 10838] with much rejoicing, and massive thanks to the efforts of Christian, and all who have helped him, I present to you the incomplete status rewrite! committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 03 Sep 2004 21:35:52 +0000
parents acbbc0d73600
children ced29c7b396c
comparison
equal deleted inserted replaced
9943:f8e395a054e2 9944:e4a27c9aec4c
40 typedef struct _GaimContact GaimContact; 40 typedef struct _GaimContact GaimContact;
41 typedef struct _GaimBuddy GaimBuddy; 41 typedef struct _GaimBuddy GaimBuddy;
42 42
43 #include "account.h" 43 #include "account.h"
44 #include "buddyicon.h" 44 #include "buddyicon.h"
45 #include "status.h"
45 46
46 /**************************************************************************/ 47 /**************************************************************************/
47 /* Enumerations */ 48 /* Enumerations */
48 /**************************************************************************/ 49 /**************************************************************************/
49 typedef enum 50 typedef enum
54 GAIM_BLIST_CHAT_NODE, 55 GAIM_BLIST_CHAT_NODE,
55 GAIM_BLIST_OTHER_NODE 56 GAIM_BLIST_OTHER_NODE
56 57
57 } GaimBlistNodeType; 58 } GaimBlistNodeType;
58 59
59 #define GAIM_BLIST_NODE_IS_CHAT(n) ((n)->type == GAIM_BLIST_CHAT_NODE) 60 #define GAIM_BLIST_NODE_IS_CHAT(n) ((n)->type == GAIM_BLIST_CHAT_NODE)
60 #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE) 61 #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE)
61 #define GAIM_BLIST_NODE_IS_CONTACT(n) ((n)->type == GAIM_BLIST_CONTACT_NODE) 62 #define GAIM_BLIST_NODE_IS_CONTACT(n) ((n)->type == GAIM_BLIST_CONTACT_NODE)
62 #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE) 63 #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE)
63 64
64 typedef enum 65 typedef enum
65 { 66 {
66 GAIM_BUDDY_SIGNING_OFF = -1, 67 GAIM_BUDDY_SIGNING_OFF = -1,
67 GAIM_BUDDY_OFFLINE = 0, 68 GAIM_BUDDY_OFFLINE = 0,
68 GAIM_BUDDY_ONLINE, 69 GAIM_BUDDY_ONLINE,
69 GAIM_BUDDY_SIGNING_ON 70 GAIM_BUDDY_SIGNING_ON
70 71
71 } GaimBuddyPresenceState; 72 } GaimBuddyPresenceState;
72 73
73 #define GAIM_BUDDY_IS_ONLINE(b) ((b)->account->gc && \ 74 #define GAIM_BUDDY_IS_ONLINE(b) \
74 ((b)->present == GAIM_BUDDY_ONLINE || \ 75 ((b) != NULL && gaim_account_is_connected((b)->account) && \
75 (b)->present == GAIM_BUDDY_SIGNING_ON)) 76 gaim_presence_is_online(gaim_buddy_get_presence(b)))
76 77
77 typedef enum 78 typedef enum
78 { 79 {
79 GAIM_BLIST_NODE_FLAG_NO_SAVE = 1, /**< node should not be saved with the buddy list */ 80 GAIM_BLIST_NODE_FLAG_NO_SAVE = 1, /**< node should not be saved with the buddy list */
80 } GaimBlistNodeFlags; 81 } GaimBlistNodeFlags;
268 void gaim_blist_update_buddy_presence(GaimBuddy *buddy, gboolean online); 269 void gaim_blist_update_buddy_presence(GaimBuddy *buddy, gboolean online);
269 270
270 /** 271 /**
271 * Updates a buddy's signon time. 272 * Updates a buddy's signon time.
272 * 273 *
273 * @param buddy The buddy whose idle time has changed. 274 * @param buddy The buddy whose sign-on time has changed.
274 * @param signon The buddy's signon time since the dawn of the UNIX epoch. 275 * @param signon The buddy's signon time since the dawn of the UNIX epoch.
275 */ 276 */
276 void gaim_blist_update_buddy_signon(GaimBuddy *buddy, time_t signon); 277 void gaim_blist_update_buddy_signon(GaimBuddy *buddy, time_t signon);
277
278 /**
279 * Updates a buddy's idle time.
280 *
281 * @param buddy The buddy whose idle time has changed
282 * @param idle The buddy's idle time in minutes.
283 */
284 void gaim_blist_update_buddy_idle(GaimBuddy *buddy, int idle);
285
286
287 /**
288 * Updates a buddy's warning level.
289 *
290 * @param buddy The buddy whose warning level has changed.
291 * @param warning The warning level as an int from 0 to 100.
292 */
293 void gaim_blist_update_buddy_evil(GaimBuddy *buddy, int warning);
294 278
295 /** 279 /**
296 * Updates a buddy's icon. 280 * Updates a buddy's icon.
297 * 281 *
298 * @param buddy The buddy whose buddy icon has changed 282 * @param buddy The buddy whose buddy icon has changed
411 * @return The buddy's contact. 395 * @return The buddy's contact.
412 */ 396 */
413 GaimContact *gaim_buddy_get_contact(GaimBuddy *buddy); 397 GaimContact *gaim_buddy_get_contact(GaimBuddy *buddy);
414 398
415 /** 399 /**
400 * Returns a buddy's presence.
401 *
402 * @param buddy The buddy.
403 *
404 * @return The buddy's presence.
405 */
406 GaimPresence *gaim_buddy_get_presence(const GaimBuddy *buddy);
407
408 /**
416 * Adds a new buddy to the buddy list. 409 * Adds a new buddy to the buddy list.
417 * 410 *
418 * The buddy will be inserted right after node or prepended to the 411 * The buddy will be inserted right after node or prepended to the
419 * group if node is NULL. If both are NULL, the buddy will be added to 412 * group if node is NULL. If both are NULL, the buddy will be added to
420 * the "Buddies" group. 413 * the "Buddies" group.
509 * 502 *
510 * @return TRUE if there are any buddies from account in the contact, or FALSE otherwise. 503 * @return TRUE if there are any buddies from account in the contact, or FALSE otherwise.
511 */ 504 */
512 gboolean gaim_contact_on_account(GaimContact *contact, GaimAccount *account); 505 gboolean gaim_contact_on_account(GaimContact *contact, GaimAccount *account);
513 506
507
508 /**
509 * Re-calculates the priority buddy for a contact.
510 *
511 * @param contact The contact.
512 */
513 void gaim_contact_compute_priority_buddy(GaimContact *contact);
514 514
515 /** 515 /**
516 * Removes a buddy from the buddy list and frees the memory allocated to it. 516 * Removes a buddy from the buddy list and frees the memory allocated to it.
517 * 517 *
518 * @param buddy The buddy to be removed 518 * @param buddy The buddy to be removed