gobjectification: 631ab1d4: Set the group a buddy belongs to when cr...

sadrul at pidgin.im sadrul at pidgin.im
Tue Jul 6 17:20:29 EDT 2010


----------------------------------------------------------------------
Revision: 631ab1d4340a9fc22d5746ab480d206556388df3
Parent:   409db48a5f0d903cec6ff1bfbdc7aba4b83fe09d
Author:   sadrul at pidgin.im
Date:     07/06/10 15:30:36
Branch:   im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/631ab1d4340a9fc22d5746ab480d206556388df3

Changelog: 

Set the group a buddy belongs to when creating the buddy.

Changes against parent 409db48a5f0d903cec6ff1bfbdc7aba4b83fe09d

  patched  libpurple/protocols/bonjour/buddy.c
  patched  libpurple/protocols/gg/buddylist.c
  patched  libpurple/protocols/jabber/roster.c
  patched  libpurple/protocols/msn/user.c
  patched  libpurple/protocols/mxit/roster.c
  patched  libpurple/protocols/myspace/myspace.c
  patched  libpurple/protocols/novell/novell.c
  patched  libpurple/protocols/oscar/oscar.c
  patched  libpurple/protocols/yahoo/libymsg.c
  patched  libpurple/protocols/zephyr/zephyr.c

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	3d48e750baba3e8a1556b88af815d993cf034d8f
+++ libpurple/protocols/oscar/oscar.c	f2e8f4f51f5cf0a5ee02206d6387fabf3a0590fb
@@ -5340,11 +5340,10 @@ static int purple_ssi_parselist(OscarDat
 						/* Get server stored alias */
 						purple_buddy_set_alias(b, alias_utf8);
 					} else {
-						b = purple_buddy_new(account, curitem->name, alias_utf8);
+						b = purple_buddy_new(account, curitem->name, alias_utf8, PURPLE_BLIST_NODE(g));
 
 						purple_debug_info("oscar",
 								   "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname);
-						purple_blist_node_add_child(PURPLE_BLIST_NODE(g), PURPLE_BLIST_NODE(b));
 					}
 					if (!oscar_util_name_compare(curitem->name, purple_account_get_username(account))) {
 						char *comment = aim_ssi_getcomment(od->ssi.local, gname, curitem->name);
@@ -5573,13 +5572,11 @@ purple_ssi_parseaddmod(OscarData *od, Fl
 		 * You're logged in somewhere else and you added a buddy to
 		 * your server list, so add them to your local buddy list.
 		 */
-		b = purple_buddy_new(account, name, alias_utf8);
-
 		g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
+		b = purple_buddy_new(account, name, alias_utf8, PURPLE_BLIST_NODE(g));
 
 		purple_debug_info("oscar",
 				   "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans"));
-		purple_blist_node_add_child(PURPLE_BLIST_NODE(g), PURPLE_BLIST_NODE(b));
 
 		/* Mobile users should always be online */
 		if (name[0] == '+') {
============================================================
--- libpurple/protocols/zephyr/zephyr.c	f8a9412e17cff097970876e08c1f3736b8e604a0
+++ libpurple/protocols/zephyr/zephyr.c	a7352985056139188ec8b4178006b7b37c08ac27
@@ -1515,8 +1515,8 @@ static void process_anyone(PurpleConnect
 					char *stripped_user = zephyr_strip_local_realm(purple_object_get_protocol_data(PURPLE_OBJECT(gc)),buff);
 					purple_debug_info("zephyr","stripped_user %s\n",stripped_user);
 					if (!(b = purple_find_buddy(purple_connection_get_account(gc),stripped_user))){
-						b = purple_buddy_new(purple_connection_get_account(gc), stripped_user, NULL);
-						purple_blist_node_add_child(PURPLE_BLIST_NODE(g), PURPLE_BLIST_NODE(b));
+						b = purple_buddy_new(purple_connection_get_account(gc), stripped_user,
+								NULL, PURPLE_BLIST_NODE(g));
 					}
 					g_free(stripped_user);
 				}
============================================================
--- libpurple/protocols/yahoo/libymsg.c	fa7a39b85753182c23e26942b32999c419aa6dda
+++ libpurple/protocols/yahoo/libymsg.c	095325b31cd189c70c17cb8501917aaa1186c9b0
@@ -428,8 +428,7 @@ static void yahoo_do_group_check(PurpleA
 		purple_debug_misc("yahoo",
 			"Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group);
 		g = purple_group_new(group);
-		b = purple_buddy_new(account, name, NULL);
-		purple_blist_node_add_child(PURPLE_BLIST_NODE(g), PURPLE_BLIST_NODE(b));
+		b = purple_buddy_new(account, name, NULL, PURPLE_BLIST_NODE(g));
 	}
 
 	if (list) {
@@ -551,8 +550,7 @@ static void yahoo_process_list_15(Purple
 					f = yahoo_friend_find_or_new(gc, norm_bud);
 					if (!(b = purple_find_buddy(account, norm_bud))) {
 						g = purple_group_new(yd->current_list15_grp);
-						b = purple_buddy_new(account, norm_bud, NULL);
-						purple_blist_node_add_child(PURPLE_BLIST_NODE(g), PURPLE_BLIST_NODE(b));
+						b = purple_buddy_new(account, norm_bud, NULL, PURPLE_BLIST_NODE(g));
 					}
 					yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp);
 					if(fed) {
@@ -707,8 +705,7 @@ static void yahoo_process_list(PurpleCon
 
 				if (!(b = purple_find_buddy(account, norm_bud))) {
 					g = purple_group_new(grp);
-					b = purple_buddy_new(account, norm_bud, NULL);
-					purple_blist_node_add_child(PURPLE_BLIST_NODE(g), PURPLE_BLIST_NODE(b));
+					b = purple_buddy_new(account, norm_bud, NULL, PURPLE_BLIST_NODE(g));
 					export = TRUE;
 				}
 
============================================================
--- libpurple/protocols/msn/user.c	2b6eaff9edb848f075064ba0a69bc699ff6b0d8e
+++ libpurple/protocols/msn/user.c	a4e765fb592077fd0cf45f538c3a794bc095946b
@@ -276,10 +276,8 @@ msn_user_add_group_id(MsnUser *user, con
 
 	g = purple_group_new(group_name);
 	b = purple_find_buddy_in_group(account, passport, g);
-	if (b == NULL)
-	{
-		b = purple_buddy_new(account, passport, NULL);
-		purple_blist_node_add_child(PURPLE_BLIST_NODE(g), PURPLE_BLIST_NODE(b));
+	if (b == NULL) {
+		b = purple_buddy_new(account, passport, NULL, PURPLE_BLIST_NODE(g));
 	}
 	purple_buddy_set_protocol_data(b, user);
 	/*Update the blist Node info*/
============================================================
--- libpurple/protocols/jabber/roster.c	c866f8713e157ec797f3a78815b3de2734ddf8a1
+++ libpurple/protocols/jabber/roster.c	ab200b8c2c23d8a785f55f279a87ca369d9aa22d
@@ -172,10 +172,8 @@ static void add_purple_buddy_to_groups(J
 
 	while(groups) {
 		PurpleGroup *g = purple_group_new(groups->data);
-		PurpleBuddy *b = purple_buddy_new(account, jid, alias);
+		PurpleBuddy *b = purple_buddy_new(account, jid, alias, PURPLE_BLIST_NODE(g));
 
-		purple_blist_node_add_child(PURPLE_BLIST_NODE(g), PURPLE_BLIST_NODE(b));
-
 		g_free(groups->data);
 		groups = g_slist_delete_link(groups, groups);
 	}
============================================================
--- libpurple/protocols/novell/novell.c	f804b6697c7df6fa72c4f39022941650d429e6de
+++ libpurple/protocols/novell/novell.c	e3df0696296af3a8122d36c1fa4b64e78188944a
@@ -375,8 +375,7 @@ _create_contact_resp_cb(NMUser * user, N
 			/* Add it to the purple buddy list if it is not there */
 			buddy = purple_find_buddy_in_group(user->client_data, display_id, group);
 			if (buddy == NULL) {
-				buddy = purple_buddy_new(user->client_data, display_id, alias);
-				purple_blist_node_add_child(PURPLE_BLIST_NODE(group), PURPLE_BLIST_NODE(buddy));
+				buddy = purple_buddy_new(user->client_data, display_id, alias, PURPLE_BLIST_NODE(group));
 			}
 
 			/* Save the new buddy as part of the contact object */
@@ -1314,9 +1313,8 @@ _add_contacts_to_purple_blist(NMUser * u
 					/* Add it to the purple buddy list */
 					buddy = purple_buddy_new(user->client_data,
 										   name,
-										   nm_contact_get_display_name(contact));
-
-					purple_blist_node_add_child(PURPLE_BLIST_NODE(group), PURPLE_BLIST_NODE(buddy));
+										   nm_contact_get_display_name(contact),
+										   PURPLE_BLIST_NODE(group));
 				}
 
 				/* Set the initial status for the buddy */
============================================================
--- libpurple/protocols/gg/buddylist.c	8e2ebd50e2b07f93bfbbb562826491ffc4d73792
+++ libpurple/protocols/gg/buddylist.c	f3ba29412713a3feb78891c2d05689756b2b0f70
@@ -134,12 +134,12 @@ void ggp_buddylist_load(PurpleConnection
 			g_strfreev(group_tbl);
 		}
 
-		buddy = purple_buddy_new(purple_connection_get_account(gc), name,
-					 strlen(show) ? show : NULL);
+		group = purple_group_new(g);
 
-		group = purple_group_new(g);
+		buddy = purple_buddy_new(purple_connection_get_account(gc), name,
+					 strlen(show) ? show : NULL,
+					 PURPLE_BLIST_NODE(group));
 
-		purple_blist_node_add_child(PURPLE_BLIST_NODE(group), PURPLE_BLIST_NODE(buddy));
 		g_free(g);
 
 		g_strfreev(data_tbl);
============================================================
--- libpurple/protocols/bonjour/buddy.c	ae93e007a7b993634b1a6571998dfa13172c5e80
+++ libpurple/protocols/bonjour/buddy.c	3b54a7a96c684c6cdd369a7110681818984d833d
@@ -148,9 +148,8 @@ bonjour_buddy_add_to_purple(BonjourBuddy
 		buddy = purple_find_buddy(account, bonjour_buddy->name);
 
 	if (buddy == NULL) {
-		buddy = purple_buddy_new(account, bonjour_buddy->name, NULL);
+		buddy = purple_buddy_new(account, bonjour_buddy->name, NULL, PURPLE_BLIST_NODE(group));
 		purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE);
-		purple_blist_node_add_child(PURPLE_BLIST_NODE(group), PURPLE_BLIST_NODE(buddy));
 	}
 
 	name = purple_buddy_get_name(buddy);
============================================================
--- libpurple/protocols/myspace/myspace.c	04622e15d9b805730915763217ea97756f8b4418
+++ libpurple/protocols/myspace/myspace.c	e402e5a2c3f0983ba8b4efcf7986ac245d1de5e3
@@ -1032,15 +1032,14 @@ msim_add_contact_from_server_cb(MsimSess
 	}
 
 	/* 2. Get or create buddy */
-	buddy = purple_find_buddy(session->account, username);
+	buddy = purple_find_buddy_in_group(session->account, username, group);
 	if (!buddy) {
 		purple_debug_info("msim_add_contact_from_server_cb",
 				"creating new buddy: %s\n", username);
-		buddy = purple_buddy_new(session->account, username, NULL);
+		buddy = purple_buddy_new(session->account, username, NULL, PURPLE_BLIST_NODE(group));
 	}
 
 	/* TODO: use 'Position' in contact_info to take into account where buddy is */
-	purple_blist_node_add_child(PURPLE_BLIST_NODE(group), PURPLE_BLIST_NODE(buddy));
 
 	if (strtol(username, NULL, 10) == uid) {
 		/*
@@ -1391,8 +1390,8 @@ msim_incoming_status(MsimSession *sessio
 
 		purple_debug_info("msim",
 				"msim_status: making new buddy for %s\n", username);
-		buddy = purple_buddy_new(session->account, username, NULL);
-		purple_blist_add_buddy(buddy, NULL, NULL, NULL);
+		buddy = purple_buddy_new(session->account, username, NULL,
+				PURPLE_BLIST_NODE(purple_group_new(_("Buddies"))));
 
 		user = msim_get_user_from_buddy(buddy, TRUE);
 		user->id = msim_msg_get_integer(msg, "f");
============================================================
--- libpurple/protocols/mxit/roster.c	9c03d3ab7162301d49ccfbdb6d9a4c1b2e25ad56
+++ libpurple/protocols/mxit/roster.c	f739d286de59e5243499237871466fbf7203fc18
@@ -378,11 +378,8 @@ void mxit_update_contact( struct MXitSes
 		}
 
 		/* create new buddy */
-		buddy = purple_buddy_new( session->acc, contact->username, contact->alias );
+		buddy = purple_buddy_new( session->acc, contact->username, contact->alias, PURPLE_BLIST_NODE(group) );
 		purple_buddy_set_protocol_data(buddy, contact);
-
-		/* add new buddy to list */
-		purple_blist_node_add_child(PURPLE_BLIST_NODE(group), PURPLE_BLIST_NODE(buddy));
 	}
 	else {
 		/* buddy was found in the group */


More information about the Commits mailing list