changeset 11489:63e339161d83

[gaim-migrate @ 13731] Fix GaryBug#40 - IRC buddies never showed up except when first added committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 10 Sep 2005 17:30:21 +0000
parents 9c7ca8a8c4b8
children 1ae1454204cd
files src/protocols/irc/msgs.c
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/msgs.c	Sat Sep 10 17:28:04 2005 +0000
+++ b/src/protocols/irc/msgs.c	Sat Sep 10 17:30:21 2005 +0000
@@ -440,6 +440,7 @@
 void irc_msg_endmotd(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
 	GaimConnection *gc;
+	GaimBlistNode *gnode, *cnode, *bnode;
 
 	gc = gaim_account_get_connection(irc->account);
 	if (!gc)
@@ -447,6 +448,27 @@
 
 	gaim_connection_set_state(gc, GAIM_CONNECTED);
 
+	/* this used to be in the core, but it's not now */
+	for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) {
+		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
+			continue;
+		for(cnode = gnode->child; cnode; cnode = cnode->next) {
+			if(!GAIM_BLIST_NODE_IS_CONTACT(cnode))
+				continue;
+			for(bnode = cnode->child; bnode; bnode = bnode->next) {
+				GaimBuddy *b;
+				if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
+					continue;
+				b = (GaimBuddy *)bnode;
+				if(b->account == gc->account) {
+					struct irc_buddy *ib = g_new0(struct irc_buddy, 1);
+					ib->name = g_strdup(b->name);
+					g_hash_table_insert(irc->buddies, ib->name, ib);
+				}
+			}
+		}
+	}
+
 	irc_blist_timeout(irc);
 	if (!irc->timer)
 		irc->timer = gaim_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc);