changeset 31427:873cd5e068c4

I tested with AIM 7.2.6.1 and ICQ 7.2 build 3159 and both of them send no status message to indicate that the status message has been cleared. So it really seems like this comment and this behavior is incorrect. This fixes #12988. I haven't noticed any side effects yet. The side effect I'm worried about is that maybe we'll clear someone's status message when we shouldn't (because we receive a userinfo packet without a status message for whatever reason)
author Mark Doliner <mark@kingant.net>
date Thu, 02 Dec 2010 02:35:52 +0000
parents 1203778744d0
children 8ee10aca11b2
files libpurple/protocols/oscar/oscar.c
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c	Tue Nov 30 06:06:14 2010 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Thu Dec 02 02:35:52 2010 +0000
@@ -1366,7 +1366,7 @@
 	const char *status_id;
 	va_list ap;
 	aim_userinfo_t *info;
-	char *message = NULL;
+	char *message;
 	char *itmsurl = NULL;
 
 	gc = od->gc;
@@ -1453,16 +1453,13 @@
 		purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE);
 	}
 
-	/* Empty status means we should unset the status message. NULL status means we should keep it from the previous active status.
-	 * Same goes for itmsurl (which is available only for the "available" status).
-	 */
-	if (info->status != NULL) {
-		message = (info->status_len > 0) ? oscar_encoding_to_utf8(info->status_encoding, info->status, info->status_len) : NULL;
-	} else if (previous_status != NULL) {
-		message = g_strdup(purple_status_get_attr_string(previous_status, "message"));
-	}
+	message = (info->status && info->status_len > 0)
+			? oscar_encoding_to_utf8(info->status_encoding, info->status, info->status_len)
+			: NULL;
 
 	if (strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE) == 0) {
+		/* TODO: If itmsurl is NULL, does that mean the URL has been
+		   cleared?  Or does it mean the URL should remain unchanged? */
 		if (info->itmsurl != NULL) {
 			itmsurl = (info->itmsurl_len > 0) ? oscar_encoding_to_utf8(info->itmsurl_encoding, info->itmsurl, info->itmsurl_len) : NULL;
 		} else if (previous_status != NULL && purple_status_is_available(previous_status)) {