diff src/blist.c @ 7246:cb6bf374c7ee

[gaim-migrate @ 7823] 1. fix 822297 (add/remove button in conv window not changing) 2. make dragging a contact into an expanded contact put the dragged one where you wanted it committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 13 Oct 2003 03:48:36 +0000
parents 747b9e00ef60
children 1930e3d00ecd
line wrap: on
line diff
--- a/src/blist.c	Mon Oct 13 00:11:48 2003 +0000
+++ b/src/blist.c	Mon Oct 13 03:48:36 2003 +0000
@@ -902,23 +902,36 @@
 		gaim_blist_save();
 }
 
-void gaim_blist_merge_contact(GaimContact *source, GaimContact *target)
+void gaim_blist_merge_contact(GaimContact *source, GaimBlistNode *node)
 {
 	GaimBlistNode *sourcenode = (GaimBlistNode*)source;
-	GaimBlistNode *targetnode = (GaimBlistNode*)target;
-	GaimBlistNode *child, *child2;
-
-	if(source == target)
+	GaimBlistNode *targetnode;
+	GaimBlistNode *prev, *cur, *next;
+	GaimContact *target;
+
+	if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
+		target = (GaimContact*)node;
+		prev = gaim_blist_get_last_child(node);
+	} else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
+		target = (GaimContact*)node->parent;
+		prev = node;
+	} else {
 		return;
-
-	child = sourcenode->child;
-
-	while(child) {
-		child2 = child;
-		child = child->next;
-		if(GAIM_BLIST_NODE_IS_BUDDY(child2))
-			gaim_blist_add_buddy((GaimBuddy*)child2, target, NULL,
-					gaim_blist_get_last_child(targetnode));
+	}
+
+	if(source == target || !target)
+		return;
+
+	targetnode = (GaimBlistNode*)target;
+	next = sourcenode->child;
+
+	while(next) {
+		cur = next;
+		next = cur->next;
+		if(GAIM_BLIST_NODE_IS_BUDDY(cur)) {
+			gaim_blist_add_buddy((GaimBuddy*)cur, target, NULL, prev);
+			prev = cur;
+		}
 	}
 }