# HG changeset patch # User Luke Schierer # Date 1111756468 0 # Node ID 00e3dc1a0206c32ebdc447a52a13a9d14b5c1fd0 # Parent de26e6e198a46833f555af00ea260e44457e2520 [gaim-migrate @ 12326] " Correctly updates the group counts in HEAD when you sign off. I didn't do anything with current size since I'm not to familiar with the blist node stuff, but it does hide the groups now. I just updated the online member of the blistnode struct to reflect the account signing off." --grim committer: Tailor Script diff -r de26e6e198a4 -r 00e3dc1a0206 src/blist.c --- a/src/blist.c Fri Mar 25 13:13:16 2005 +0000 +++ b/src/blist.c Fri Mar 25 13:14:28 2005 +0000 @@ -2199,56 +2199,69 @@ { GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimBlistNode *gnode, *cnode, *bnode; + GaimBuddy *buddy; + GaimChat *chat; + GaimContact *contact; + GaimGroup *group; g_return_if_fail(gaimbuddylist != NULL); for (gnode = gaimbuddylist->root; gnode; gnode = gnode->next) { if (!GAIM_BLIST_NODE_IS_GROUP(gnode)) continue; + + group = (GaimGroup *)gnode; + for (cnode = gnode->child; cnode; cnode = cnode->next) { if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) { + contact = (GaimContact *)cnode; gboolean recompute = FALSE; + for (bnode = cnode->child; bnode; bnode = bnode->next) { if (!GAIM_BLIST_NODE_IS_BUDDY(bnode)) continue; - if (account == ((GaimBuddy *)bnode)->account) { + + buddy = (GaimBuddy *)bnode; + if (account == buddy->account) { GaimPresence *presence; recompute = TRUE; - if (((GaimBuddy*)bnode)->present == GAIM_BUDDY_ONLINE || - ((GaimBuddy*)bnode)->present == GAIM_BUDDY_SIGNING_ON) { - ((GaimContact*)cnode)->online--; - if (((GaimContact*)cnode)->online == 0) - ((GaimGroup*)gnode)->online--; - gaim_blist_node_set_int(&((GaimBuddy *)bnode)->node, + + presence = gaim_buddy_get_presence(buddy); + + if(!gaim_presence_is_online(presence)) { + contact->online--; + if (contact->online == 0) + group->online--; + + gaim_blist_node_set_int(&buddy->node, "last_seen", time(NULL)); } - ((GaimContact*)cnode)->currentsize--; - if (((GaimContact*)cnode)->currentsize == 0) - ((GaimGroup*)gnode)->currentsize--; - - ((GaimBuddy*)bnode)->present = GAIM_BUDDY_OFFLINE; - - presence = gaim_buddy_get_presence((GaimBuddy*)bnode); + + contact->online--; + if (contact->online == 0) + group->online--; + gaim_presence_set_status_active(presence, "offline", TRUE); - ((GaimBuddy*)bnode)->uc = 0; - /* TODO: ((GaimBuddy*)bnode)->idle = 0; */ - if (ops && ops->remove) ops->remove(gaimbuddylist, bnode); } } if (recompute) { - gaim_contact_invalidate_priority_buddy((GaimContact*)cnode); + gaim_contact_invalidate_priority_buddy(contact); if (ops && ops->update) ops->update(gaimbuddylist, cnode); } - } else if (GAIM_BLIST_NODE_IS_CHAT(cnode) && - ((GaimChat*)cnode)->account == account) { - ((GaimGroup*)gnode)->currentsize--; - ((GaimGroup*)gnode)->online--; - if (ops && ops->remove) - ops->remove(gaimbuddylist, cnode); + } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { + chat = (GaimChat *)cnode; + + if(chat->account == account) { + group->currentsize--; + group->online--; + + if (ops && ops->remove) + ops->remove(gaimbuddylist, cnode); + } } } }