diff src/protocols/napster/napster.c @ 10869:3e43c132f151

[gaim-migrate @ 12556] We no longer call "serv_add_buddies" at log in. Any PRPL that relied on that should look through the buddy list itself and do whatever it needs to after calling gaim_connection_set_state(gc, GAIM_CONNECTED); committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 25 Apr 2005 03:55:11 +0000
parents c94f40ffcafb
children 83e119608cb5
line wrap: on
line diff
--- a/src/protocols/napster/napster.c	Mon Apr 25 03:41:16 2005 +0000
+++ b/src/protocols/napster/napster.c	Mon Apr 25 03:55:11 2005 +0000
@@ -147,12 +147,31 @@
 }
 
 /* 208 - MSG_CLIENT_ADD_HOTLIST_SEQ */
-static void nap_add_buddies(GaimConnection *gc, GList *buddies, GList *groups)
+static void nap_send_buddylist(GaimConnection *gc)
 {
-	while (buddies) {
-		GaimBuddy *buddy = buddies->data;
-		nap_write_packet(gc, 208, "%s", buddy->name);
-		buddies = buddies->next;
+	GaimBuddyList *blist;
+	GaimBlistNode *gnode, *cnode, *bnode;
+	GaimBuddy *buddy;
+
+	if ((blist = gaim_get_blist()) != NULL)
+	{
+		for (gnode = blist->root; gnode != NULL; gnode = gnode->next)
+		{
+			if (!GAIM_BLIST_NODE_IS_GROUP(gnode))
+				continue;
+			for (cnode = gnode->child; cnode != NULL; cnode = cnode->next)
+			{
+				if (!GAIM_BLIST_NODE_IS_CONTACT(cnode))
+					continue;
+				for (bnode = cnode->child; bnode != NULL; bnode = bnode->next)
+				{
+					if (!GAIM_BLIST_NODE_IS_BUDDY(bnode))
+						continue;
+					buddy = (GaimBuddy *)bnode;
+					nap_write_packet(gc, 208, "%s", buddy->name);
+				}
+			}
+		}
 	}
 }
 
@@ -278,6 +297,9 @@
 		/* Our signon is complete */
 		gaim_connection_set_state(gc, GAIM_CONNECTED);
 
+		/* Send the server our buddy list */
+		nap_send_buddylist(gc);
+
 		break;
 
 	case 201: /* MSG_SERVER_SEARCH_RESULT */
@@ -609,7 +631,7 @@
 	NULL,					/* set_idle */
 	NULL,					/* change_passwd */
 	nap_add_buddy,			/* add_buddy */
-	nap_add_buddies,		/* add_buddies */
+	NULL,					/* add_buddies */
 	nap_remove_buddy,		/* remove_buddy */
 	NULL,					/* remove_buddies */
 	NULL,					/* add_permit */