comparison src/protocols/oscar/ssi.c @ 4344:d6f1086d52a6

[gaim-migrate @ 4609] A few small changes... The "orphans" groups should stop reappearing every time you sign online. Twas a case of too much error checking. Buddies, permits, and denies with empty names will all be deleted automatically by the cleaning function. This should never really happen, but somehow one of my accounts had some empty-named permit buddies, so I threw it in here. I also took out some BR tags before some HR tags. I really really really think it looks better this way. Feel free to disagree. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 19 Jan 2003 07:35:18 +0000
parents 051265d35a36
children 2903c656875a
comparison
equal deleted inserted replaced
4343:36cb0bb95b9c 4344:d6f1086d52a6
641 */ 641 */
642 faim_export int aim_ssi_cleanlist(aim_session_t *sess, aim_conn_t *conn) 642 faim_export int aim_ssi_cleanlist(aim_session_t *sess, aim_conn_t *conn)
643 { 643 {
644 struct aim_ssi_item *cur, *next; 644 struct aim_ssi_item *cur, *next;
645 645
646 /* Delete any buddies, permits, or denies with empty names */
647 cur = sess->ssi.local;
648 while (cur) {
649 next = cur->next;
650 if (!cur->name) {
651 if (cur->type == AIM_SSI_TYPE_BUDDY)
652 aim_ssi_delbuddy(sess, conn, cur->name, NULL);
653 else if (cur->type == AIM_SSI_TYPE_PERMIT)
654 aim_ssi_delpermit(sess, conn, cur->name);
655 else if (cur->type == AIM_SSI_TYPE_DENY)
656 aim_ssi_deldeny(sess, conn, cur->name);
657 }
658 cur = next;
659 }
660
646 /* If there are any buddies directly in the master group, put them in a real group */ 661 /* If there are any buddies directly in the master group, put them in a real group */
647 /* This will kind of mess up if you hit the item limit, but this function isn't too critical */ 662 /* This will kind of mess up if you hit the item limit, but this function isn't too critical */
648 for (cur=sess->ssi.local; cur; cur=cur->next) 663 for (cur=sess->ssi.local; cur; cur=cur->next)
649 if ((cur->type == AIM_SSI_TYPE_BUDDY) && (cur->gid == 0x0000)) 664 if ((cur->type == AIM_SSI_TYPE_BUDDY) && (cur->gid == 0x0000))
650 aim_ssi_addbuddy(sess, conn, cur->name, "orphans", NULL, NULL, NULL, 0); 665 aim_ssi_addbuddy(sess, conn, cur->name, "orphans", NULL, NULL, NULL, 0);
792 */ 807 */
793 faim_export int aim_ssi_delbuddy(aim_session_t *sess, aim_conn_t *conn, const char *name, const char *group) 808 faim_export int aim_ssi_delbuddy(aim_session_t *sess, aim_conn_t *conn, const char *name, const char *group)
794 { 809 {
795 struct aim_ssi_item *del; 810 struct aim_ssi_item *del;
796 811
797 if (!sess || !conn || !name || !group) 812 if (!sess || !conn || !name)
798 return -EINVAL; 813 return -EINVAL;
799 814
800 /* Find the buddy */ 815 /* Find the buddy */
801 if (!(del = aim_ssi_itemlist_finditem(sess->ssi.local, group, name, AIM_SSI_TYPE_BUDDY))) 816 if (!(del = aim_ssi_itemlist_finditem(sess->ssi.local, group, name, AIM_SSI_TYPE_BUDDY)))
802 return -EINVAL; 817 return -EINVAL;
836 */ 851 */
837 faim_export int aim_ssi_delpermit(aim_session_t *sess, aim_conn_t *conn, const char *name) 852 faim_export int aim_ssi_delpermit(aim_session_t *sess, aim_conn_t *conn, const char *name)
838 { 853 {
839 struct aim_ssi_item *del; 854 struct aim_ssi_item *del;
840 855
841 if (!sess || !conn || !name) 856 if (!sess || !conn)
842 return -EINVAL; 857 return -EINVAL;
843 858
844 /* Find the item */ 859 /* Find the item */
845 if (!(del = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, name, AIM_SSI_TYPE_PERMIT))) 860 if (!(del = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, name, AIM_SSI_TYPE_PERMIT)))
846 return -EINVAL; 861 return -EINVAL;
864 */ 879 */
865 faim_export int aim_ssi_deldeny(aim_session_t *sess, aim_conn_t *conn, const char *name) 880 faim_export int aim_ssi_deldeny(aim_session_t *sess, aim_conn_t *conn, const char *name)
866 { 881 {
867 struct aim_ssi_item *del; 882 struct aim_ssi_item *del;
868 883
869 if (!sess || !conn || !name) 884 if (!sess || !conn)
870 return -EINVAL; 885 return -EINVAL;
871 886
872 /* Find the item */ 887 /* Find the item */
873 if (!(del = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, name, AIM_SSI_TYPE_DENY))) 888 if (!(del = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, name, AIM_SSI_TYPE_DENY)))
874 return -EINVAL; 889 return -EINVAL;