changeset 5394:08a90a9e28e4

[gaim-migrate @ 5770] I think maybe this will fix the group counts better... committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 16 May 2003 04:30:12 +0000
parents ec16a766cdc6
children e29ae53b744a
files src/blist.c
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.c	Fri May 16 03:59:46 2003 +0000
+++ b/src/blist.c	Fri May 16 04:30:12 2003 +0000
@@ -184,8 +184,7 @@
 		buddy->present = GAIM_BUDDY_SIGNING_OFF;
 		gaim_event_broadcast(event_buddy_signoff, buddy->account->gc, buddy->name);
 		do_timer = TRUE;
-		if( ((struct group *)((GaimBlistNode *)buddy)->parent)->online > 0)
-			((struct group *)((GaimBlistNode *)buddy)->parent)->online--;
+		((struct group *)((GaimBlistNode *)buddy)->parent)->online--;
 	}
 
 	if(do_timer) {
@@ -451,11 +450,10 @@
 		/* This buddy was already in the list and is
 		 * being moved.
 		 */
-		if( ((struct group *)bnode->parent)->totalsize > 0)
-			((struct group *)bnode->parent)->totalsize--;
-		if (buddy->account->gc && ( ((struct group*)bnode->parent)->currentsize > 0) )
+		((struct group *)bnode->parent)->totalsize--;
+		if (buddy->account->gc)
 			((struct group *)bnode->parent)->currentsize--;
-		if (buddy->present && ( ((struct group *)bnode->parent)->online > 0) )
+		if (GAIM_BUDDY_IS_ONLINE(buddy))
 			((struct group *)bnode->parent)->online--;
 
 		if(bnode->next)
@@ -483,7 +481,7 @@
 		((struct group *)n->parent)->totalsize++;
 		if (buddy->account->gc)
 			((struct group *)n->parent)->currentsize++;
-		if (buddy->present)
+		if (GAIM_BUDDY_IS_ONLINE(buddy))
 			((struct group *)n->parent)->online++;
 	} else {
 		((GaimBlistNode*)g)->child = (GaimBlistNode*)buddy;
@@ -493,7 +491,7 @@
 		g->totalsize++;
 		if (buddy->account->gc)
 			g->currentsize++;
-		if (buddy->present)
+		if (GAIM_BUDDY_IS_ONLINE(buddy))
 			g->online++;
 	}
 
@@ -609,10 +607,11 @@
 		node->prev->next = node->next;
 	if (node->next)
 		node->next->prev = node->prev;
-	if(group->totalsize >0)
-		group->totalsize--;
-	if (buddy->account->gc && group->currentsize > 0)
+	group->totalsize--;
+	if (buddy->account->gc)
 		group->currentsize--;
+	if (GAIM_BUDDY_IS_ONLINE(buddy))
+		group->online--;
 
 	hb.name = normalize(buddy->name);
 	hb.account = buddy->account;
@@ -649,8 +648,10 @@
 	if (node->next)
 		node->next->prev = node->prev;
 	group->totalsize--;
-	if (chat->account->gc)
+	if (chat->account->gc) {
 		group->currentsize--;
+		group->online--;
+	}
 
 	ops->remove(gaimbuddylist, node);
 	g_hash_table_destroy(chat->components);
@@ -805,11 +806,10 @@
 		for(buddy = group->child; buddy; buddy = buddy->next) {
 			if(GAIM_BLIST_NODE_IS_BUDDY(buddy)) {
 				if (account == ((struct buddy*)buddy)->account) {
-					if (((struct buddy *)buddy)->present > 0)
+					if (GAIM_BUDDY_IS_ONLINE((struct buddy*)buddy))
 						((struct group *)group)->online--;
 					((struct buddy*)buddy)->present = GAIM_BUDDY_OFFLINE;
-					if ( ((struct group*)buddy->parent)->currentsize > 0)
-						((struct group *)group)->currentsize--;
+					((struct group *)group)->currentsize--;
 					if(ops)
 						ops->remove(gaimbuddylist, buddy);
 				}