pidgin: c586c7c6: New versions of the official Yahoo Messe...

markdoliner at pidgin.im markdoliner at pidgin.im
Fri Jun 19 14:50:21 EDT 2009


-----------------------------------------------------------------
Revision: c586c7c63e038d187f56cc31c55b1e09dec584d2
Ancestor: 1a49fb1824002eb9a9df7fe2820cb9ddddb7429b
Author: markdoliner at pidgin.im
Date: 2009-06-19T18:46:49
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c586c7c63e038d187f56cc31c55b1e09dec584d2

Modified files:
        libpurple/protocols/yahoo/yahoo.c
        libpurple/protocols/yahoo/yahoo_packet.h

ChangeLog: 

New versions of the official Yahoo Messenger client for Windows XP (tested
with version 9.0.0.2162) seem to require us to acknowledge when we receive
an IM.  If we don't send an ack then they send us the same message 7 seconds
later.

Checking this in because it at least seems to fix the problem for me.
Fixes http://trac.adium.im/ticket/12311

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c	7843dbc20b3873705dc81498fe55757d68587641
+++ libpurple/protocols/yahoo/yahoo.c	9f36b37701756957da8074a7c6c19e73d00c6b03
@@ -813,6 +813,7 @@ struct _yahoo_im {
 	int time;
 	int utf8;
 	int buddy_icon;
+	char *id;
 	char *msg;
 };
 
@@ -930,6 +931,9 @@ static void yahoo_process_message(Purple
 			{
 				imv = pair->value;
 			}
+			if (pair->key == 429)
+				if (im)
+					im->id = pair->value;
 			l = l->next;
 		}
 	} else if (pkt->status == 2) {
@@ -997,6 +1001,28 @@ static void yahoo_process_message(Purple
 			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
============================================================
--- libpurple/protocols/yahoo/yahoo_packet.h	dd4eaf1713d9ac88b89cee6c2ebaa8a429d05d1d
+++ libpurple/protocols/yahoo/yahoo_packet.h	75da8cacb622428d8f0e96717dd72624b09d56d0
@@ -107,6 +107,7 @@ enum yahoo_service { /* these are easier
 	YAHOO_SERVICE_CHGRP_15 = 0xe7,
 	YAHOO_SERVICE_STATUS_15 = 0xf0,
 	YAHOO_SERVICE_LIST_15 = 0xf1,
+	YAHOO_SERVICE_MESSAGE_ACK = 0xfb,
 	YAHOO_SERVICE_WEBLOGIN = 0x0226,
 	YAHOO_SERVICE_SMS_MSG = 0x02ea
 	/* YAHOO_SERVICE_DISCONNECT = 0x07d1 Server forces us to disconnect. Is sent with TCP FIN flag set */


More information about the Commits mailing list