changeset 5055:5b1d70deda02

[gaim-migrate @ 5406] you may now drag groups to your heart's content committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 07 Apr 2003 04:36:59 +0000
parents abc8489b2e8f
children 18ec87e54201
files src/buddy.c src/list.c
diffstat 2 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Mon Apr 07 03:59:02 2003 +0000
+++ b/src/buddy.c	Mon Apr 07 04:36:59 2003 +0000
@@ -498,6 +498,8 @@
 						break;
 					}
 
+				} else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
+					gaim_blist_add_group(g, node->parent);
 				}
 
 			}
--- a/src/list.c	Mon Apr 07 03:59:02 2003 +0000
+++ b/src/list.c	Mon Apr 07 04:36:59 2003 +0000
@@ -287,6 +287,7 @@
 void  gaim_blist_add_group (struct group *group, GaimBlistNode *node)
 {
 	struct gaim_blist_ui_ops *ops;
+	GaimBlistNode *gnode = (GaimBlistNode*)group;
 	gboolean save = FALSE;
 
 	if (!gaimbuddylist)
@@ -294,7 +295,7 @@
 	ops = gaimbuddylist->ui_ops;
 
 	if (!gaimbuddylist->root) {
-		gaimbuddylist->root = (GaimBlistNode*)group;
+		gaimbuddylist->root = gnode;
 		return;
 	}
 
@@ -302,29 +303,35 @@
 		node = gaim_blist_get_last_sibling(gaimbuddylist->root);
 
 	/* if we're moving to overtop of ourselves, do nothing */
-	if((GaimBlistNode*)group == node)
+	if(gnode == node)
 		return;
 
 	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;
+		if(gnode == gaimbuddylist->root)
+			gaimbuddylist->root = gnode->next;
+		if(gnode->prev)
+			gnode->prev->next = gnode->next;
+		if(gnode->next)
+			gnode->next->prev = gnode->prev;
+
 		save = TRUE;
 	}
 
-	((GaimBlistNode*)group)->next = node ? node->next : NULL;
-	((GaimBlistNode*)group)->prev = node;
-	node->next = (GaimBlistNode*)group;
+	gnode->next = node->next;
+	gnode->prev = node;
+	if(node->next)
+		node->next->prev = gnode;
+	node->next = gnode;
 
-	if (ops)
-		ops->update(gaimbuddylist, (GaimBlistNode*)group);
+	if (ops) {
+		ops->update(gaimbuddylist, gnode);
+		for(node = gnode->child; node; node = node->next)
+			ops->update(gaimbuddylist, node);
+	}
 	if (save)
 		gaim_blist_save();
 }