changeset 22129:dd51079b3d8c

Only try to set the itmsurl attribute for the available status. I'd forgotten about that when I changed this a few days ago. As far as I know it's only supported when you're "available." If it works for other statuses then please let me know and I'll make the appropriate changes.
author Mark Doliner <mark@kingant.net>
date Wed, 16 Jan 2008 07:51:44 +0000
parents c7da54111ea0
children 451b7edf79ef d5e8ee52ddcc
files libpurple/protocols/oscar/oscar.c
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c	Wed Jan 16 07:40:12 2008 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Wed Jan 16 07:51:44 2008 +0000
@@ -1735,7 +1735,6 @@
 	int type = 0;
 	gboolean buddy_is_away = FALSE;
 	const char *status_id;
-	char *itmsurl = NULL;
 	va_list ap;
 	aim_userinfo_t *info;
 
@@ -1783,11 +1782,6 @@
 			status_id = OSCAR_STATUS_ID_AVAILABLE;
 	}
 
-	if (info->itmsurl_encoding && info->itmsurl && info->itmsurl_len)
-		/* Grab the iTunes Music Store URL */
-		itmsurl = oscar_encoding_to_utf8(account, info->itmsurl_encoding,
-				info->itmsurl, info->itmsurl_len);
-
 	if (info->flags & AIM_FLAG_WIRELESS)
 	{
 		purple_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_MOBILE, NULL);
@@ -1798,24 +1792,28 @@
 	if (status_id == OSCAR_STATUS_ID_AVAILABLE)
 	{
 		char *message = NULL;
+		char *itmsurl = NULL;
 
 		if (info->status != NULL && info->status[0] != '\0')
 			/* Grab the available message */
 			message = oscar_encoding_to_utf8(account, info->status_encoding,
 					info->status, info->status_len);
 
+		if (info->itmsurl_encoding && info->itmsurl && info->itmsurl_len)
+			/* Grab the iTunes Music Store URL */
+			itmsurl = oscar_encoding_to_utf8(account, info->itmsurl_encoding,
+					info->itmsurl, info->itmsurl_len);
+
 		purple_prpl_got_user_status(account, info->sn, status_id,
 				"message", message, "itmsurl", itmsurl, NULL);
 
 		g_free(message);
+		g_free(itmsurl);
 	}
 	else
 	{
-		purple_prpl_got_user_status(account, info->sn, status_id,
-				"itmsurl", itmsurl, NULL);
-	}
-
-	g_free(itmsurl);
+		purple_prpl_got_user_status(account, info->sn, status_id, NULL);
+	}
 
 	/* Login time stuff */
 	if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE)