comparison src/protocols/oscar/ssi.c @ 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 b6ca6d3c5332
children fe1a1d73f42c
comparison
equal deleted inserted replaced
11004:a3d3729a9130 11005:bb7fd9359f9e
658 else if (cur->type == AIM_SSI_TYPE_PERMIT) 658 else if (cur->type == AIM_SSI_TYPE_PERMIT)
659 aim_ssi_delpermit(sess, NULL); 659 aim_ssi_delpermit(sess, NULL);
660 else if (cur->type == AIM_SSI_TYPE_DENY) 660 else if (cur->type == AIM_SSI_TYPE_DENY)
661 aim_ssi_deldeny(sess, NULL); 661 aim_ssi_deldeny(sess, NULL);
662 } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(sess->ssi.local, cur->gid, 0x0000)))) { 662 } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(sess->ssi.local, cur->gid, 0x0000)))) {
663 aim_ssi_addbuddy(sess, cur->name, "orphans", NULL, NULL, NULL, 0); 663 char *alias = aim_ssi_getalias(sess->ssi.local, NULL, cur->name);
664 aim_ssi_addbuddy(sess, cur->name, "orphans", alias, NULL, NULL, 0);
664 aim_ssi_delbuddy(sess, cur->name, NULL); 665 aim_ssi_delbuddy(sess, cur->name, NULL);
666 free(alias);
667 }
668 cur = next;
669 }
670
671 /* Make sure there aren't any duplicate buddies in a group, or duplicate permits or denies */
672 cur = sess->ssi.local;
673 while (cur) {
674 next = cur->next;
675 if ((cur->type == AIM_SSI_TYPE_BUDDY) || (cur->type == AIM_SSI_TYPE_PERMIT) || (cur->type == AIM_SSI_TYPE_DENY))
676 {
677 struct aim_ssi_item *cur2, *next2;
678 cur2 = next;
679 while (cur2) {
680 next2 = cur2->next;
681 if ((cur->type == cur2->type) && (cur->gid == cur2->gid) && (!strcmp(cur->name, cur2->name))) {
682 aim_ssi_itemlist_del(&sess->ssi.local, cur2);
683 }
684 cur2 = next2;
685 }
665 } 686 }
666 cur = next; 687 cur = next;
667 } 688 }
668 689
669 /* Check if there are empty groups and delete them */ 690 /* Check if there are empty groups and delete them */
680 701
681 /* Check if the master group is empty */ 702 /* Check if the master group is empty */
682 if ((cur = aim_ssi_itemlist_find(sess->ssi.local, 0x0000, 0x0000)) && (!cur->data)) 703 if ((cur = aim_ssi_itemlist_find(sess->ssi.local, 0x0000, 0x0000)) && (!cur->data))
683 aim_ssi_itemlist_del(&sess->ssi.local, cur); 704 aim_ssi_itemlist_del(&sess->ssi.local, cur);
684 705
706 /* If we've made any changes then sync our list with the server's */
707 aim_ssi_sync(sess);
708
685 return 0; 709 return 0;
686 } 710 }
687 711
688 /** 712 /**
689 * Add a buddy to the list. 713 * Add a buddy to the list.
893 * @param sn The name of the buddy to be moved. 917 * @param sn The name of the buddy to be moved.
894 * @return Return 0 if no errors, otherwise return the error number. 918 * @return Return 0 if no errors, otherwise return the error number.
895 */ 919 */
896 faim_export int aim_ssi_movebuddy(aim_session_t *sess, const char *oldgn, const char *newgn, const char *sn) 920 faim_export int aim_ssi_movebuddy(aim_session_t *sess, const char *oldgn, const char *newgn, const char *sn)
897 { 921 {
898 aim_ssi_addbuddy(sess, sn, newgn, aim_ssi_getalias(sess->ssi.local, oldgn, sn), NULL, NULL, aim_ssi_waitingforauth(sess->ssi.local, oldgn, sn)); 922 char *alias = aim_ssi_getalias(sess->ssi.local, oldgn, sn);
923 aim_ssi_addbuddy(sess, sn, newgn, alias, NULL, NULL, aim_ssi_waitingforauth(sess->ssi.local, oldgn, sn));
899 aim_ssi_delbuddy(sess, sn, oldgn); 924 aim_ssi_delbuddy(sess, sn, oldgn);
925 free(alias);
900 return 0; 926 return 0;
901 } 927 }
902 928
903 /** 929 /**
904 * Change the alias stored on the server for a given buddy. 930 * Change the alias stored on the server for a given buddy.