changeset 16319:bfa7bc0e7b21

Ok I couldn't resist. For iChat and Adium buddies who are advertising an iTunes Music Store link, we now linkify the available message in the user info window.
author Mark Doliner <mark@kingant.net>
date Mon, 23 Apr 2007 07:54:13 +0000
parents 1560f28cb854
children ea82f4e6321e
files libpurple/protocols/jabber/xdata.c libpurple/protocols/oscar/oscar.c
diffstat 2 files changed, 16 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/xdata.c	Mon Apr 23 07:42:57 2007 +0000
+++ b/libpurple/protocols/jabber/xdata.c	Mon Apr 23 07:54:13 2007 +0000
@@ -64,6 +64,8 @@
 				case JABBER_X_DATA_JID_SINGLE:
 					{
 					const char *value = purple_request_field_string_get_value(field);
+					if (value == NULL)
+						break;
 					fieldnode = xmlnode_new_child(result, "field");
 					xmlnode_set_attrib(fieldnode, "var", id);
 					valuenode = xmlnode_new_child(fieldnode, "value");
@@ -75,6 +77,8 @@
 					{
 					char **pieces, **p;
 					const char *value = purple_request_field_string_get_value(field);
+					if (value == NULL)
+						break;
 					fieldnode = xmlnode_new_child(result, "field");
 					xmlnode_set_attrib(fieldnode, "var", id);
 
--- a/libpurple/protocols/oscar/oscar.c	Mon Apr 23 07:42:57 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Mon Apr 23 07:54:13 2007 +0000
@@ -2898,29 +2898,22 @@
 		if (userinfo->status[0] != '\0')
 			tmp = oscar_encoding_to_utf8(userinfo->status_encoding,
 											 userinfo->status, userinfo->status_len);
+#ifdef _WIN32
+		if (userinfo->itmsurl[0] != '\0') {
+			gchar *itmsurl, *tmp2;
+			itmsurl = oscar_encoding_to_utf8(userinfo->itmsurl_encoding,
+					userinfo->itmsurl, userinfo->itmsurl_len);
+			tmp2 = g_strdup_printf("<a href=\"%s\">%s</a>",
+					itmsurl, tmp);
+			g_free(tmp);
+			tmp = tmp2;
+			g_free(itmsurl);
+		}
+#endif
 		oscar_user_info_add_pair(user_info, _("Available Message"), tmp);
 		g_free(tmp);
 	}
 
-#if 0
-	/*
-	 * TODO: This code is disabled because it's kind of stupid.  iTunes
-	 *       doesn't run in Linux.  It'd be cool if we surfaced this URL
-	 *       to Windows users, but it would be better to just linkify
-	 *       the available message, above.
-	 */
-
-	/* iTunes Music Store link */
-	if (userinfo->itmsurl != NULL)
-	{
-		if (userinfo->itmsurl[0] != '\0')
-			tmp = oscar_encoding_to_utf8(userinfo->itmsurl_encoding,
-											 userinfo->itmsurl, userinfo->itmsurl_len);
-		oscar_user_info_add_pair(user_info, _("iTunes Music Store Link"), tmp);
-		g_free(tmp);
-	}
-#endif
-
 	/* Away message */
 	if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) {
 		tmp = oscar_encoding_extract(userinfo->away_encoding);