Mercurial > pidgin
changeset 10726:00e3dc1a0206
[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 <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 25 Mar 2005 13:14:28 +0000 |
parents | de26e6e198a4 |
children | d07ebadef09d |
files | src/blist.c |
diffstat | 1 files changed, 37 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- 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); + } } } }