changeset 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 8a2e22478242
files src/blist.c src/blist.h
diffstat 2 files changed, 29 insertions(+), 16 deletions(-) [+]
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;
+		}
 	}
 }
 
--- a/src/blist.h	Mon Oct 13 00:11:48 2003 +0000
+++ b/src/blist.h	Mon Oct 13 03:48:36 2003 +0000
@@ -438,9 +438,9 @@
  * All of the buddies from source will be moved to target
  *
  * @param source  The contact to merge
- * @param target  The contact to be merged into
+ * @param node    The place to merge to (a buddy or contact)
  */
-void gaim_blist_merge_contact(GaimContact *source, GaimContact *target);
+void gaim_blist_merge_contact(GaimContact *source, GaimBlistNode *node);
 
 /**
  * Returns the highest priority buddy for a given contact.