| 87 *****************************************************************************/ |
87 *****************************************************************************/ |
| 88 |
88 |
| 89 struct gaim_buddy_list *gaim_blist_new() |
89 struct gaim_buddy_list *gaim_blist_new() |
| 90 { |
90 { |
| 91 struct gaim_buddy_list *gbl = g_new0(struct gaim_buddy_list, 1); |
91 struct gaim_buddy_list *gbl = g_new0(struct gaim_buddy_list, 1); |
| 92 gbl->ui_ops = blist_ui_ops; |
92 |
| |
93 gbl->ui_ops = gaim_get_blist_ui_ops(); |
| |
94 |
| |
95 if (gbl->ui_ops != NULL && gbl->ui_ops->new_list != NULL) |
| |
96 gbl->ui_ops->new_list(gbl); |
| |
97 |
| 93 return gbl; |
98 return gbl; |
| |
99 } |
| |
100 |
| |
101 void |
| |
102 gaim_set_blist(struct gaim_buddy_list *list) |
| |
103 { |
| |
104 gaimbuddylist = list; |
| |
105 } |
| |
106 |
| |
107 struct gaim_buddy_list * |
| |
108 gaim_get_blist(void) |
| |
109 { |
| |
110 return gaimbuddylist; |
| 94 } |
111 } |
| 95 |
112 |
| 96 void gaim_blist_show () |
113 void gaim_blist_show () |
| 97 { |
114 { |
| 98 struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; |
115 struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; |
| 171 if (ops) |
188 if (ops) |
| 172 ops->update(gaimbuddylist, (GaimBlistNode*)group); |
189 ops->update(gaimbuddylist, (GaimBlistNode*)group); |
| 173 } |
190 } |
| 174 struct buddy *gaim_buddy_new(struct gaim_account *account, const char *screenname, const char *alias) |
191 struct buddy *gaim_buddy_new(struct gaim_account *account, const char *screenname, const char *alias) |
| 175 { |
192 { |
| 176 struct buddy *b = g_new0(struct buddy, 1); |
193 struct buddy *b; |
| |
194 struct gaim_blist_ui_ops *ops; |
| |
195 |
| |
196 b = g_new0(struct buddy, 1); |
| 177 b->account = account; |
197 b->account = account; |
| 178 b->name = g_strdup(screenname); |
198 b->name = g_strdup(screenname); |
| 179 b->alias = g_strdup(alias); |
199 b->alias = g_strdup(alias); |
| 180 b->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
200 b->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
| 181 ((GaimBlistNode*)b)->type = GAIM_BLIST_BUDDY_NODE; |
201 ((GaimBlistNode*)b)->type = GAIM_BLIST_BUDDY_NODE; |
| |
202 |
| |
203 ops = gaim_get_blist_ui_ops(); |
| |
204 |
| |
205 if (ops != NULL && ops->new_node != NULL) |
| |
206 ops->new_node((GaimBlistNode *)b); |
| 182 |
207 |
| 183 return b; |
208 return b; |
| 184 } |
209 } |
| 185 void gaim_blist_add_buddy (struct buddy *buddy, struct group *group, GaimBlistNode *node) |
210 void gaim_blist_add_buddy (struct buddy *buddy, struct group *group, GaimBlistNode *node) |
| 186 { |
211 { |
| 222 } |
247 } |
| 223 |
248 |
| 224 struct group *gaim_group_new(const char *name) |
249 struct group *gaim_group_new(const char *name) |
| 225 { |
250 { |
| 226 struct group *g = gaim_find_group(name); |
251 struct group *g = gaim_find_group(name); |
| |
252 |
| 227 if (!g) { |
253 if (!g) { |
| |
254 struct gaim_blist_ui_ops *ops; |
| 228 g= g_new0(struct group, 1); |
255 g= g_new0(struct group, 1); |
| 229 g->name = g_strdup(name); |
256 g->name = g_strdup(name); |
| 230 ((GaimBlistNode*)g)->type = GAIM_BLIST_GROUP_NODE; |
257 ((GaimBlistNode*)g)->type = GAIM_BLIST_GROUP_NODE; |
| |
258 |
| |
259 ops = gaim_get_blist_ui_ops(); |
| |
260 |
| |
261 if (ops != NULL && ops->new_node != NULL) |
| |
262 ops->new_node((GaimBlistNode *)g); |
| 231 |
263 |
| 232 } |
264 } |
| 233 return g; |
265 return g; |
| 234 } |
266 } |
| 235 |
267 |