Mercurial > pidgin
changeset 11005:bb7fd9359f9e
[gaim-migrate @ 12864]
Small changes to the oscar PRPL. Someone in #gaim was attempting to
debug a problem he's seen with permit/deny settings not sticking,
and noticed that there were multiple copies of people in his permit
or deny list. He didn't think the copies were still being added.
In any case, now Gaim will remove duplicate copies of people in your
permit and deny list, and multiple copies of a single buddy in the
same group.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 14 Jun 2005 00:24:27 +0000 |
parents | a3d3729a9130 |
children | 5d3b0a920d83 |
files | src/protocols/oscar/oscar.c src/protocols/oscar/ssi.c |
diffstat | 2 files changed, 31 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c Sun Jun 12 05:58:51 2005 +0000 +++ b/src/protocols/oscar/oscar.c Tue Jun 14 00:24:27 2005 +0000 @@ -5903,6 +5903,9 @@ } } +/* + * FYI, the OSCAR SSI code removes empty groups automatically. + */ static void oscar_rename_group(GaimConnection *gc, const char *old_name, GaimGroup *group, GList *moved_buddies) { OscarData *od = (OscarData *)gc->proto_data; @@ -5922,7 +5925,6 @@ serv_remove_buddies(gc, moved_buddies, groups); serv_add_buddies(gc, moved_buddies); g_list_free(groups); - /** XXX: Shouldn't be we deleting the old group on the server here??? */ gaim_debug_info("oscar", "ssi: moved all buddies from group %s to %s\n", old_name, group->name); } else {
--- a/src/protocols/oscar/ssi.c Sun Jun 12 05:58:51 2005 +0000 +++ b/src/protocols/oscar/ssi.c Tue Jun 14 00:24:27 2005 +0000 @@ -660,8 +660,29 @@ else if (cur->type == AIM_SSI_TYPE_DENY) aim_ssi_deldeny(sess, NULL); } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(sess->ssi.local, cur->gid, 0x0000)))) { - aim_ssi_addbuddy(sess, cur->name, "orphans", NULL, NULL, NULL, 0); + char *alias = aim_ssi_getalias(sess->ssi.local, NULL, cur->name); + aim_ssi_addbuddy(sess, cur->name, "orphans", alias, NULL, NULL, 0); aim_ssi_delbuddy(sess, cur->name, NULL); + free(alias); + } + cur = next; + } + + /* Make sure there aren't any duplicate buddies in a group, or duplicate permits or denies */ + cur = sess->ssi.local; + while (cur) { + next = cur->next; + if ((cur->type == AIM_SSI_TYPE_BUDDY) || (cur->type == AIM_SSI_TYPE_PERMIT) || (cur->type == AIM_SSI_TYPE_DENY)) + { + struct aim_ssi_item *cur2, *next2; + cur2 = next; + while (cur2) { + next2 = cur2->next; + if ((cur->type == cur2->type) && (cur->gid == cur2->gid) && (!strcmp(cur->name, cur2->name))) { + aim_ssi_itemlist_del(&sess->ssi.local, cur2); + } + cur2 = next2; + } } cur = next; } @@ -682,6 +703,9 @@ if ((cur = aim_ssi_itemlist_find(sess->ssi.local, 0x0000, 0x0000)) && (!cur->data)) aim_ssi_itemlist_del(&sess->ssi.local, cur); + /* If we've made any changes then sync our list with the server's */ + aim_ssi_sync(sess); + return 0; } @@ -895,8 +919,10 @@ */ faim_export int aim_ssi_movebuddy(aim_session_t *sess, const char *oldgn, const char *newgn, const char *sn) { - aim_ssi_addbuddy(sess, sn, newgn, aim_ssi_getalias(sess->ssi.local, oldgn, sn), NULL, NULL, aim_ssi_waitingforauth(sess->ssi.local, oldgn, sn)); + char *alias = aim_ssi_getalias(sess->ssi.local, oldgn, sn); + aim_ssi_addbuddy(sess, sn, newgn, alias, NULL, NULL, aim_ssi_waitingforauth(sess->ssi.local, oldgn, sn)); aim_ssi_delbuddy(sess, sn, oldgn); + free(alias); return 0; }