changeset 25914:39d80604007e

Backport and apply Mark's changes in c586c7c63e038d187f56cc31c55b1e09dec584d2.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Fri, 19 Jun 2009 21:13:44 +0000
parents 2209f3440538
children e88a127bfa6d
files libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo_packet.h
diffstat 2 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Fri Jun 19 21:10:02 2009 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Fri Jun 19 21:13:44 2009 +0000
@@ -748,6 +748,7 @@
 	int time;
 	int utf8;
 	int buddy_icon;
+	char *id;
 	char *msg;
 };
 
@@ -790,6 +791,9 @@
 			{
 				imv = pair->value;
 			}
+			if (pair->key == 429)
+				if (im)
+					im->id = pair->value;
 			l = l->next;
 		}
 	} else if (pkt->status == 2) {
@@ -845,6 +849,28 @@
 			return;
 		}
 
+		/*
+		 * TODO: Is there anything else we should check when determining whether
+		 *       we should send an acknowledgement?
+		 */
+		if (im->id != NULL) {
+			/* Send acknowledgement.  If we don't do this then the official
+			 * Yahoo Messenger client for Windows will send us the same
+			 * message 7 seconds later as an offline message.  This is true
+			 * for at least version 9.0.0.2162 on Windows XP. */
+			struct yahoo_packet *pkt2;
+			pkt2 = yahoo_packet_new(YAHOO_SERVICE_MESSAGE_ACK,
+					YAHOO_STATUS_AVAILABLE, pkt->id);
+			yahoo_packet_hash(pkt2, "ssisii",
+					1, purple_connection_get_display_name(gc),
+					5, im->from,
+					302, 430,
+					430, im->id,
+					303, 430,
+					450, 0);
+			yahoo_packet_send_and_free(pkt2, yd);
+		}
+
 		m = yahoo_string_decode(gc, im->msg, im->utf8);
 		/* This may actually not be necessary, but it appears
 		 * that at least at one point some clients were sending
--- a/libpurple/protocols/yahoo/yahoo_packet.h	Fri Jun 19 21:10:02 2009 +0000
+++ b/libpurple/protocols/yahoo/yahoo_packet.h	Fri Jun 19 21:13:44 2009 +0000
@@ -102,6 +102,7 @@
 	YAHOO_SERVICE_CHGRP_15 = 0xe7,
 	YAHOO_SERVICE_STATUS_15 = 0xf0,
 	YAHOO_SERVICE_LIST_15 = 0xf1,
+	YAHOO_SERVICE_MESSAGE_ACK = 0xfb,
 	YAHOO_SERVICE_FILETRANS_15 = 0xdc,
 	YAHOO_SERVICE_FILETRANS_INFO_15 = 0xdd,
 	YAHOO_SERVICE_FILETRANS_ACC_15 = 0xde,