Mercurial > pidgin
diff src/protocols/msn/session.c @ 7590:3a48ade4f510
[gaim-migrate @ 8208]
The MSNSLP stuff pretty much works. I have it disabled in this commit just
in case, but I should have the rest done tonight. Also, client IDs are now
sent (which was part of the problem), as are the MSNObjects (the other half
of the problem).
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 22 Nov 2003 00:47:24 +0000 |
parents | ff9127038a5a |
children | d0ba2f7b40e7 |
line wrap: on
line diff
--- a/src/protocols/msn/session.c Fri Nov 21 18:12:55 2003 +0000 +++ b/src/protocols/msn/session.c Sat Nov 22 00:47:24 2003 +0000 @@ -37,6 +37,8 @@ session->dispatch_server = g_strdup(server); session->dispatch_port = port; + session->away_state = NULL; + session->users = msn_users_new(); session->groups = msn_groups_new(); @@ -93,6 +95,9 @@ if (session->passport_info.file != NULL) g_free(session->passport_info.file); + if (session->away_state != NULL) + g_free(session->away_state); + g_free(session); } @@ -155,8 +160,8 @@ g_return_val_if_fail(session != NULL, NULL); - if (msn_servconn_send_command(session->notification_conn, - "XFR", "SB") < 0) { + if (msn_servconn_send_command(session->notification_conn, "XFR", "SB") < 0) + { return NULL; } @@ -165,6 +170,49 @@ return swboard; } +gboolean +msn_session_change_status(MsnSession *session, const char *state) +{ + MsnUser *user = session->user; + MsnObject *msnobj; + char buf[MSN_BUF_LEN]; + + g_return_val_if_fail(session != NULL, FALSE); + g_return_val_if_fail(state != NULL, FALSE); + + msnobj = msn_user_get_object(user); + + if (state != session->away_state) + { + if (session->away_state != NULL) + g_free(session->away_state); + + session->away_state = g_strdup(state); + } + + if (msnobj == NULL) + g_snprintf(buf, sizeof(buf), "%s %d", state, MSN_CLIENT_ID); + else + { + char *msnobj_str = msn_object_to_string(msnobj); + + g_snprintf(buf, sizeof(buf), "%s %d %s", state, MSN_CLIENT_ID, + gaim_url_encode(msnobj_str)); + + g_free(msnobj_str); + } + + if (!msn_servconn_send_command(session->notification_conn, "CHG", buf)) + { + gaim_connection_error(gaim_account_get_connection(session->account), + _("Write error")); + + return FALSE; + } + + return TRUE; +} + MsnSwitchBoard * msn_session_find_switch_with_passport(const MsnSession *session, const char *passport) @@ -224,4 +272,3 @@ return NULL; } -