comparison src/blist.h @ 7098:770233dad86c

[gaim-migrate @ 7663] Renamed a few of the buddy list structs to be compliant with the rest of gaim. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 01 Oct 2003 04:05:46 +0000
parents 9946001989a3
children 7bee4be16385
comparison
equal deleted inserted replaced
7097:2c331b10161e 7098:770233dad86c
26 #ifndef _BLIST_H_ 26 #ifndef _BLIST_H_
27 #define _BLIST_H_ 27 #define _BLIST_H_
28 28
29 #include <glib.h> 29 #include <glib.h>
30 30
31 typedef struct _GaimBuddyList GaimBuddyList;
32 typedef struct _GaimBlistUiOps GaimBlistUiOps;
31 typedef struct _GaimBlistNode GaimBlistNode; 33 typedef struct _GaimBlistNode GaimBlistNode;
32 34
33 typedef struct _GaimBlistChat GaimBlistChat; 35 typedef struct _GaimBlistChat GaimBlistChat;
34 typedef struct _GaimGroup GaimGroup; 36 typedef struct _GaimGroup GaimGroup;
35 typedef struct _GaimContact GaimContact; 37 typedef struct _GaimContact GaimContact;
39 #include "buddyicon.h" 41 #include "buddyicon.h"
40 42
41 /**************************************************************************/ 43 /**************************************************************************/
42 /* Enumerations */ 44 /* Enumerations */
43 /**************************************************************************/ 45 /**************************************************************************/
44 enum gaim_blist_node_type { 46 typedef enum
47 {
45 GAIM_BLIST_GROUP_NODE, 48 GAIM_BLIST_GROUP_NODE,
46 GAIM_BLIST_CONTACT_NODE, 49 GAIM_BLIST_CONTACT_NODE,
47 GAIM_BLIST_BUDDY_NODE, 50 GAIM_BLIST_BUDDY_NODE,
48 GAIM_BLIST_CHAT_NODE, 51 GAIM_BLIST_CHAT_NODE,
49 GAIM_BLIST_OTHER_NODE 52 GAIM_BLIST_OTHER_NODE
50 }; 53
54 } GaimBlistNodeType;
51 55
52 #define GAIM_BLIST_NODE_IS_CHAT(n) ((n)->type == GAIM_BLIST_CHAT_NODE) 56 #define GAIM_BLIST_NODE_IS_CHAT(n) ((n)->type == GAIM_BLIST_CHAT_NODE)
53 #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE) 57 #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE)
54 #define GAIM_BLIST_NODE_IS_CONTACT(n) ((n)->type == GAIM_BLIST_CONTACT_NODE) 58 #define GAIM_BLIST_NODE_IS_CONTACT(n) ((n)->type == GAIM_BLIST_CONTACT_NODE)
55 #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE) 59 #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE)
56 60
57 enum gaim_buddy_presence_state { 61 typedef enum
62 {
58 GAIM_BUDDY_SIGNING_OFF = -1, 63 GAIM_BUDDY_SIGNING_OFF = -1,
59 GAIM_BUDDY_OFFLINE = 0, 64 GAIM_BUDDY_OFFLINE = 0,
60 GAIM_BUDDY_ONLINE, 65 GAIM_BUDDY_ONLINE,
61 GAIM_BUDDY_SIGNING_ON 66 GAIM_BUDDY_SIGNING_ON
62 }; 67
68 } GaimBuddyPresenceState;
63 69
64 #define GAIM_BUDDY_IS_ONLINE(b) ((b)->account->gc && \ 70 #define GAIM_BUDDY_IS_ONLINE(b) ((b)->account->gc && \
65 ((b)->present == GAIM_BUDDY_ONLINE || \ 71 ((b)->present == GAIM_BUDDY_ONLINE || \
66 (b)->present == GAIM_BUDDY_SIGNING_ON)) 72 (b)->present == GAIM_BUDDY_SIGNING_ON))
67 73
72 78
73 /** 79 /**
74 * A Buddy list node. This can represent a group, a buddy, or anything else. This is a base class for struct buddy and 80 * A Buddy list node. This can represent a group, a buddy, or anything else. This is a base class for struct buddy and
75 * struct group and for anything else that wants to put itself in the buddy list. */ 81 * struct group and for anything else that wants to put itself in the buddy list. */
76 struct _GaimBlistNode { 82 struct _GaimBlistNode {
77 enum gaim_blist_node_type type; /**< The type of node this is */ 83 GaimBlistNodeType type; /**< The type of node this is */
78 GaimBlistNode *prev; /**< The sibling before this buddy. */ 84 GaimBlistNode *prev; /**< The sibling before this buddy. */
79 GaimBlistNode *next; /**< The sibling after this buddy. */ 85 GaimBlistNode *next; /**< The sibling after this buddy. */
80 GaimBlistNode *parent; /**< The parent of this node */ 86 GaimBlistNode *parent; /**< The parent of this node */
81 GaimBlistNode *child; /**< The child of this node */ 87 GaimBlistNode *child; /**< The child of this node */
82 void *ui_data; /**< The UI can put data here. */ 88 void *ui_data; /**< The UI can put data here. */
83 }; 89 };
84 90
85 /** 91 /**
86 * A buddy. This contains everything Gaim will ever need to know about someone on the buddy list. Everything. 92 * A buddy. This contains everything Gaim will ever need to know about someone on the buddy list. Everything.
87 */ 93 */
88 struct _GaimBuddy { 94 struct _GaimBuddy {
89 GaimBlistNode node; /**< The node that this buddy inherits from */ 95 GaimBlistNode node; /**< The node that this buddy inherits from */
90 char *name; /**< The screenname of the buddy. */ 96 char *name; /**< The screenname of the buddy. */
91 char *alias; /**< The user-set alias of the buddy */ 97 char *alias; /**< The user-set alias of the buddy */
92 char *server_alias; /**< The server-specified alias of the buddy. (i.e. MSN "Friendly Names") */ 98 char *server_alias; /**< The server-specified alias of the buddy. (i.e. MSN "Friendly Names") */
93 enum gaim_buddy_presence_state present; /**< This is 0 if the buddy appears offline, 1 if he appears online, and 2 if 99 GaimBuddyPresenceState present; /**< This is 0 if the buddy appears offline, 1 if he appears online, and 2 if
94 he has recently signed on */ 100 he has recently signed on */
95 int evil; /**< The warning level */ 101 int evil; /**< The warning level */
96 time_t signon; /**< The time the buddy signed on. */ 102 time_t signon; /**< The time the buddy signed on. */
97 int idle; /**< The time the buddy has been idle in minutes. */ 103 int idle; /**< The time the buddy has been idle in minutes. */
98 int uc; /**< This is a cryptic bitmask that makes sense only to the prpl. This will get changed */ 104 int uc; /**< This is a cryptic bitmask that makes sense only to the prpl. This will get changed */
142 148
143 149
144 /** 150 /**
145 * The Buddy List 151 * The Buddy List
146 */ 152 */
147 struct gaim_buddy_list { 153 struct _GaimBuddyList {
148 GaimBlistNode *root; /**< The first node in the buddy list */ 154 GaimBlistNode *root; /**< The first node in the buddy list */
149 GHashTable *buddies; /**< Every buddy in this list */ 155 GHashTable *buddies; /**< Every buddy in this list */
150 struct gaim_blist_ui_ops *ui_ops; /**< The UI operations for the buddy list */ 156 GaimBlistUiOps *ui_ops; /**< The UI operations for the buddy list */
151 157
152 void *ui_data; /**< UI-specific data. */ 158 void *ui_data; /**< UI-specific data. */
153 }; 159 };
154 160
155 /** 161 /**
156 * Buddy list UI operations. 162 * Buddy list UI operations.
157 * 163 *
158 * Any UI representing a buddy list must assign a filled-out gaim_window_ops 164 * Any UI representing a buddy list must assign a filled-out gaim_window_ops
159 * structure to the buddy list core. 165 * structure to the buddy list core.
160 */ 166 */
161 struct gaim_blist_ui_ops 167 struct _GaimBlistUiOps
162 { 168 {
163 void (*new_list)(struct gaim_buddy_list *list); /**< Sets UI-specific data on a buddy list. */ 169 void (*new_list)(GaimBuddyList *list); /**< Sets UI-specific data on a buddy list. */
164 void (*new_node)(GaimBlistNode *node); /**< Sets UI-specific data on a node. */ 170 void (*new_node)(GaimBlistNode *node); /**< Sets UI-specific data on a node. */
165 void (*show)(struct gaim_buddy_list *list); /**< The core will call this when its finished doing it's core stuff */ 171 void (*show)(GaimBuddyList *list); /**< The core will call this when its finished doing it's core stuff */
166 void (*update)(struct gaim_buddy_list *list, 172 void (*update)(GaimBuddyList *list,
167 GaimBlistNode *node); /**< This will update a node in the buddy list. */ 173 GaimBlistNode *node); /**< This will update a node in the buddy list. */
168 void (*remove)(struct gaim_buddy_list *list, 174 void (*remove)(GaimBuddyList *list,
169 GaimBlistNode *node); /**< This removes a node from the list */ 175 GaimBlistNode *node); /**< This removes a node from the list */
170 void (*destroy)(struct gaim_buddy_list *list); /**< When the list gets destroyed, this gets called to destroy the UI. */ 176 void (*destroy)(GaimBuddyList *list); /**< When the list gets destroyed, this gets called to destroy the UI. */
171 void (*set_visible)(struct gaim_buddy_list *list, 177 void (*set_visible)(GaimBuddyList *list,
172 gboolean show); /**< Hides or unhides the buddy list */ 178 gboolean show); /**< Hides or unhides the buddy list */
173 void (*request_add_buddy)(GaimAccount *account, const char *username, 179 void (*request_add_buddy)(GaimAccount *account, const char *username,
174 const char *group, const char *alias); 180 const char *group, const char *alias);
175 void (*request_add_chat)(GaimAccount *account, GaimGroup *group); 181 void (*request_add_chat)(GaimAccount *account, GaimGroup *group);
176 void (*request_add_group)(void); 182 void (*request_add_group)(void);
186 /*@{*/ 192 /*@{*/
187 193
188 /** 194 /**
189 * Creates a new buddy list 195 * Creates a new buddy list
190 */ 196 */
191 struct gaim_buddy_list *gaim_blist_new(); 197 GaimBuddyList *gaim_blist_new();
192 198
193 /** 199 /**
194 * Sets the main buddy list. 200 * Sets the main buddy list.
195 * 201 *
196 * @return The main buddy list. 202 * @return The main buddy list.
197 */ 203 */
198 void gaim_set_blist(struct gaim_buddy_list *blist); 204 void gaim_set_blist(GaimBuddyList *blist);
199 205
200 /** 206 /**
201 * Returns the main buddy list. 207 * Returns the main buddy list.
202 * 208 *
203 * @return The main buddy list. 209 * @return The main buddy list.
204 */ 210 */
205 struct gaim_buddy_list *gaim_get_blist(void); 211 GaimBuddyList *gaim_get_blist(void);
206 212
207 /** 213 /**
208 * Shows the buddy list, creating a new one if necessary. 214 * Shows the buddy list, creating a new one if necessary.
209 * 215 *
210 */ 216 */
763 /** 769 /**
764 * Sets the UI operations structure to be used for the buddy list. 770 * Sets the UI operations structure to be used for the buddy list.
765 * 771 *
766 * @param ops The ops struct. 772 * @param ops The ops struct.
767 */ 773 */
768 void gaim_blist_set_ui_ops(struct gaim_blist_ui_ops *ops); 774 void gaim_blist_set_ui_ops(GaimBlistUiOps *ops);
769 775
770 /** 776 /**
771 * Returns the UI operations structure to be used for the buddy list. 777 * Returns the UI operations structure to be used for the buddy list.
772 * 778 *
773 * @return The UI operations structure. 779 * @return The UI operations structure.
774 */ 780 */
775 struct gaim_blist_ui_ops *gaim_blist_get_ui_ops(void); 781 GaimBlistUiOps *gaim_blist_get_ui_ops(void);
776 782
777 /*@}*/ 783 /*@}*/
778 784
779 /**************************************************************************/ 785 /**************************************************************************/
780 /** @name Buddy List Subsystem */ 786 /** @name Buddy List Subsystem */