changeset 22986:493239b86bf6

When defaulting a group, don't move it to the bottom if it exists.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 16 May 2008 21:00:26 +0000
parents 882af25a8edf
children 5cbd119b26af
files libpurple/blist.c
diffstat 1 files changed, 14 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/blist.c	Fri May 16 20:47:28 2008 +0000
+++ b/libpurple/blist.c	Fri May 16 21:00:26 2008 +0000
@@ -1233,16 +1233,13 @@
 	g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT((PurpleBlistNode *)chat));
 
 	if (node == NULL) {
-		if (group == NULL) {
+		if (group == NULL)
 			group = purple_group_new(_("Chats"));
+
+		/* Add group to blist if isn't already on it. Fixes #2752. */
+		if (!purple_find_group(group->name)) {
 			purple_blist_add_group(group,
 					purple_blist_get_last_sibling(purplebuddylist->root));
-		} else {
-			/* Add group to blist if isn't already on it. Fixes #2752. */
-			if (!purple_find_group(group->name)) {
-				purple_blist_add_group(group,
-						purple_blist_get_last_sibling(purplebuddylist->root));
-			}
 		}
 	} else {
 		group = (PurpleGroup*)node->parent;
@@ -1336,16 +1333,11 @@
 		c = contact;
 		g = (PurpleGroup *)((PurpleBlistNode *)c)->parent;
 	} else {
-		if (group) {
-			/* Add group to blist if isn't already on it. Fixes #2752. */
-			if (!purple_find_group(group->name)) {
-				purple_blist_add_group(group,
-						purple_blist_get_last_sibling(purplebuddylist->root));
-			}
-
-			g = group;
-		} else {
+		g = group;
+		if (g == NULL)
 			g = purple_group_new(_("Buddies"));
+		/* Add group to blist if isn't already on it. Fixes #2752. */
+		if (!purple_find_group(g->name)) {
 			purple_blist_add_group(g,
 					purple_blist_get_last_sibling(purplebuddylist->root));
 		}
@@ -1555,9 +1547,12 @@
 	else if (group)
 		g = group;
 	else {
-		g = purple_group_new(_("Buddies"));
-		purple_blist_add_group(g,
-				purple_blist_get_last_sibling(purplebuddylist->root));
+		g = purple_find_group(_("Buddies"));
+		if (g == NULL) {
+			g = purple_group_new(_("Buddies"));
+			purple_blist_add_group(g,
+					purple_blist_get_last_sibling(purplebuddylist->root));
+		}
 	}
 
 	gnode = (PurpleBlistNode*)g;