comparison src/protocols/msn/state.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 0317ad172e8d
children 23258253c7a0
comparison
equal deleted inserted replaced
11991:94ba447a6a5c 11992:c824e39db0e7
37 N_("Available"), 37 N_("Available"),
38 N_("Available") 38 N_("Available")
39 }; 39 };
40 40
41 void 41 void
42 msn_change_status(MsnSession *session, MsnAwayType state) 42 msn_change_status(MsnSession *session)
43 { 43 {
44 GaimAccount *account = session->account;
44 MsnCmdProc *cmdproc; 45 MsnCmdProc *cmdproc;
45 MsnUser *user; 46 MsnUser *user;
46 MsnObject *msnobj; 47 MsnObject *msnobj;
47 const char *state_text; 48 const char *state_text;
48 49
49 g_return_if_fail(session != NULL); 50 g_return_if_fail(session != NULL);
50 g_return_if_fail(session->notification != NULL); 51 g_return_if_fail(session->notification != NULL);
51 52
52 cmdproc = session->notification->cmdproc; 53 cmdproc = session->notification->cmdproc;
53 user = session->user; 54 user = session->user;
54 state_text = msn_state_get_text(state); 55 state_text = msn_state_get_text(msn_state_from_account(account));
55 session->state = state;
56 56
57 /* If we're not logged in yet, don't send the status to the server, 57 /* If we're not logged in yet, don't send the status to the server,
58 * it will be sent when login completes 58 * it will be sent when login completes
59 */ 59 */
60 if (!session->logged_in) 60 if (!session->logged_in)
94 static char *status_text[] = 94 static char *status_text[] =
95 { "NLN", "NLN", "BSY", "IDL", "BRB", "AWY", "PHN", "LUN", "HDN", "HDN" }; 95 { "NLN", "NLN", "BSY", "IDL", "BRB", "AWY", "PHN", "LUN", "HDN", "HDN" };
96 96
97 return status_text[state]; 97 return status_text[state];
98 } 98 }
99
100 MsnAwayType
101 msn_state_from_account(GaimAccount *account)
102 {
103 MsnAwayType msnstatus;
104 GaimPresence *presence;
105 GaimStatus *status;
106 const char *status_id;
107
108 presence = gaim_account_get_presence(account);
109 status = gaim_presence_get_active_status(presence);
110 status_id = gaim_status_get_id(status);
111
112 if (!strcmp(status_id, "away"))
113 msnstatus = MSN_AWAY;
114 else if (!strcmp(status_id, "brb"))
115 msnstatus = MSN_BRB;
116 else if (!strcmp(status_id, "busy"))
117 msnstatus = MSN_BUSY;
118 else if (!strcmp(status_id, "phone"))
119 msnstatus = MSN_PHONE;
120 else if (!strcmp(status_id, "lunch"))
121 msnstatus = MSN_LUNCH;
122 else if (!strcmp(status_id, "invisible"))
123 msnstatus = MSN_HIDDEN;
124 else
125 msnstatus = MSN_ONLINE;
126
127 if ((msnstatus == MSN_ONLINE) && gaim_presence_is_idle(presence))
128 msnstatus = MSN_IDLE;
129
130 return msnstatus;
131 }