aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/msn/msn.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/msn/msn.c')
-rw-r--r--protocols/msn/msn.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index c1b5ce77..a2f13104 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -177,8 +177,8 @@ static GList *msn_away_states(struct im_connection *ic)
static void msn_set_away(struct im_connection *ic, char *state, char *message)
{
- //char *uux;
struct msn_data *md = ic->proto_data;
+ char *nick, *psm, *idle, *statecode, *body, *buf;
if (state == NULL) {
md->away_state = msn_away_state_list;
@@ -186,32 +186,23 @@ static void msn_set_away(struct im_connection *ic, char *state, char *message)
md->away_state = msn_away_state_list + 1;
}
- if (!msn_ns_write(ic, -1, "CHG %d %s %d:%02d\r\n", ++md->trId, md->away_state->code, MSN_CAP1, MSN_CAP2)) {
- return;
- }
+ statecode = (char *) md->away_state->code;
+ nick = set_getstr(&ic->acc->set, "display_name");
+ psm = message ? message : "";
+ idle = strcmp(statecode, "IDL") ? "false" : "true";
+
+ body = g_markup_printf_escaped(MSN_PUT_USER_BODY,
+ nick, psm, psm, md->uuid, statecode, md->uuid, idle, statecode,
+ MSN_CAP1, MSN_CAP2, MSN_CAP1, MSN_CAP2
+ );
+
+ buf = g_strdup_printf(MSN_PUT_HEADERS, ic->acc->user, ic->acc->user, md->uuid,
+ "/user", "application/user+xml",
+ strlen(body), body);
+ msn_ns_write(ic, -1, "PUT %d %zd\r\n%s", ++md->trId, strlen(buf), buf);
- uux = g_markup_printf_escaped("<EndpointData><Capabilities>%d:%02d"
- "</Capabilities></EndpointData>",
- MSN_CAP1, MSN_CAP2);
- msn_ns_write(ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen(uux), uux);
- g_free(uux);
-
- uux = g_markup_printf_escaped("<PrivateEndpointData><EpName>%s</EpName>"
- "<Idle>%s</Idle><ClientType>%d</ClientType>"
- "<State>%s</State></PrivateEndpointData>",
- md->uuid,
- strcmp(md->away_state->code, "IDL") ? "false" : "true",
- 1, /* ? */
- md->away_state->code);
- msn_ns_write(ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen(uux), uux);
- g_free(uux);
-
- uux = g_markup_printf_escaped("<Data><DDP></DDP><PSM>%s</PSM>"
- "<CurrentMedia></CurrentMedia>"
- "<MachineGuid>%s</MachineGuid></Data>",
- message ? message : "", md->uuid);
- msn_ns_write(ic, -1, "UUX %d %zd\r\n%s", ++md->trId, strlen(uux), uux);
- g_free(uux);
+ g_free(buf);
+ g_free(body);
}
static void msn_get_info(struct im_connection *ic, char *who)