diff src/list.c @ 4781:b6f33ba0a0c0

[gaim-migrate @ 5101] Things this does: - dragging a buddy into a conversation window will actually put it in that window. - drag buddies and groups around in your buddy list to your heart's desire committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 14 Mar 2003 23:47:26 +0000
parents c4c28874ecd3
children 1e28e7d802a1
line wrap: on
line diff
--- a/src/list.c	Fri Mar 14 23:46:32 2003 +0000
+++ b/src/list.c	Fri Mar 14 23:47:26 2003 +0000
@@ -313,7 +313,8 @@
 void  gaim_blist_add_group (struct group *group, GaimBlistNode *node)
 {
 	struct gaim_blist_ui_ops *ops;
-
+	gboolean save;
+	
 	if (!gaimbuddylist)
 		gaimbuddylist = gaim_blist_new();
 	ops = gaimbuddylist->ui_ops;
@@ -323,18 +324,32 @@
 		return;
 	}
 	
-	if (gaim_find_group(group->name))
-		return;
-
+	
 	if (!node) 
 		node = gaim_blist_get_last_sibling(gaimbuddylist->root);
+	
+	if (gaim_find_group(group->name)) {
+		/* This is just being moved */
+		GaimBlistNode *node2 = ((GaimBlistNode*)group)->next;
+		GaimBlistNode *node3 = ((GaimBlistNode*)group)->prev;
 
+		ops->remove(gaimbuddylist, (GaimBlistNode*)group);
+
+		if (node2)
+			node2->prev = node3;
+		if (node3)
+			node3->next = node2;
+		save = TRUE;
+	}
+	
 	((GaimBlistNode*)group)->next = node ? node->next : NULL;
 	((GaimBlistNode*)group)->prev = node;
 	node->next = (GaimBlistNode*)group;
 
 	if (ops)
 		ops->update(gaimbuddylist, (GaimBlistNode*)group);
+	if (save) 
+		gaim_blist_save();
 }
 
 void  gaim_blist_remove_buddy (struct buddy *buddy)