comparison libpurple/protocols/msn/userlist.c @ 23509:1ac5faa72c8d

explicit merge of '9d90ebdb7e38fdd77bb504bc3302a083616360d9' and '547cd65fb6e1faeb37d88730f0dbf45075a08426' to branch 'im.pidgin.cpw.qulogic.msn'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 07 Jun 2008 03:10:15 +0000
parents 5cdd93dac7a2 d756a0477c06
children eb8bd060b987
comparison
equal deleted inserted replaced
23309:99b4470a763e 23509:1ac5faa72c8d
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 */ 23 */
24 #include "msn.h" 24 #include "msn.h"
25 #include "userlist.h" 25 #include "userlist.h"
26 26
27 #include "contact.h"
28
27 const char *lists[] = { "FL", "AL", "BL", "RL" }; 29 const char *lists[] = { "FL", "AL", "BL", "RL" };
28 30
29 typedef struct 31 typedef struct
30 { 32 {
31 PurpleConnection *gc; 33 PurpleConnection *gc;
49 MsnSession *session = pa->gc->proto_data; 51 MsnSession *session = pa->gc->proto_data;
50 MsnUserList *userlist = session->userlist; 52 MsnUserList *userlist = session->userlist;
51 53
52 msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_AL); 54 msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_AL);
53 55
54 msn_del_contact_from_list(session->contact, NULL, pa->who, MSN_LIST_PL); 56 msn_del_contact_from_list(session, NULL, pa->who, MSN_LIST_PL);
55 } 57 }
56 58
57 g_free(pa->who); 59 g_free(pa->who);
58 g_free(pa->friendly); 60 g_free(pa->friendly);
59 g_free(pa); 61 g_free(pa);
73 MsnCallbackState *state = msn_callback_state_new(session); 75 MsnCallbackState *state = msn_callback_state_new(session);
74 76
75 msn_callback_state_set_action(state, MSN_DENIED_BUDDY); 77 msn_callback_state_set_action(state, MSN_DENIED_BUDDY);
76 78
77 msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_BL); 79 msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_BL);
78 msn_del_contact_from_list(session->contact, state, pa->who, MSN_LIST_PL); 80 msn_del_contact_from_list(session, state, pa->who, MSN_LIST_PL);
79 } 81 }
80 82
81 g_free(pa->who); 83 g_free(pa->who);
82 g_free(pa->friendly); 84 g_free(pa->friendly);
83 g_free(pa); 85 g_free(pa);
645 { 647 {
646 MsnUser *user = NULL; 648 MsnUser *user = NULL;
647 649
648 g_return_if_fail(userlist != NULL); 650 g_return_if_fail(userlist != NULL);
649 g_return_if_fail(userlist->session != NULL); 651 g_return_if_fail(userlist->session != NULL);
650 g_return_if_fail(userlist->session->contact != NULL);
651 g_return_if_fail(who != NULL); 652 g_return_if_fail(who != NULL);
652 653
653 user = msn_userlist_find_user(userlist, who); 654 user = msn_userlist_find_user(userlist, who);
654 655
655 msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_FL); 656 msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_FL);
656 657
657 /* delete the contact from address book via soap action */ 658 /* delete the contact from address book via soap action */
658 if (user != NULL) { 659 if (user != NULL) {
659 msn_delete_contact(userlist->session->contact, user->uid); 660 msn_delete_contact(userlist->session, user->uid);
660 } 661 }
661 } 662 }
662 663
663 void 664 void
664 msn_userlist_rem_buddy_from_list(MsnUserList *userlist, const char *who, 665 msn_userlist_rem_buddy_from_list(MsnUserList *userlist, const char *who,
756 757
757 msn_callback_state_set_action(state, MSN_ADD_BUDDY); 758 msn_callback_state_set_action(state, MSN_ADD_BUDDY);
758 759
759 /* Add contact in the Contact server with a SOAP request and if 760 /* Add contact in the Contact server with a SOAP request and if
760 successful, send ADL with MSN_LIST_AL and MSN_LIST_FL and a FQY */ 761 successful, send ADL with MSN_LIST_AL and MSN_LIST_FL and a FQY */
761 msn_add_contact_to_group(userlist->session->contact, state, who, group_id); 762 msn_add_contact_to_group(userlist->session, state, who, group_id);
762 } 763 }
763 764
764 void 765 void
765 msn_userlist_add_buddy_to_list(MsnUserList *userlist, const char *who, 766 msn_userlist_add_buddy_to_list(MsnUserList *userlist, const char *who,
766 MsnListId list_id) 767 MsnListId list_id)
857 const char *new_group_id; 858 const char *new_group_id;
858 MsnCallbackState *state; 859 MsnCallbackState *state;
859 860
860 g_return_if_fail(userlist != NULL); 861 g_return_if_fail(userlist != NULL);
861 g_return_if_fail(userlist->session != NULL); 862 g_return_if_fail(userlist->session != NULL);
862 g_return_if_fail(userlist->session->contact != NULL);
863 863
864 state = msn_callback_state_new(userlist->session); 864 state = msn_callback_state_new(userlist->session);
865 msn_callback_state_set_who(state, who); 865 msn_callback_state_set_who(state, who);
866 msn_callback_state_set_action(state, MSN_MOVE_BUDDY); 866 msn_callback_state_set_action(state, MSN_MOVE_BUDDY);
867 msn_callback_state_set_old_group_name(state, old_group_name); 867 msn_callback_state_set_old_group_name(state, old_group_name);
876 } 876 }
877 877
878 /* add the contact to the new group, and remove it from the old one in 878 /* add the contact to the new group, and remove it from the old one in
879 * the callback 879 * the callback
880 */ 880 */
881 msn_add_contact_to_group(userlist->session->contact, state, who, new_group_id); 881 msn_add_contact_to_group(userlist->session, state, who, new_group_id);
882 } 882 }
883 883
884 /*load userlist from the Blist file cache*/ 884 /*load userlist from the Blist file cache*/
885 void 885 void
886 msn_userlist_load(MsnSession *session) 886 msn_userlist_load(MsnSession *session)