changeset 22292:5aabf4e24188

In msimprpl, for server-side contacts, first search for an existing group on the client before creating one and adding it to the beginning of the list. If there is an existing group, use that. Fixes problem where MySpaceIM groups always move to the top of the buddy list upon sign-on, because they were always created anew. Closes #3378.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Thu, 14 Feb 2008 07:49:57 +0000
parents 5411ca13b878
children 626658db279d 33b5a0e92583
files libpurple/protocols/myspace/myspace.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Mon Feb 11 00:50:42 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Thu Feb 14 07:49:57 2008 +0000
@@ -2797,7 +2797,14 @@
 	 * the documentation claims). */
 	group_name = msim_msg_get_string(contact_info, "GroupName");
 	if (group_name) {
-		group = purple_group_new(group_name);
+		group = purple_find_group(group_name);
+		if (!group) {
+			group = purple_group_new(group_name);
+			/* Add group to beginning. See #2752. */
+			purple_blist_add_group(group, NULL);
+
+		}
+
 		purple_debug_info("msim_add_contact_from_server_cb",
 				"adding to GroupName: %s\n", group_name);
 		g_free(group_name);
@@ -2813,9 +2820,6 @@
 		buddy = purple_buddy_new(session->account, username, NULL);
 	}
 
-	/* Add group to beginning. See #2752. */
-	purple_blist_add_group(group, NULL);
-
 	/* TODO: use 'Position' in contact_info to take into account where buddy is */
 	purple_blist_add_buddy(buddy, NULL, group, NULL /* insertion point */);