changeset 19404:93dfc16efbda

If purple_blist_add_{chat,buddy} is called with a group or chat that isn't on the blist, add it at the beginning, similar to how we create and add a default group, if no group is given. Following discussion from http://pidgin.im/pipermail/devel/2007-August/002920.html on an earlier revision, fea00266488c85ba94e735d5885d991298e8f9d7.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Sat, 25 Aug 2007 05:40:12 +0000
parents fbdabdd3839a
children 4fced00fdc9f
files libpurple/blist.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/blist.c	Fri Aug 24 15:58:38 2007 +0000
+++ b/libpurple/blist.c	Sat Aug 25 05:40:12 2007 +0000
@@ -1191,8 +1191,11 @@
 			purple_blist_add_group(group,
 					purple_blist_get_last_sibling(purplebuddylist->root));
 		} else {
-			/* Fail if tried to add buddy to a group that isn't on the blist. #2752. */
-			g_return_if_fail(purple_find_group(group->name));
+			/* 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;
@@ -1287,9 +1290,11 @@
 		g = (PurpleGroup *)((PurpleBlistNode *)c)->parent;
 	} else {
 		if (group) {
-			/*  Fail if trying to add buddy to a group that is not on the buddy list. 
-			 *  Fix for #2752. */
-			g_return_if_fail(purple_find_group(group->name));
+			/* Add chat 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 {