changeset 5855:082982a4acbd

[gaim-migrate @ 6286] ok, this will get rid of the negative group counts for trepia, and also fixes the accounts dialog so signing off of an account leaves it signed off committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 13 Jun 2003 17:55:02 +0000
parents 14891982dbee
children a479e218c54b
files src/blist.c src/gtkaccount.c src/protocols/trepia/trepia.c
diffstat 3 files changed, 28 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.c	Fri Jun 13 16:49:00 2003 +0000
+++ b/src/blist.c	Fri Jun 13 17:55:02 2003 +0000
@@ -383,7 +383,7 @@
 		 * being moved.
 		 */
 		((struct group *)cnode->parent)->totalsize--;
-		if (chat->account->gc) {
+		if (gaim_account_is_connected(chat->account)) {
 			((struct group *)cnode->parent)->online--;
 			((struct group *)cnode->parent)->currentsize--;
 		}
@@ -407,7 +407,7 @@
 		cnode->parent = n->parent;
 		n->next = cnode;
 		((struct group *)n->parent)->totalsize++;
-		if (chat->account->gc) {
+		if (gaim_account_is_connected(chat->account)) {
 			((struct group *)n->parent)->online++;
 			((struct group *)n->parent)->currentsize++;
 		}
@@ -419,7 +419,7 @@
 		((GaimBlistNode*)g)->child = cnode;
 		cnode->parent = (GaimBlistNode*)g;
 		g->totalsize++;
-		if (chat->account->gc) {
+		if (gaim_account_is_connected(chat->account)) {
 			g->online++;
 			g->currentsize++;
 		}
@@ -458,7 +458,7 @@
 		 * being moved.
 		 */
 		((struct group *)bnode->parent)->totalsize--;
-		if (buddy->account->gc)
+		if (gaim_account_is_connected(buddy->account))
 			((struct group *)bnode->parent)->currentsize--;
 		if (GAIM_BUDDY_IS_ONLINE(buddy))
 			((struct group *)bnode->parent)->online--;
@@ -486,7 +486,7 @@
 		((GaimBlistNode*)buddy)->parent = n->parent;
 		n->next = (GaimBlistNode*)buddy;
 		((struct group *)n->parent)->totalsize++;
-		if (buddy->account->gc)
+		if (gaim_account_is_connected(buddy->account))
 			((struct group *)n->parent)->currentsize++;
 		if (GAIM_BUDDY_IS_ONLINE(buddy))
 			((struct group *)n->parent)->online++;
@@ -498,7 +498,7 @@
 		((GaimBlistNode*)g)->child = (GaimBlistNode*)buddy;
 		((GaimBlistNode*)buddy)->parent = (GaimBlistNode*)g;
 		g->totalsize++;
-		if (buddy->account->gc)
+		if (gaim_account_is_connected(buddy->account))
 			g->currentsize++;
 		if (GAIM_BUDDY_IS_ONLINE(buddy))
 			g->online++;
@@ -623,7 +623,7 @@
 	if (node->next)
 		node->next->prev = node->prev;
 	group->totalsize--;
-	if (buddy->account->gc)
+	if (gaim_account_is_connected(buddy->account))
 		group->currentsize--;
 	if (GAIM_BUDDY_IS_ONLINE(buddy))
 		group->online--;
@@ -664,7 +664,7 @@
 	if (node->next)
 		node->next->prev = node->prev;
 	group->totalsize--;
-	if (chat->account->gc) {
+	if (gaim_account_is_connected(chat->account)) {
 		group->currentsize--;
 		group->online--;
 	}
@@ -1236,7 +1236,8 @@
 		struct buddy *b = (struct buddy *)bnode;
 		if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
 			continue;
-		if((!account && b->account->gc) || b->account == account)
+		if((!account && gaim_account_is_connected(b->account))
+				|| b->account == account)
 			return TRUE;
 	}
 	return FALSE;
--- a/src/gtkaccount.c	Fri Jun 13 16:49:00 2003 +0000
+++ b/src/gtkaccount.c	Fri Jun 13 17:55:02 2003 +0000
@@ -1504,10 +1504,12 @@
 					   COLUMN_ONLINE, &online,
 					   -1);
 
-	if (online)
+	if (online) {
+		account->gc->wants_to_die = TRUE;
 		gaim_account_disconnect(account);
-	else
+	} else {
 		gaim_account_connect(account);
+	}
 }
 
 static void
--- a/src/protocols/trepia/trepia.c	Fri Jun 13 16:49:00 2003 +0000
+++ b/src/protocols/trepia/trepia.c	Fri Jun 13 17:55:02 2003 +0000
@@ -156,9 +156,20 @@
 static void
 __clear_user_list(TrepiaSession *session)
 {
-	gaim_debug(GAIM_DEBUG_INFO, "trepia", "Clearing user list\n");
-	g_hash_table_foreach(session->user_profiles, _remove_user_fnc, session);
-	gaim_debug(GAIM_DEBUG_INFO, "trepia", "Done clearing user list\n");
+	GaimBlistNode *gnode, *bnode;
+	for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
+		bnode = gnode->child;
+		while(bnode) {
+			struct buddy *buddy = (struct buddy *)bnode;
+			if(GAIM_BLIST_NODE_IS_BUDDY(bnode) &&
+					buddy->account == session->gc->account) {
+				bnode = bnode->next;
+				gaim_blist_remove_buddy(buddy);
+			} else {
+				bnode = bnode->next;
+			}
+		}
+	}
 }
 
 #if 0
@@ -1063,8 +1074,6 @@
 {
 	TrepiaSession *session = gc->proto_data;
 
-	__clear_user_list(session);
-
 	if (session->rxqueue != NULL)
 		g_string_free(session->rxqueue, TRUE);