changeset 15627:2261750cf4e9

Allow setting of the iTunes Music Store URL for AIM accounts. It's similar to your available message. The intention is that you'll have an itms://itunes.com/link?whatever URL for the song you're currently listening to.
author Mark Doliner <mark@kingant.net>
date Tue, 13 Feb 2007 06:58:13 +0000
parents 3548e64b0245
children 2f0f563b3579
files libpurple/protocols/oscar/family_oservice.c libpurple/protocols/oscar/oscar.c libpurple/protocols/oscar/oscar.h
diffstat 3 files changed, 24 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_oservice.c	Mon Feb 12 08:43:04 2007 +0000
+++ b/libpurple/protocols/oscar/family_oservice.c	Tue Feb 13 06:58:13 2007 +0000
@@ -800,7 +800,7 @@
 int
 aim_srv_setextrainfo(OscarData *od,
 		gboolean seticqstatus, guint32 icqstatus,
-		gboolean setavailmsg, const char *availmsg)
+		gboolean setavailmsg, const char *availmsg, const char *itmsurl)
 {
 	FlapConnection *conn;
 	FlapFrame *frame;
@@ -828,20 +828,29 @@
 
 	if (setavailmsg)
 	{
-		int availmsglen;
+		int availmsglen, itmsurllen;
 		ByteStream tmpbs;
 
 		availmsglen = (availmsg != NULL) ? strlen(availmsg) : 0;
+		itmsurllen = (itmsurl != NULL) ? strlen(itmsurl) : 0;
 
-		byte_stream_new(&tmpbs, availmsglen + 8);
+		byte_stream_new(&tmpbs, availmsglen + 8 + itmsurllen + 8);
 		byte_stream_put16(&tmpbs, 0x0002);
-		byte_stream_put8(&tmpbs, 0x04);
+		byte_stream_put8(&tmpbs, 0x04); /* Flags */
 		byte_stream_put8(&tmpbs, availmsglen + 4);
 		byte_stream_put16(&tmpbs, availmsglen);
 		if (availmsglen > 0)
 			byte_stream_putstr(&tmpbs, availmsg);
 		byte_stream_put16(&tmpbs, 0x0000);
 
+		byte_stream_put16(&tmpbs, 0x0009);
+		byte_stream_put8(&tmpbs, 0x04); /* Flags */
+		byte_stream_put8(&tmpbs, itmsurllen + 4);
+		byte_stream_put16(&tmpbs, itmsurllen);
+		if (itmsurllen > 0)
+			byte_stream_putstr(&tmpbs, itmsurl);
+		byte_stream_put16(&tmpbs, 0x0000);
+
 		aim_tlvlist_add_raw(&tl, 0x001d,
 				byte_stream_curpos(&tmpbs), tmpbs.data);
 		g_free(tmpbs.data);
--- a/libpurple/protocols/oscar/oscar.c	Mon Feb 12 08:43:04 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Tue Feb 13 06:58:13 2007 +0000
@@ -3569,7 +3569,7 @@
 	GaimConnection *gc;
 	GaimAccount *account;
 	GaimStatus *status;
-	const char *message;
+	const char *message, *itmsurl;
 	char *tmp;
 	va_list ap;
 	guint16 maxpermits, maxdenies;
@@ -3605,7 +3605,8 @@
 	else
 		message = NULL;
 	tmp = gaim_markup_strip_html(message);
-	aim_srv_setextrainfo(od, FALSE, 0, TRUE, tmp);
+	itmsurl = gaim_status_get_attr_string(status, "itmsurl");
+	aim_srv_setextrainfo(od, FALSE, 0, TRUE, tmp, itmsurl);
 	g_free(tmp);
 
 	aim_srv_setidle(od, 0);
@@ -4411,7 +4412,7 @@
 	else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM))
 		data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY;
 
-	aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL);
+	aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL, NULL);
 }
 
 static void
@@ -4477,7 +4478,7 @@
 	}
 	else if (primitive == GAIM_STATUS_AVAILABLE)
 	{
-		const char *status_html;
+		const char *status_html, *itmsurl;
 		char *status_text = NULL;
 
 		status_html = gaim_status_get_attr_string(status, "message");
@@ -4491,8 +4492,9 @@
 				strcpy(tmp, "...");
 			}
 		}
-
-		aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text);
+		itmsurl = gaim_status_get_attr_string(status, "itmsurl");
+
+		aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text, itmsurl);
 		g_free(status_text);
 
 		/* This is needed for us to un-set any previous away message. */
@@ -5702,6 +5704,8 @@
 										   OSCAR_STATUS_ID_AVAILABLE,
 										   NULL, TRUE, TRUE, FALSE,
 										   "message", _("Message"),
+										   gaim_value_new(GAIM_TYPE_STRING),
+										   "itmsurl", _("iTunes Music Store Link"),
 										   gaim_value_new(GAIM_TYPE_STRING), NULL);
 	status_types = g_list_prepend(status_types, type);
 
--- a/libpurple/protocols/oscar/oscar.h	Mon Feb 12 08:43:04 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.h	Tue Feb 13 06:58:13 2007 +0000
@@ -625,7 +625,7 @@
 /* 0x0014 */ void aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32);
 /* 0x0016 */ void aim_srv_nop(OscarData *od, FlapConnection *conn);
 /* 0x0017 */ void aim_srv_setversions(OscarData *od, FlapConnection *conn);
-/* 0x001e */ int aim_srv_setextrainfo(OscarData *od, gboolean seticqstatus, guint32 icqstatus, gboolean setavailmsg, const char *availmsg);
+/* 0x001e */ int aim_srv_setextrainfo(OscarData *od, gboolean seticqstatus, guint32 icqstatus, gboolean setavailmsg, const char *availmsg, const char *itmsurl);
 
 
 void aim_bos_reqrights(OscarData *od, FlapConnection *conn);