changeset 12798:09d4ea834370

[gaim-migrate @ 15145] SF Patch #1389870 from Bleeter, building on work in SF Patch #1114194 from Alex Badea "Following on from #1114194, where I thought that sending audibles is a little twitty because we can't see what's going on, I also noted that it would be nice if we could display the URL wheree the audible swf file lived. The example URL provided only supported US locales, which also needed addressing. I've tested this patch with the Taiwain audible, named within the patch, by confirming that the URL pattern match actually works. Whether it actually works when sent from a Taiwanese YIM native client, I have no idea. It looks like it should. Just to re-iterate: This patch displays the the received audible's URL and text only, not the audible swf file itself, nor does it send anything." committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 09 Jan 2006 22:28:17 +0000
parents eda1572c788b
children 6234099a4b37
files COPYRIGHT src/protocols/yahoo/yahoo.c src/protocols/yahoo/yahoo.h
diffstat 3 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Mon Jan 09 21:29:53 2006 +0000
+++ b/COPYRIGHT	Mon Jan 09 22:28:17 2006 +0000
@@ -10,6 +10,7 @@
 Daniel Atallah
 Paul Aurich
 Patrick Aussems
+Alex Badea
 John Bailey
 Luca Barbato
 Levi Bard
--- a/src/protocols/yahoo/yahoo.c	Mon Jan 09 21:29:53 2006 +0000
+++ b/src/protocols/yahoo/yahoo.c	Mon Jan 09 22:28:17 2006 +0000
@@ -1955,7 +1955,7 @@
 
 static void yahoo_process_audible(GaimConnection *gc, struct yahoo_packet *pkt)
 {
-	char *who = NULL, *msg = NULL;
+	char *who = NULL, *msg = NULL, *id = NULL;
 	GSList *l = pkt->hash;
 
 	while (l) {
@@ -1969,7 +1969,9 @@
 			/* us */
 			break;
 		case 230:
-			/* the audible, in foo.bar.baz format */
+			/* the audible, in foo.locale.bar.baz format
+			   eg: base.tw.smiley.smiley43 */
+			id = pair->value;
 			break;
 		case 231:
 			/* the text of the audible */
@@ -1983,6 +1985,8 @@
 		l = l->next;
 	}
 
+	if (!msg)
+		msg = id;
 	if (!who || !msg)
 		return;
 	if (!g_utf8_validate(msg, -1, NULL)) {
@@ -1994,7 +1998,16 @@
 		      gc->account->username, who);
 		return;
 	}
-	serv_got_im(gc, who, msg, 0, time(NULL));
+	if (id) {
+		/* "http://us.dl1.yimg.com/download.yahoo.com/dl/aud/"+locale+"/"+id+".swf" */
+		char **audible_locale = g_strsplit(id, ".", 0);
+		char *buf = g_strdup_printf(_("[ Audible %s/%s/%s.swf ] %s"), YAHOO_AUDIBLE_URL, audible_locale[1], id, msg);
+		g_strfreev(audible_locale);
+
+		serv_got_im(gc, who, buf, 0, time(NULL));
+		g_free(buf);
+	} else
+		serv_got_im(gc, who, msg, 0, time(NULL));
 }
 
 static void yahoo_packet_process(GaimConnection *gc, struct yahoo_packet *pkt)
@@ -2109,6 +2122,7 @@
 		break;
 	case YAHOO_SERVICE_AUDIBLE:
 		yahoo_process_audible(gc, pkt);
+		break;
 	default:
 		gaim_debug(GAIM_DEBUG_ERROR, "yahoo",
 				   "Unhandled service 0x%02x\n", pkt->service);
--- a/src/protocols/yahoo/yahoo.h	Mon Jan 09 21:29:53 2006 +0000
+++ b/src/protocols/yahoo/yahoo.h	Mon Jan 09 22:28:17 2006 +0000
@@ -43,6 +43,8 @@
 #define YAHOOJP_XFER_HOST "filetransfer.msg.yahoo.co.jp"
 #define YAHOOJP_WEBCAM_HOST "wc.yahoo.co.jp"
 
+#define YAHOO_AUDIBLE_URL "http://us.dl1.yimg.com/download.yahoo.com/dl/aud"
+
 #define WEBMESSENGER_URL "http://login.yahoo.com/config/login?.src=pg"
 
 #define YAHOO_ICON_CHECKSUM_KEY "icon_checksum"