comparison src/protocols/msn/msn.c @ 9363:997c28571364

[gaim-migrate @ 10171] Patches by Felipe (shx) to clean up some code, add some segfault precautions, fix chats so that we'll see the other users in the chat correctly after invites, and to have MSN ignore the local buddy list adds if we're not already signed on (which fixes a *very* annoying bug I was having). Thanks again! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 23 Jun 2004 19:38:58 +0000
parents 01c50436203e
children d27156c9c876
comparison
equal deleted inserted replaced
9362:72c88ac84afa 9363:997c28571364
292 static void 292 static void
293 show_send_to_mobile_cb(GaimBlistNode *node, gpointer ignored) 293 show_send_to_mobile_cb(GaimBlistNode *node, gpointer ignored)
294 { 294 {
295 GaimBuddy *buddy; 295 GaimBuddy *buddy;
296 GaimConnection *gc; 296 GaimConnection *gc;
297 MsnUser *user;
298 MsnSession *session; 297 MsnSession *session;
299 MsnMobileData *data; 298 MsnMobileData *data;
300 299
301 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); 300 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
302 301
303 buddy = (GaimBuddy *) node; 302 buddy = (GaimBuddy *) node;
304 gc = gaim_account_get_connection(buddy->account); 303 gc = gaim_account_get_connection(buddy->account);
305 304
306 session = gc->proto_data; 305 session = gc->proto_data;
307 user = msn_userlist_find_user(session->userlist, buddy->name);
308 306
309 data = g_new0(MsnMobileData, 1); 307 data = g_new0(MsnMobileData, 1);
310 data->gc = gc; 308 data->gc = gc;
311 data->passport = buddy->name; 309 data->passport = buddy->name;
312 310
338 msn_switchboard_request_add_user(swboard, buddy->name); 336 msn_switchboard_request_add_user(swboard, buddy->name);
339 337
340 /* TODO: This might move somewhere else, after USR might be */ 338 /* TODO: This might move somewhere else, after USR might be */
341 swboard->chat_id = session->conv_seq++; 339 swboard->chat_id = session->conv_seq++;
342 swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat"); 340 swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
341
342 gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv),
343 gaim_account_get_username(buddy->account), NULL);
343 } 344 }
344 345
345 static void 346 static void
346 t_msn_xfer_init(GaimXfer *xfer) 347 t_msn_xfer_init(GaimXfer *xfer)
347 { 348 {
810 811
811 session = gc->proto_data; 812 session = gc->proto_data;
812 userlist = session->userlist; 813 userlist = session->userlist;
813 who = msn_normalize(gc->account, buddy->name); 814 who = msn_normalize(gc->account, buddy->name);
814 815
816 if (!session->logged_in)
817 return;
818
815 if (group != NULL && group->name != NULL) 819 if (group != NULL && group->name != NULL)
816 gaim_debug_info("msn", "msn_add_buddy: %s, %s\n", who, group->name); 820 gaim_debug_info("msn", "msn_add_buddy: %s, %s\n", who, group->name);
817 else 821 else
818 gaim_debug_info("msn", "msn_add_buddy: %s\n", who); 822 gaim_debug_info("msn", "msn_add_buddy: %s\n", who);
819 823
840 MsnUserList *userlist; 844 MsnUserList *userlist;
841 845
842 session = gc->proto_data; 846 session = gc->proto_data;
843 userlist = session->userlist; 847 userlist = session->userlist;
844 848
849 if (!session->logged_in)
850 return;
851
845 /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */ 852 /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */
846 msn_userlist_rem_buddy(userlist, buddy->name, MSN_LIST_FL, group->name); 853 msn_userlist_rem_buddy(userlist, buddy->name, MSN_LIST_FL, group->name);
847 } 854 }
848 855
849 static void 856 static void
855 862
856 session = gc->proto_data; 863 session = gc->proto_data;
857 userlist = session->userlist; 864 userlist = session->userlist;
858 user = msn_userlist_find_user(userlist, who); 865 user = msn_userlist_find_user(userlist, who);
859 866
860 if (user->list_op & MSN_LIST_BL_OP) 867 if (!session->logged_in)
868 return;
869
870 if (user != NULL && user->list_op & MSN_LIST_BL_OP)
861 msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL); 871 msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL);
862 872
863 msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL); 873 msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL);
864 } 874 }
865 875
872 882
873 session = gc->proto_data; 883 session = gc->proto_data;
874 userlist = session->userlist; 884 userlist = session->userlist;
875 user = msn_userlist_find_user(userlist, who); 885 user = msn_userlist_find_user(userlist, who);
876 886
877 if (user->list_op & MSN_LIST_AL_OP) 887 if (!session->logged_in)
888 return;
889
890 if (user != NULL && user->list_op & MSN_LIST_AL_OP)
878 msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL); 891 msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL);
879 892
880 msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL); 893 msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL);
881 } 894 }
882 895
888 MsnUser *user; 901 MsnUser *user;
889 902
890 session = gc->proto_data; 903 session = gc->proto_data;
891 userlist = session->userlist; 904 userlist = session->userlist;
892 905
906 if (!session->logged_in)
907 return;
908
893 user = msn_userlist_find_user(userlist, who); 909 user = msn_userlist_find_user(userlist, who);
894 910
895 msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL); 911 msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL);
896 912
897 if (user->list_op & MSN_LIST_RL_OP) 913 if (user != NULL && user->list_op & MSN_LIST_RL_OP)
898 msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL); 914 msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL);
899 } 915 }
900 916
901 void 917 void
902 msn_rem_deny(GaimConnection *gc, const char *who) 918 msn_rem_deny(GaimConnection *gc, const char *who)
906 MsnUser *user; 922 MsnUser *user;
907 923
908 session = gc->proto_data; 924 session = gc->proto_data;
909 userlist = session->userlist; 925 userlist = session->userlist;
910 926
927 if (!session->logged_in)
928 return;
929
911 user = msn_userlist_find_user(userlist, who); 930 user = msn_userlist_find_user(userlist, who);
912 931
913 msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL); 932 msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL);
914 933
915 if (user->list_op & MSN_LIST_RL_OP) 934 if (user != NULL && user->list_op & MSN_LIST_RL_OP)
916 msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL); 935 msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL);
917 } 936 }
918 937
919 static void 938 static void
920 msn_set_permit_deny(GaimConnection *gc) 939 msn_set_permit_deny(GaimConnection *gc)