Mercurial > pidgin.yaz
diff libpurple/protocols/oscar/family_feedbag.c @ 18755:84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
empty groups from the oscar server-stored buddy list. There's this
thing called AIM WIMZI that relies on having a certain group in your
buddy list so that it can add buddies to it automatically, and it
wasn't working if you used Pidgin because the group didn't exist.
See http://wimzi.aim.com/
Also try to fix allowing buddies to be in multiple groups.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 31 Jul 2007 06:51:29 +0000 |
parents | 0db74191adbb |
children | c6f1f9971c4a |
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_feedbag.c Tue Jul 31 06:09:45 2007 +0000 +++ b/libpurple/protocols/oscar/family_feedbag.c Tue Jul 31 06:51:29 2007 +0000 @@ -695,18 +695,6 @@ cur = cur->next; } - /* Check if there are empty groups and delete them */ - cur = od->ssi.local; - while (cur) { - next = cur->next; - if (cur->type == AIM_SSI_TYPE_GROUP) { - aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x00c8, 1); - if (!tlv || !tlv->length) - aim_ssi_itemlist_del(&od->ssi.local, cur); - } - cur = next; - } - /* Check if the master group is empty */ if ((cur = aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000)) && (!cur->data)) aim_ssi_itemlist_del(&od->ssi.local, cur); @@ -841,18 +829,39 @@ /* Modify the parent group */ aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); - /* Check if we should delete the parent group */ - if ((del = aim_ssi_itemlist_finditem(od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP)) && (!del->data)) { - aim_ssi_itemlist_del(&od->ssi.local, del); + /* Sync our local list with the server list */ + return aim_ssi_sync(od); +} + +/** + * Deletes a group from the list. + * + * @param od The oscar odion. + * @param group The name of the group. + * @return Return 0 if no errors, otherwise return the error number. + */ +int aim_ssi_delgroup(OscarData *od, const char *group) +{ + struct aim_ssi_item *del; + aim_tlv_t *tlv; - /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, NULL); + if (!od) + return -EINVAL; + + /* Find the group */ + if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) + return -EINVAL; - /* Check if we should delete the parent's parent (the master group) */ - if ((del = aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000)) && (!del->data)) { - aim_ssi_itemlist_del(&od->ssi.local, del); - } - } + /* Don't delete the group if it's not empty */ + tlv = aim_tlv_gettlv(del->data, 0x00c8, 1); + if (tlv && tlv->length > 0) + return -EINVAL; + + /* Remove the item from the list */ + aim_ssi_itemlist_del(&od->ssi.local, del); + + /* Modify the parent group */ + aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); /* Sync our local list with the server list */ return aim_ssi_sync(od);