Mercurial > pidgin
diff 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 |
line wrap: on
line diff
--- a/src/protocols/msn/state.c Sun Nov 06 19:52:20 2005 +0000 +++ b/src/protocols/msn/state.c Sun Nov 06 21:52:00 2005 +0000 @@ -39,8 +39,9 @@ }; void -msn_change_status(MsnSession *session, MsnAwayType state) +msn_change_status(MsnSession *session) { + GaimAccount *account = session->account; MsnCmdProc *cmdproc; MsnUser *user; MsnObject *msnobj; @@ -51,8 +52,7 @@ cmdproc = session->notification->cmdproc; user = session->user; - state_text = msn_state_get_text(state); - session->state = state; + state_text = msn_state_get_text(msn_state_from_account(account)); /* If we're not logged in yet, don't send the status to the server, * it will be sent when login completes @@ -96,3 +96,36 @@ return status_text[state]; } + +MsnAwayType +msn_state_from_account(GaimAccount *account) +{ + MsnAwayType msnstatus; + GaimPresence *presence; + GaimStatus *status; + const char *status_id; + + presence = gaim_account_get_presence(account); + status = gaim_presence_get_active_status(presence); + status_id = gaim_status_get_id(status); + + if (!strcmp(status_id, "away")) + msnstatus = MSN_AWAY; + else if (!strcmp(status_id, "brb")) + msnstatus = MSN_BRB; + else if (!strcmp(status_id, "busy")) + msnstatus = MSN_BUSY; + else if (!strcmp(status_id, "phone")) + msnstatus = MSN_PHONE; + else if (!strcmp(status_id, "lunch")) + msnstatus = MSN_LUNCH; + else if (!strcmp(status_id, "invisible")) + msnstatus = MSN_HIDDEN; + else + msnstatus = MSN_ONLINE; + + if ((msnstatus == MSN_ONLINE) && gaim_presence_is_idle(presence)) + msnstatus = MSN_IDLE; + + return msnstatus; +}