changeset 9604:8e9727919633

[gaim-migrate @ 10447] Yahoo audibles (text only). (23:58:51) Kevin M Stange: Seriously - do us all a favor and unplug your computer now! committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Tue, 27 Jul 2004 05:23:03 +0000
parents 10939dc36eac
children b5dd5cb72f56
files ChangeLog src/protocols/yahoo/yahoo.c src/protocols/yahoo/yahoo.h
diffstat 3 files changed, 45 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jul 27 04:31:24 2004 +0000
+++ b/ChangeLog	Tue Jul 27 05:23:03 2004 +0000
@@ -5,6 +5,8 @@
 	* The autorecon plugin will somewhat remember state information(Yosef
 	  Radchenko)
 	* Visual display of ops/voice/halfops/so on in Chats (Stu Tomlinson)
+	* The text messages of Yahoo Audibles are now displayed, although
+	  the audio and graphics are not.
 
 	Bug Fixes:
 	* Use ISO date format for the system log (Eduardo Pérez)
--- a/src/protocols/yahoo/yahoo.c	Tue Jul 27 04:31:24 2004 +0000
+++ b/src/protocols/yahoo/yahoo.c	Tue Jul 27 05:23:03 2004 +0000
@@ -1964,6 +1964,46 @@
 	}
 }
 
+static void yahoo_process_audible(GaimConnection *gc, struct yahoo_packet *pkt)
+{
+	char *who = NULL, *msg = NULL;
+	GSList *l = pkt->hash;
+
+	while (l) {
+		struct yahoo_pair *pair = l->data;
+
+		switch (pair->key) {
+		case 4:
+			who = pair->value;
+			break;
+		case 5:
+			/* us */
+			break;
+		case 230:
+			/* the audible, in foo.bar.baz format */
+			break;
+		case 231:
+			/* the text of the audible */
+			msg = pair->value;
+			break;
+		case 232:
+			/* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */
+			break;
+		}
+
+		l = l->next;
+	}
+
+	if (!who || !msg)
+		return;
+	if (!g_utf8_validate(msg, -1, NULL)) {
+		gaim_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n");
+		return;
+	}
+
+	serv_got_im(gc, who, msg, 0, time(NULL));
+}
+
 static void yahoo_packet_process(GaimConnection *gc, struct yahoo_packet *pkt)
 {
 	switch (pkt->service) {
@@ -2068,6 +2108,8 @@
 	case YAHOO_SERVICE_PICTURE_UPLOAD:
 		yahoo_process_picture_upload(gc, pkt);
 		break;
+	case YAHOO_SERVICE_AUDIBLE:
+		yahoo_process_audible(gc, pkt);
 	default:
 		gaim_debug(GAIM_DEBUG_ERROR, "yahoo",
 				   "Unhandled service 0x%02x\n", pkt->service);
--- a/src/protocols/yahoo/yahoo.h	Tue Jul 27 04:31:24 2004 +0000
+++ b/src/protocols/yahoo/yahoo.h	Tue Jul 27 05:23:03 2004 +0000
@@ -117,6 +117,7 @@
 	YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2,
 	YAHOO_SERVICE_YAHOO6_STATUS_UPDATE = 0xc6,
 	YAHOO_SERVICE_AVATAR_UPDATE = 0xc7,
+	YAHOO_SERVICE_AUDIBLE = 0xd0,
 	YAHOO_SERVICE_WEBLOGIN = 0x0226,
 	YAHOO_SERVICE_SMS_MSG = 0x02ea
 };