comparison src/protocols/toc/toc.c @ 6695:0c5637b5462e

[gaim-migrate @ 7221] This is contact support. Really. It has a few bugs left in it, like sorting not working, and stuff like that, but it's pretty solid for the most part. I'm not in the mood to do a whole lot of typing, so just use and enjoy. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 02 Sep 2003 03:41:10 +0000
parents 156e6643f9db
children faa491042c66
comparison
equal deleted inserted replaced
6694:2d2f04c5c7d2 6695:0c5637b5462e
246 g_free(gc->proto_data); 246 g_free(gc->proto_data);
247 } 247 }
248 248
249 static void toc_build_config(GaimAccount *account, char *s, int len, gboolean show) 249 static void toc_build_config(GaimAccount *account, char *s, int len, gboolean show)
250 { 250 {
251 GaimBlistNode *gnode,*bnode; 251 GaimBlistNode *gnode, *cnode, *bnode;
252 struct group *g; 252 GaimGroup *g;
253 struct buddy *b; 253 GaimBuddy *b;
254 GSList *plist = account->permit; 254 GSList *plist = account->permit;
255 GSList *dlist = account->deny; 255 GSList *dlist = account->deny;
256 256
257 int pos = 0; 257 int pos = 0;
258 258
259 if (!account->perm_deny) 259 if (!account->perm_deny)
260 account->perm_deny = 1; 260 account->perm_deny = 1;
261 261
262 pos += g_snprintf(&s[pos], len - pos, "m %d\n", account->perm_deny); 262 pos += g_snprintf(&s[pos], len - pos, "m %d\n", account->perm_deny);
263 for(gnode = gaim_get_blist()->root; gnode && len > pos; gnode = gnode->next) { 263 for(gnode = gaim_get_blist()->root; gnode && len > pos; gnode = gnode->next) {
264 g = (struct group *)gnode; 264 g = (GaimGroup *)gnode;
265 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) 265 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
266 continue; 266 continue;
267 if(gaim_group_on_account(g, account)) { 267 if(gaim_group_on_account(g, account)) {
268 pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name); 268 pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name);
269 for(bnode = gnode->child; bnode && len > pos; bnode = bnode->next) { 269 for(cnode = gnode->child; cnode; cnode = cnode->next) {
270 b = (struct buddy *)bnode; 270 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode))
271 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
272 continue; 271 continue;
273 if(b->account == account) { 272 for(bnode = gnode->child; bnode && len > pos; bnode = bnode->next) {
274 pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name, 273 b = (GaimBuddy *)bnode;
275 (show && b->alias) ? ":" : "", 274 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
276 (show && b->alias) ? b->alias : ""); 275 continue;
276 if(b->account == account) {
277 pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n",
278 b->name,
279 (show && b->alias) ? ":" : "",
280 (show && b->alias) ? b->alias : "");
281 }
277 } 282 }
278 } 283 }
279 } 284 }
280 } 285 }
281 286
1330 static void toc_keepalive(GaimConnection *gc) 1335 static void toc_keepalive(GaimConnection *gc)
1331 { 1336 {
1332 sflap_send(gc, "", 0, TYPE_KEEPALIVE); 1337 sflap_send(gc, "", 0, TYPE_KEEPALIVE);
1333 } 1338 }
1334 1339
1335 static const char *toc_list_icon(GaimAccount *a, struct buddy *b) 1340 static const char *toc_list_icon(GaimAccount *a, GaimBuddy *b)
1336 { 1341 {
1337 if (!b || (b && b->name && b->name[0] == '+')) { 1342 if (!b || (b && b->name && b->name[0] == '+')) {
1338 if (a != NULL && isdigit(*gaim_account_get_username(a))) 1343 if (a != NULL && isdigit(*gaim_account_get_username(a)))
1339 return "icq"; 1344 return "icq";
1340 else 1345 else
1341 return "aim"; 1346 return "aim";
1342 } 1347 }
1343 1348
1344 if (b && b->name && isdigit(b->name[0])) 1349 if (b && b->name && isdigit(b->name[0]))
1345 return "icq"; 1350 return "icq";
1346 return "aim"; 1351 return "aim";
1347 } 1352 }
1348 1353
1349 static void toc_list_emblems(struct buddy *b, char **se, char **sw, char **nw, char **ne) 1354 static void toc_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne)
1350 { 1355 {
1351 char *emblems[4] = {NULL,NULL,NULL,NULL}; 1356 char *emblems[4] = {NULL,NULL,NULL,NULL};
1352 int i = 0; 1357 int i = 0;
1353 1358
1354 if (!GAIM_BUDDY_IS_ONLINE(b)) { 1359 if (!GAIM_BUDDY_IS_ONLINE(b)) {