Index: protocols/msn/msn.c
===================================================================
--- protocols/msn/msn.c	(revision ffa5b70b1315d46a8d4a1f81a2cf8aad66d06096)
+++ protocols/msn/msn.c	(revision 6e74911ecf99c3b6ff635f7fab5dfe01badc5ce2)
@@ -178,6 +178,6 @@
 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) {
@@ -187,30 +187,21 @@
 	}
 
-	if (!msn_ns_write(ic, -1, "CHG %d %s %d:%02d\r\n", ++md->trId, md->away_state->code, MSN_CAP1, MSN_CAP2)) {
-		return;
-	}
-
-	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);
+	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);
+
+	g_free(buf);
+	g_free(body);
 }
 
Index: protocols/msn/msn.h
===================================================================
--- protocols/msn/msn.h	(revision ffa5b70b1315d46a8d4a1f81a2cf8aad66d06096)
+++ protocols/msn/msn.h	(revision 6e74911ecf99c3b6ff635f7fab5dfe01badc5ce2)
@@ -67,5 +67,5 @@
 #define MSN_CAP2        0x0000
 
-#define MSN_MESSAGE_HEADERS \
+#define MSN_BASE_HEADERS \
 	"Routing: 1.0\r\n" \
 	"To: 1:%s\r\n" \
@@ -73,5 +73,7 @@
 	"\r\n" \
 	"Reliability: 1.0\r\n" \
-	"\r\n" \
+	"\r\n"
+
+#define MSN_MESSAGE_HEADERS MSN_BASE_HEADERS \
 	"Messaging: 2.0\r\n" \
 	"Message-Type: Text\r\n" \
@@ -81,4 +83,23 @@
 	"\r\n" \
 	"%s"
+
+#define MSN_PUT_HEADERS MSN_BASE_HEADERS \
+	"Publication: 1.0\r\n" \
+	"Uri: %s\r\n" \
+	"Content-Type: %s\r\n" \
+	"Content-Length: %zd\r\n" \
+	"\r\n" \
+	"%s"
+
+#define MSN_PUT_USER_BODY \
+	"<user>" \
+	"<s n=\"PE\"><UserTileLocation></UserTileLocation><FriendlyName>%s</FriendlyName><PSM>%s</PSM><DDP></DDP>" \
+	"<Scene></Scene><ASN></ASN><ColorScheme>-3</ColorScheme><BDG></BDG><RUM>%s</RUM><RUL></RUL><RLT>0</RLT>" \
+	"<RID></RID><SUL></SUL><MachineGuid>%s</MachineGuid></s>" \
+	"<s n=\"IM\"><Status>%s</Status><CurrentMedia></CurrentMedia></s>" \
+	"<sep n=\"PD\"><ClientType>1</ClientType><EpName>%s</EpName><Idle>%s</Idle><State>%s</State></sep>" \
+	"<sep n=\"PE\"><VER>BitlBee:" BITLBEE_VERSION "</VER><TYP>1</TYP><Capabilities>%d:%d</Capabilities></sep>" \
+	"<sep n=\"IM\"><Capabilities>%d:%d</Capabilities></sep>" \
+	"</user>"
 
 #define MSN_TYPING_HEADERS "MIME-Version: 1.0\r\n" \
Index: protocols/msn/msn_util.c
===================================================================
--- protocols/msn/msn_util.c	(revision ffa5b70b1315d46a8d4a1f81a2cf8aad66d06096)
+++ protocols/msn/msn_util.c	(revision 6e74911ecf99c3b6ff635f7fab5dfe01badc5ce2)
@@ -532,13 +532,6 @@
 int msn_ns_set_display_name(struct im_connection *ic, const char *value)
 {
-	struct msn_data *md = ic->proto_data;
-	char fn[strlen(value) * 3 + 1];
-
-	strcpy(fn, value);
-	http_encode(fn);
-
-	/* Note: We don't actually know if the server accepted the new name,
-	   and won't give proper feedback yet if it doesn't. */
-	return msn_ns_write(ic, -1, "PRP %d MFN %s\r\n", ++md->trId, fn);
+	// TODO, implement this through msn_set_away's method
+	return 1;
 }
 
