comparison src/blist.c @ 10853:2409700be3dc

[gaim-migrate @ 12527] (15:46:50) LSchiere2: grim: commit message? (15:47:01) grim: LSchiere2: whatever..[sic] grim fixed a crash and some oddness in renaming groups. a related patch went into oldstatus a while back (also from grim). This is the HEAD version, removing a server.[ch] function in the process. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 19 Apr 2005 19:48:29 +0000
parents fa06fda62868
children 4a4f2760a9ad
comparison
equal deleted inserted replaced
10852:62b5117114d2 10853:2409700be3dc
986 /* Update the UI */ 986 /* Update the UI */
987 if (ops && ops->update) 987 if (ops && ops->update)
988 ops->update(gaimbuddylist, (GaimBlistNode*)source); 988 ops->update(gaimbuddylist, (GaimBlistNode*)source);
989 989
990 /* Notify all PRPLs */ 990 /* Notify all PRPLs */
991 for (accts = gaim_group_get_accounts(source); accts; accts = g_slist_remove(accts, accts->data)) { 991 if(old_name && source && strcmp(source->name, old_name)) {
992 GaimAccount *account = accts->data; 992 for (accts = gaim_group_get_accounts(source); accts; accts = g_slist_remove(accts, accts->data)) {
993 serv_rename_group(account->gc, old_name, source, moved_buddies); 993 GaimAccount *account = accts->data;
994 GaimPluginProtocolInfo *prpl_info = NULL;
995 GList *l = NULL, *buddies = NULL;
996
997 if(account->gc && account->gc->prpl)
998 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
999
1000 if(!prpl_info)
1001 continue;
1002
1003 for(l = moved_buddies; l; l = l->next) {
1004 GaimBuddy *buddy = (GaimBuddy *)l->data;
1005
1006 if(buddy && buddy->account == account)
1007 buddies = g_list_append(buddies, (GaimBlistNode *)buddy);
1008 }
1009
1010 if(prpl_info->rename_group) {
1011 prpl_info->rename_group(account->gc, old_name, source, buddies);
1012 } else {
1013 GList *cur, *groups = NULL;
1014
1015 /* Make a list of what the groups each buddy is in */
1016 for(cur = buddies; cur; cur = cur->next) {
1017 GaimBlistNode *node = (GaimBlistNode *)cur->data;
1018 groups = g_list_append(groups, node->parent->parent);
1019 }
1020
1021 serv_remove_buddies(account->gc, buddies, groups);
1022 g_list_free(groups);
1023 serv_add_buddies(account->gc, buddies);
1024 }
1025
1026 g_list_free(buddies);
1027 }
994 } 1028 }
995 g_list_free(moved_buddies); 1029 g_list_free(moved_buddies);
996 g_free(old_name); 1030 g_free(old_name);
997 } 1031 }
998 1032