comparison src/buddy.c @ 2681:37d80035e77f

[gaim-migrate @ 2694] don't ask. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 06 Nov 2001 23:58:24 +0000
parents 44773c4b0f16
children f3c094e78609
comparison
equal deleted inserted replaced
2680:ab2ca2770d2e 2681:37d80035e77f
997 * if we changed connections, we copy the buddy to the new connection. if the new 997 * if we changed connections, we copy the buddy to the new connection. if the new
998 * connection already had the buddy in its buddy list but in a different group, 998 * connection already had the buddy in its buddy list but in a different group,
999 * we change the group that the buddy is in */ 999 * we change the group that the buddy is in */
1000 struct group *old_g, *new_g = (struct group *)ptype; 1000 struct group *old_g, *new_g = (struct group *)ptype;
1001 struct buddy *s = NULL, *buddy = (struct buddy *)ctype; 1001 struct buddy *s = NULL, *buddy = (struct buddy *)ctype;
1002 gboolean add = FALSE;
1002 int pos; 1003 int pos;
1003 1004
1004 if (buddy->gc != new_g->gc) { 1005 if (buddy->gc != new_g->gc) {
1005 /* we changed connections */ 1006 /* we changed connections */
1006 struct buddy *a; 1007 struct buddy *a;
1013 struct group *og; 1014 struct group *og;
1014 og = find_group_by_buddy(new_g->gc, buddy->name); 1015 og = find_group_by_buddy(new_g->gc, buddy->name);
1015 og->members = g_slist_remove(og->members, a); 1016 og->members = g_slist_remove(og->members, a);
1016 } else { 1017 } else {
1017 /* we don't have this buddy yet; let's add him */ 1018 /* we don't have this buddy yet; let's add him */
1018 serv_add_buddy(new_g->gc, buddy->name); 1019 add = TRUE;
1019 } 1020 }
1020 } 1021 }
1021 1022
1022 old_g = find_group_by_buddy(buddy->gc, buddy->name); 1023 old_g = find_group_by_buddy(buddy->gc, buddy->name);
1023 1024
1032 new_g->members = g_slist_insert(new_g->members, buddy, pos); 1033 new_g->members = g_slist_insert(new_g->members, buddy, pos);
1033 else 1034 else
1034 new_g->members = g_slist_prepend(new_g->members, buddy); 1035 new_g->members = g_slist_prepend(new_g->members, buddy);
1035 } else 1036 } else
1036 new_g->members = g_slist_append(new_g->members, buddy); 1037 new_g->members = g_slist_append(new_g->members, buddy);
1038
1039 /* we do the add after it's added locally so that prpls can find it if necessary */
1040 if (add)
1041 serv_add_buddy(new_g->gc, buddy->name);
1037 1042
1038 do_export(buddy->gc); 1043 do_export(buddy->gc);
1039 if (buddy->gc != new_g->gc) { 1044 if (buddy->gc != new_g->gc) {
1040 do_export(new_g->gc); 1045 do_export(new_g->gc);
1041 build_edit_tree(); 1046 build_edit_tree();
1243 if (*type == EDIT_BUDDY) { 1248 if (*type == EDIT_BUDDY) {
1244 struct gaim_connection *gct; 1249 struct gaim_connection *gct;
1245 b = (struct buddy *)type; 1250 b = (struct buddy *)type;
1246 g = find_group_by_buddy(b->gc, b->name); 1251 g = find_group_by_buddy(b->gc, b->name);
1247 gct = b->gc; 1252 gct = b->gc;
1248 serv_remove_buddy(b->gc, b->name); 1253 serv_remove_buddy(b->gc, b->name, g->name);
1249 remove_buddy(b->gc, g, b); 1254 remove_buddy(b->gc, g, b);
1250 gtk_ctree_remove_node(GTK_CTREE(edittree), node); 1255 gtk_ctree_remove_node(GTK_CTREE(edittree), node);
1251 do_export(gct); 1256 do_export(gct);
1252 } else if (*type == EDIT_GROUP) { 1257 } else if (*type == EDIT_GROUP) {
1253 struct gaim_connection *gc = ((struct group *)type)->gc; 1258 struct gaim_connection *gc = ((struct group *)type)->gc;