src/blist.c

changeset 5368
f6b3a132ea00
parent 5346
4be84db22956
child 5388
91ce746426cb
equal deleted inserted replaced
5367:a2f9e6418413 5368:f6b3a132ea00
182 ((struct group *)((GaimBlistNode *)buddy)->parent)->online++; 182 ((struct group *)((GaimBlistNode *)buddy)->parent)->online++;
183 } else if(GAIM_BUDDY_IS_ONLINE(buddy) && !presence) { 183 } else if(GAIM_BUDDY_IS_ONLINE(buddy) && !presence) {
184 buddy->present = GAIM_BUDDY_SIGNING_OFF; 184 buddy->present = GAIM_BUDDY_SIGNING_OFF;
185 gaim_event_broadcast(event_buddy_signoff, buddy->account->gc, buddy->name); 185 gaim_event_broadcast(event_buddy_signoff, buddy->account->gc, buddy->name);
186 do_timer = TRUE; 186 do_timer = TRUE;
187 ((struct group *)((GaimBlistNode *)buddy)->parent)->online--; 187 if( ((struct group *)((GaimBlistNode *)buddy)->parent)->online > 0)
188 ((struct group *)((GaimBlistNode *)buddy)->parent)->online--;
188 } 189 }
189 190
190 if(do_timer) { 191 if(do_timer) {
191 if(buddy->timer > 0) 192 if(buddy->timer > 0)
192 g_source_remove(buddy->timer); 193 g_source_remove(buddy->timer);
448 449
449 if (bnode->parent) { 450 if (bnode->parent) {
450 /* This buddy was already in the list and is 451 /* This buddy was already in the list and is
451 * being moved. 452 * being moved.
452 */ 453 */
453 ((struct group *)bnode->parent)->totalsize--; 454 if( ((struct group *)bnode->parent)->totalsize > 0)
454 if (buddy->account->gc) 455 ((struct group *)bnode->parent)->totalsize--;
456 if (buddy->account->gc && ( ((struct group*)bnode->parent)->currentsize > 0) )
455 ((struct group *)bnode->parent)->currentsize--; 457 ((struct group *)bnode->parent)->currentsize--;
456 if (buddy->present) 458 if (buddy->present && ( ((struct group *)bnode->parent)->online > 0) )
457 ((struct group *)bnode->parent)->online--; 459 ((struct group *)bnode->parent)->online--;
458 460
459 if(bnode->next) 461 if(bnode->next)
460 bnode->next->prev = bnode->prev; 462 bnode->next->prev = bnode->prev;
461 if(bnode->prev) 463 if(bnode->prev)
605 gnode->child = node->next; 607 gnode->child = node->next;
606 if (node->prev) 608 if (node->prev)
607 node->prev->next = node->next; 609 node->prev->next = node->next;
608 if (node->next) 610 if (node->next)
609 node->next->prev = node->prev; 611 node->next->prev = node->prev;
610 group->totalsize--; 612 if(group->totalsize >0)
611 if (buddy->account->gc) 613 group->totalsize--;
614 if (buddy->account->gc && group->currentsize > 0)
612 group->currentsize--; 615 group->currentsize--;
613 616
614 hb.name = normalize(buddy->name); 617 hb.name = normalize(buddy->name);
615 hb.account = buddy->account; 618 hb.account = buddy->account;
616 if (g_hash_table_lookup_extended(gaimbuddylist->buddies, &hb, (gpointer *)&key, (gpointer *)&val)) { 619 if (g_hash_table_lookup_extended(gaimbuddylist->buddies, &hb, (gpointer *)&key, (gpointer *)&val)) {
800 if(!GAIM_BLIST_NODE_IS_GROUP(group)) 803 if(!GAIM_BLIST_NODE_IS_GROUP(group))
801 continue; 804 continue;
802 for(buddy = group->child; buddy; buddy = buddy->next) { 805 for(buddy = group->child; buddy; buddy = buddy->next) {
803 if(GAIM_BLIST_NODE_IS_BUDDY(buddy)) { 806 if(GAIM_BLIST_NODE_IS_BUDDY(buddy)) {
804 if (account == ((struct buddy*)buddy)->account) { 807 if (account == ((struct buddy*)buddy)->account) {
805 if (((struct buddy *)buddy)->present) 808 if (((struct buddy *)buddy)->present > 0)
806 ((struct group *)group)->online--; 809 ((struct group *)group)->online--;
807 ((struct buddy*)buddy)->present = GAIM_BUDDY_OFFLINE; 810 ((struct buddy*)buddy)->present = GAIM_BUDDY_OFFLINE;
808 ((struct group *)group)->currentsize--; 811 if ( ((struct group*)buddy->parent)->currentsize > 0)
812 ((struct group *)group)->currentsize--;
809 if(ops) 813 if(ops)
810 ops->remove(gaimbuddylist, buddy); 814 ops->remove(gaimbuddylist, buddy);
811 } 815 }
812 } else if(GAIM_BLIST_NODE_IS_CHAT(buddy)) { 816 } else if(GAIM_BLIST_NODE_IS_CHAT(buddy)) {
813 if (account == ((struct chat*)buddy)->account) { 817 if (account == ((struct chat*)buddy)->account) {

mercurial