Mercurial > pidgin
comparison src/protocols/gg/gg.c @ 10869:3e43c132f151
[gaim-migrate @ 12556]
We no longer call "serv_add_buddies" at log in. Any PRPL that relied on
that should look through the buddy list itself and do whatever it needs
to after calling gaim_connection_set_state(gc, GAIM_CONNECTED);
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 25 Apr 2005 03:55:11 +0000 |
parents | 4a56b48dbaa6 |
children | 50224ac8184d |
comparison
equal
deleted
inserted
replaced
10868:4a56b48dbaa6 | 10869:3e43c132f151 |
---|---|
1 /* | 1 /* |
2 * gaim - Gadu-Gadu Protocol Plugin | 2 * gaim - Gadu-Gadu Protocol Plugin |
3 * $Id: gg.c 12555 2005-04-25 03:41:16Z datallah $ | 3 * $Id: gg.c 12556 2005-04-25 03:55:11Z thekingant $ |
4 * | 4 * |
5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> | 5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> |
6 * | 6 * |
7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License as published by | 8 * it under the terms of the GNU General Public License as published by |
756 break; | 756 break; |
757 } | 757 } |
758 gg_free_event(e); | 758 gg_free_event(e); |
759 } | 759 } |
760 | 760 |
761 static void agg_send_buddylist(GaimConnection *gc) | |
762 { | |
763 GaimBuddyList *blist; | |
764 GaimBlistNode *gnode, *cnode, *bnode; | |
765 GaimBuddy *buddy; | |
766 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
767 uin_t *userlist = NULL; | |
768 int userlist_size = 0; | |
769 | |
770 if ((blist = gaim_get_blist()) != NULL) | |
771 { | |
772 for (gnode = blist->root; gnode != NULL; gnode = gnode->next) | |
773 { | |
774 if (!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
775 continue; | |
776 for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) | |
777 { | |
778 if (!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
779 continue; | |
780 for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) | |
781 { | |
782 if (!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
783 continue; | |
784 buddy = (GaimBuddy *)bnode; | |
785 if (invalid_uin(buddy->name)) | |
786 continue; | |
787 userlist_size++; | |
788 userlist = g_renew(uin_t, userlist, userlist_size); | |
789 userlist[userlist_size - 1] = | |
790 (uin_t) strtol(buddy->name, (char **)NULL, 10); | |
791 } | |
792 } | |
793 } | |
794 } | |
795 | |
796 if (userlist) { | |
797 gg_notify(gd->sess, userlist, userlist_size); | |
798 g_free(userlist); | |
799 } | |
800 | |
801 agg_save_buddy_list(gc, NULL); | |
802 } | |
803 | |
761 void login_callback(gpointer data, gint source, GaimInputCondition cond) | 804 void login_callback(gpointer data, gint source, GaimInputCondition cond) |
762 { | 805 { |
763 GaimConnection *gc = data; | 806 GaimConnection *gc = data; |
764 struct agg_data *gd = gc->proto_data; | 807 struct agg_data *gd = gc->proto_data; |
765 struct gg_event *e; | 808 struct gg_event *e; |
852 gaim_input_remove(gc->inpa); | 895 gaim_input_remove(gc->inpa); |
853 gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, main_callback, gc); | 896 gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, main_callback, gc); |
854 | 897 |
855 /* Our signon is complete */ | 898 /* Our signon is complete */ |
856 gaim_connection_set_state(gc, GAIM_CONNECTED); | 899 gaim_connection_set_state(gc, GAIM_CONNECTED); |
900 | |
901 /* Send the server our buddy list */ | |
902 agg_send_buddylist(gc); | |
857 | 903 |
858 break; | 904 break; |
859 case GG_EVENT_CONN_FAILED: | 905 case GG_EVENT_CONN_FAILED: |
860 gaim_input_remove(gc->inpa); | 906 gaim_input_remove(gc->inpa); |
861 gc->inpa = 0; | 907 gc->inpa = 0; |
970 { | 1016 { |
971 struct agg_data *gd = (struct agg_data *)gc->proto_data; | 1017 struct agg_data *gd = (struct agg_data *)gc->proto_data; |
972 if (invalid_uin(buddy->name)) | 1018 if (invalid_uin(buddy->name)) |
973 return; | 1019 return; |
974 gg_remove_notify(gd->sess, strtol(buddy->name, (char **)NULL, 10)); | 1020 gg_remove_notify(gd->sess, strtol(buddy->name, (char **)NULL, 10)); |
975 agg_save_buddy_list(gc, NULL); | |
976 } | |
977 | |
978 static void agg_add_buddies(GaimConnection *gc, GList *buddies, GList *groups) | |
979 { | |
980 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
981 uin_t *userlist = NULL; | |
982 int userlist_size = 0; | |
983 | |
984 while (buddies) { | |
985 GaimBuddy *buddy = buddies->data; | |
986 if (!invalid_uin(buddy->name)) { | |
987 userlist_size++; | |
988 userlist = g_renew(uin_t, userlist, userlist_size); | |
989 userlist[userlist_size - 1] = | |
990 (uin_t) strtol(buddy->name, (char **)NULL, 10); | |
991 } | |
992 buddies = g_list_next(buddies); | |
993 } | |
994 | |
995 if (userlist) { | |
996 gg_notify(gd->sess, userlist, userlist_size); | |
997 g_free(userlist); | |
998 } | |
999 | |
1000 agg_save_buddy_list(gc, NULL); | 1021 agg_save_buddy_list(gc, NULL); |
1001 } | 1022 } |
1002 | 1023 |
1003 static void agg_buddy_free (GaimBuddy *buddy) | 1024 static void agg_buddy_free (GaimBuddy *buddy) |
1004 { | 1025 { |
1733 NULL, /* set_info */ | 1754 NULL, /* set_info */ |
1734 NULL, /* send_typing */ | 1755 NULL, /* send_typing */ |
1735 agg_get_info, /* get_info */ | 1756 agg_get_info, /* get_info */ |
1736 agg_set_status, /* set_away */ | 1757 agg_set_status, /* set_away */ |
1737 NULL, /* set_idle */ | 1758 NULL, /* set_idle */ |
1738 agg_change_passwd, /* change_passwd */ | 1759 agg_change_passwd, /* change_passwd */ |
1739 agg_add_buddy, /* add_buddy */ | 1760 agg_add_buddy, /* add_buddy */ |
1740 agg_add_buddies, /* add_buddies */ | 1761 NULL, /* add_buddies */ |
1741 agg_rem_buddy, /* remove_buddy */ | 1762 agg_rem_buddy, /* remove_buddy */ |
1742 NULL, /* remove_buddies */ | 1763 NULL, /* remove_buddies */ |
1743 agg_permit_deny_dummy, /* add_permit */ | 1764 agg_permit_deny_dummy, /* add_permit */ |
1744 agg_permit_deny_dummy, /* add_deny */ | 1765 agg_permit_deny_dummy, /* add_deny */ |
1745 agg_permit_deny_dummy, /* rem_permit */ | 1766 agg_permit_deny_dummy, /* rem_permit */ |
1746 agg_permit_deny_dummy, /* rem_deny */ | 1767 agg_permit_deny_dummy, /* rem_deny */ |