changeset 25242:6eecd6ba2862

Fix situation in which group was not specified and purple_find_buddy_in_group(account, who, NULL or "") won't find the existing PurpleBuddy in "Buddies"
author Paul Aurich <paul@darkrain42.org>
date Mon, 22 Dec 2008 19:40:05 +0000
parents 9b1310f1cc7c
children ae544623840b
files pidgin/gtkblist.c
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Sun Dec 21 22:42:04 2008 +0000
+++ b/pidgin/gtkblist.c	Mon Dec 22 19:40:05 2008 +0000
@@ -6504,13 +6504,22 @@
 			whoalias = NULL;
 
 		g = NULL;
-		if ((grp != NULL) && (*grp != '\0') && ((g = purple_find_group(grp)) == NULL))
+		if ((grp != NULL) && (*grp != '\0'))
 		{
-			g = purple_group_new(grp);
-			purple_blist_add_group(g, NULL);
+			if ((g = purple_find_group(grp)) == NULL)
+			{
+				g = purple_group_new(grp);
+				purple_blist_add_group(g, NULL);
+			}
+
+			b = purple_find_buddy_in_group(data->account, who, g);
 		}
-
-		if ((b = purple_find_buddy_in_group(data->account, who, g)) == NULL)
+		else if ((b = purple_find_buddy(data->account, who)) != NULL)
+		{
+				g = purple_buddy_get_group(b);
+		}
+
+		if (b == NULL)
 		{
 			b = purple_buddy_new(data->account, who, whoalias);
 			purple_blist_add_buddy(b, NULL, g, NULL);