Mercurial > pidgin
comparison src/blist.c @ 8328:645a3d07ee45
[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 <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 24 Feb 2004 02:38:52 +0000 |
parents | ef881489396e |
children | fec4c1fb2ac8 |
comparison
equal
deleted
inserted
replaced
8327:90115b17f590 | 8328:645a3d07ee45 |
---|---|
842 void gaim_blist_add_contact(GaimContact *contact, GaimGroup *group, GaimBlistNode *node) | 842 void gaim_blist_add_contact(GaimContact *contact, GaimGroup *group, GaimBlistNode *node) |
843 { | 843 { |
844 GaimBlistUiOps *ops = gaimbuddylist->ui_ops; | 844 GaimBlistUiOps *ops = gaimbuddylist->ui_ops; |
845 GaimGroup *g; | 845 GaimGroup *g; |
846 GaimBlistNode *gnode, *cnode, *bnode; | 846 GaimBlistNode *gnode, *cnode, *bnode; |
847 gboolean save = FALSE; | 847 gboolean save = FALSE, empty_contact = FALSE; |
848 | 848 |
849 g_return_if_fail(contact != NULL); | 849 g_return_if_fail(contact != NULL); |
850 g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT((GaimBlistNode*)contact)); | 850 g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT((GaimBlistNode*)contact)); |
851 | 851 |
852 if((GaimBlistNode*)contact == node) | 852 if((GaimBlistNode*)contact == node) |
894 hb->account = b->account; | 894 hb->account = b->account; |
895 hb->group = cnode->parent; | 895 hb->group = cnode->parent; |
896 | 896 |
897 g_hash_table_remove(gaimbuddylist->buddies, hb); | 897 g_hash_table_remove(gaimbuddylist->buddies, hb); |
898 | 898 |
899 hb->group = gnode; | 899 if(!gaim_find_buddy_in_group(b->account, b->name, gnode)) { |
900 g_hash_table_replace(gaimbuddylist->buddies, hb, b); | 900 hb->group = gnode; |
901 | 901 g_hash_table_replace(gaimbuddylist->buddies, hb, b); |
902 if(b->account->gc) | 902 |
903 serv_move_buddy(b, (GaimGroup*)cnode->parent, g); | 903 if(b->account->gc) |
904 serv_move_buddy(b, (GaimGroup*)cnode->parent, g); | |
905 } else { | |
906 /* this buddy already exists in the group, so we're | |
907 * gonna delete it instead */ | |
908 g_free(hb->name); | |
909 g_free(hb); | |
910 if(b->account->gc) | |
911 serv_remove_buddy(b->account->gc, b->name, ((GaimGroup*)cnode->parent)->name); | |
912 | |
913 if(!cnode->child->next) | |
914 empty_contact = TRUE; | |
915 gaim_blist_remove_buddy(b); | |
916 } | |
904 } | 917 } |
905 } | 918 } |
906 } | 919 } |
920 | |
921 if(empty_contact) | |
922 return; | |
907 | 923 |
908 | 924 |
909 if(node && (GAIM_BLIST_NODE_IS_CONTACT(node) || | 925 if(node && (GAIM_BLIST_NODE_IS_CONTACT(node) || |
910 GAIM_BLIST_NODE_IS_CHAT(node))) { | 926 GAIM_BLIST_NODE_IS_CHAT(node))) { |
911 if(node->next) | 927 if(node->next) |