comparison src/protocols/msn/msn.c @ 11992:c824e39db0e7

[gaim-migrate @ 14285] - make Offline a user setable status in MSN - redo MSN status changing to query the core for the current status instead of keeping track of it itself, as recommended by Mark on patch #1336338. - bring back the buddy list synchronization by parsing the buddy list after signon committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 06 Nov 2005 21:52:00 +0000
parents 52f27ffe68a5
children cbebda5f019c
comparison
equal deleted inserted replaced
11991:94ba447a6a5c 11992:c824e39db0e7
564 { 564 {
565 GaimStatusType *status; 565 GaimStatusType *status;
566 GList *types = NULL; 566 GList *types = NULL;
567 567
568 status = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, 568 status = gaim_status_type_new_full(GAIM_STATUS_OFFLINE,
569 "offline", _("Offline"), FALSE, FALSE, FALSE); 569 "offline", _("Offline"), FALSE, TRUE, FALSE);
570 types = g_list_append(types, status); 570 types = g_list_append(types, status);
571 571
572 status = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, 572 status = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE,
573 "available", _("Available"), FALSE, TRUE, FALSE); 573 "available", _("Available"), FALSE, TRUE, FALSE);
574 types = g_list_append(types, status); 574 types = g_list_append(types, status);
871 871
872 static void 872 static void
873 msn_set_status(GaimAccount *account, GaimStatus *status) 873 msn_set_status(GaimAccount *account, GaimStatus *status)
874 { 874 {
875 GaimConnection *gc; 875 GaimConnection *gc;
876 MsnSession *session = NULL; 876 MsnSession *session;
877 const char *state;
878 int msnstatus;
879 877
880 gc = gaim_account_get_connection(account); 878 gc = gaim_account_get_connection(account);
881 879
882 if (gc != NULL) 880 if (gc != NULL)
881 {
883 session = gc->proto_data; 882 session = gc->proto_data;
884 883 msn_change_status(session);
885 state = gaim_status_get_id(status); 884 }
886
887 gaim_debug_info("msn", "Set status to %s\n", gaim_status_get_name(status));
888
889 if (!strcmp(state, "away"))
890 msnstatus = MSN_AWAY;
891 else if (!strcmp(state, "brb"))
892 msnstatus = MSN_BRB;
893 else if (!strcmp(state, "busy"))
894 msnstatus = MSN_BUSY;
895 else if (!strcmp(state, "phone"))
896 msnstatus = MSN_PHONE;
897 else if (!strcmp(state, "lunch"))
898 msnstatus = MSN_LUNCH;
899 else if (!strcmp(state, "invisible"))
900 msnstatus = MSN_HIDDEN;
901 else if (0) /* how do we detect idle with new status? */
902 msnstatus = MSN_IDLE;
903 else
904 msnstatus = MSN_ONLINE;
905 if (gc)
906 msn_change_status(session, msnstatus);
907 } 885 }
908 886
909 static void 887 static void
910 msn_set_idle(GaimConnection *gc, int idle) 888 msn_set_idle(GaimConnection *gc, int idle)
911 { 889 {
912 MsnSession *session; 890 MsnSession *session;
913 891
914 session = gc->proto_data; 892 session = gc->proto_data;
915 893
916 msn_change_status(session, (idle ? MSN_IDLE : MSN_ONLINE)); 894 msn_change_status(session);
917 } 895 }
918 896
897 #if 0
919 static void 898 static void
920 fake_userlist_add_buddy(MsnUserList *userlist, 899 fake_userlist_add_buddy(MsnUserList *userlist,
921 const char *who, int list_id, 900 const char *who, int list_id,
922 const char *group_name) 901 const char *group_name)
923 { 902 {
961 GINT_TO_POINTER(group_id)); 940 GINT_TO_POINTER(group_id));
962 } 941 }
963 942
964 user->list_op |= (1 << list_id); 943 user->list_op |= (1 << list_id);
965 } 944 }
945 #endif
966 946
967 static void 947 static void
968 msn_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) 948 msn_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group)
969 { 949 {
970 MsnSession *session; 950 MsnSession *session;
975 userlist = session->userlist; 955 userlist = session->userlist;
976 who = msn_normalize(gc->account, buddy->name); 956 who = msn_normalize(gc->account, buddy->name);
977 957
978 if (!session->logged_in) 958 if (!session->logged_in)
979 { 959 {
960 #if 0
980 fake_userlist_add_buddy(session->sync_userlist, who, MSN_LIST_FL, 961 fake_userlist_add_buddy(session->sync_userlist, who, MSN_LIST_FL,
981 group ? group->name : NULL); 962 group ? group->name : NULL);
963 #else
964 gaim_debug_error("msn", "msn_add_buddy called before connected\n");
965 #endif
982 966
983 return; 967 return;
984 } 968 }
985 969
986 #if 0 970 #if 0
1324 session = gc->proto_data; 1308 session = gc->proto_data;
1325 user = session->user; 1309 user = session->user;
1326 1310
1327 msn_user_set_buddy_icon(user, filename); 1311 msn_user_set_buddy_icon(user, filename);
1328 1312
1329 msn_change_status(session, session->state); 1313 msn_change_status(session);
1330 } 1314 }
1331 1315
1332 static void 1316 static void
1333 msn_remove_group(GaimConnection *gc, GaimGroup *group) 1317 msn_remove_group(GaimConnection *gc, GaimGroup *group)
1334 { 1318 {