comparison libpurple/account.c @ 25808:5ebfa814b9e8

Finish off the libpurple updates for the hidden blist structs
author Gary Kramlich <grim@reaperworld.com>
date Sun, 02 Nov 2008 10:54:00 +0000
parents 8282911d5e17
children 41485746e2b9
comparison
equal deleted inserted replaced
25807:e35115192593 25808:5ebfa814b9e8
2247 GList *cur, *groups = NULL; 2247 GList *cur, *groups = NULL;
2248 2248
2249 /* Make a list of what group each buddy is in */ 2249 /* Make a list of what group each buddy is in */
2250 for (cur = buddies; cur != NULL; cur = cur->next) { 2250 for (cur = buddies; cur != NULL; cur = cur->next) {
2251 PurpleBlistNode *node = cur->data; 2251 PurpleBlistNode *node = cur->data;
2252 groups = g_list_append(groups, node->parent->parent); 2252 PurpleBlistNode *parent = purple_blist_node_get_parent(node);
2253 PurpleBlistNode *gparent = purple_blist_node_get_parent(parent);
2254 groups = g_list_append(groups, gparent);
2253 } 2255 }
2254 2256
2255 if (prpl_info->add_buddies != NULL) 2257 if (prpl_info->add_buddies != NULL)
2256 prpl_info->add_buddies(gc, buddies, groups); 2258 prpl_info->add_buddies(gc, buddies, groups);
2257 else if (prpl_info->add_buddy != NULL) { 2259 else if (prpl_info->add_buddy != NULL) {
2497 purple_request_close_with_handle(account); 2499 purple_request_close_with_handle(account);
2498 2500
2499 purple_accounts_remove(account); 2501 purple_accounts_remove(account);
2500 2502
2501 /* Remove this account's buddies */ 2503 /* Remove this account's buddies */
2502 for (gnode = purple_get_blist()->root; gnode != NULL; gnode = gnode->next) { 2504 for (gnode = purple_blist_get_root();
2505 gnode != NULL;
2506 gnode = purple_blist_node_get_sibling_next(gnode))
2507 {
2503 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) 2508 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode))
2504 continue; 2509 continue;
2505 2510
2506 cnode = gnode->child; 2511 cnode = purple_blist_node_get_first_child(gnode);
2507 while (cnode) { 2512 while (cnode) {
2508 PurpleBlistNode *cnode_next = cnode->next; 2513 PurpleBlistNode *cnode_next = purple_blist_node_get_sibling_next(cnode);
2509 2514
2510 if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { 2515 if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
2511 bnode = cnode->child; 2516 bnode = purple_blist_node_get_first_child(cnode);
2512 while (bnode) { 2517 while (bnode) {
2513 PurpleBlistNode *bnode_next = bnode->next; 2518 PurpleBlistNode *bnode_next = purple_blist_node_get_sibling_next(bnode);
2514 2519
2515 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) { 2520 if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) {
2516 PurpleBuddy *b = (PurpleBuddy *)bnode; 2521 PurpleBuddy *b = (PurpleBuddy *)bnode;
2517 2522
2518 if (b->account == account) 2523 if (purple_buddy_get_account(b) == account)
2519 purple_blist_remove_buddy(b); 2524 purple_blist_remove_buddy(b);
2520 } 2525 }
2521 bnode = bnode_next; 2526 bnode = bnode_next;
2522 } 2527 }
2523 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { 2528 } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) {
2524 PurpleChat *c = (PurpleChat *)cnode; 2529 PurpleChat *c = (PurpleChat *)cnode;
2525 2530
2526 if (c->account == account) 2531 if (purple_chat_get_account(c) == account)
2527 purple_blist_remove_chat(c); 2532 purple_blist_remove_chat(c);
2528 } 2533 }
2529 cnode = cnode_next; 2534 cnode = cnode_next;
2530 } 2535 }
2531 } 2536 }