# HG changeset patch # User Nathan Walp # Date 1077590332 0 # Node ID 645a3d07ee455239092cb744cd01f12818aa2aeb # Parent 90115b17f5905398406e4bcfc7d1c5a8281f38b4 [gaim-migrate @ 9052] there might be a more user-friendly way to do this, but for now, if someone moves a contact into another group, and there are buddies in that contact that are already in the new group, just delete the duplicate buddies. committer: Tailor Script diff -r 90115b17f590 -r 645a3d07ee45 src/blist.c --- a/src/blist.c Mon Feb 23 23:34:33 2004 +0000 +++ b/src/blist.c Tue Feb 24 02:38:52 2004 +0000 @@ -844,7 +844,7 @@ GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimGroup *g; GaimBlistNode *gnode, *cnode, *bnode; - gboolean save = FALSE; + gboolean save = FALSE, empty_contact = FALSE; g_return_if_fail(contact != NULL); g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT((GaimBlistNode*)contact)); @@ -896,15 +896,31 @@ g_hash_table_remove(gaimbuddylist->buddies, hb); - hb->group = gnode; - g_hash_table_replace(gaimbuddylist->buddies, hb, b); - - if(b->account->gc) - serv_move_buddy(b, (GaimGroup*)cnode->parent, g); + if(!gaim_find_buddy_in_group(b->account, b->name, gnode)) { + hb->group = gnode; + g_hash_table_replace(gaimbuddylist->buddies, hb, b); + + if(b->account->gc) + serv_move_buddy(b, (GaimGroup*)cnode->parent, g); + } else { + /* this buddy already exists in the group, so we're + * gonna delete it instead */ + g_free(hb->name); + g_free(hb); + if(b->account->gc) + serv_remove_buddy(b->account->gc, b->name, ((GaimGroup*)cnode->parent)->name); + + if(!cnode->child->next) + empty_contact = TRUE; + gaim_blist_remove_buddy(b); + } } } } + if(empty_contact) + return; + if(node && (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_CHAT(node))) {