soc.2010.icq-tlc: 91358a64: Miranda expects a client ack from the ot...

ivan.komarov at soc.pidgin.im ivan.komarov at soc.pidgin.im
Thu Aug 5 19:45:39 EDT 2010


----------------------------------------------------------------------
Revision: 91358a647f5e2b4bc54a97012dda7ca9fa4166b9
Parent:   5d7f417b73c2c02920d3342edf6ab5f6431f0432
Author:   ivan.komarov at soc.pidgin.im
Date:     08/05/10 18:45:21
Branch:   im.pidgin.soc.2010.icq-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/91358a647f5e2b4bc54a97012dda7ca9fa4166b9

Changelog: 

Miranda expects a client ack from the other side for channel 2 messages,
so we now send it.

This is based on a patch by Jan Kaluza.

Changes against parent 5d7f417b73c2c02920d3342edf6ab5f6431f0432

  patched  libpurple/protocols/oscar/family_icbm.c
  patched  libpurple/protocols/oscar/oscar.c
  patched  libpurple/protocols/oscar/oscar.h

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	2873af3b3c1469ffe822c69c80d2d40bde8acea0
+++ libpurple/protocols/oscar/oscar.c	001091eb2ef6a431b177595599dc554eb5c920c3
@@ -1758,6 +1758,7 @@ incomingim_chan2(OscarData *od, FlapConn
 				g_free(tmp);
 
 				serv_got_im(gc, userinfo->bn, tmp2, flags, time(NULL));
+				aim_im_send_icq_confirmation(od, userinfo->bn, args->cookie);
 				g_free(tmp2);
 			}
 		} else if (args->info.rtfmsg.msgtype == 26) {
============================================================
--- libpurple/protocols/oscar/family_icbm.c	aaf47da89a215134abe6392f5fb853f7f5971f14
+++ libpurple/protocols/oscar/family_icbm.c	779a51d84665ed0d198226ddb197b34f428a286b
@@ -1605,6 +1605,52 @@ int aim_im_denytransfer(OscarData *od, c
 }
 
 /*
+ * Subtype 0x000b.
+ * Send confirmation for a channel 2 message (Miranda wants it by default).
+ */
+void
+aim_im_send_icq_confirmation(OscarData *od, const char *bn, const guchar *cookie)
+{
+	ByteStream bs;
+	aim_snacid_t snacid;
+	guint32 header_size, data_size;
+	guint16 cookie2 = (guint16)g_random_int();
+
+	purple_debug_misc("oscar", "Sending message ack to %s\n", bn);
+
+	header_size = 8 + 2 + 1 + strlen(bn) + 2;
+	data_size = 2 + 1 + 16 + 4*2 + 2*3 + 4*3 + 1*2 + 2*3 + 1;
+	byte_stream_new(&bs, header_size + data_size);
+
+	/* The message header. */
+	aim_im_puticbm(&bs, cookie, 0x0002, bn);
+	byte_stream_put16(&bs, 0x0003);	/* reason */
+
+	/* The actual message. */
+	byte_stream_putle16(&bs, 0x1b);	/* subheader #1 length */
+	byte_stream_put8(&bs, 0x08);	/* protocol version */
+	byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY);
+	byte_stream_put32(&bs, 0x3);	/* client features */
+	byte_stream_put32(&bs, 0x0004);	/* DC type */
+	byte_stream_put16(&bs, cookie2);	/* a cookie, chosen by fair dice roll */
+	byte_stream_putle16(&bs, 0x0e);	/* header #2 len? */
+	byte_stream_put16(&bs, cookie2);	/* the same cookie again */
+	byte_stream_put32(&bs, 0);	/* unknown */
+	byte_stream_put32(&bs, 0);	/* unknown */
+	byte_stream_put32(&bs, 0);	/* unknown */
+	byte_stream_put8(&bs, 0x01);	/* plain text message */
+	byte_stream_put8(&bs, 0x00);	/* no message flags */
+	byte_stream_put16(&bs, 0x0000);	/* no icq status */
+	byte_stream_put16(&bs, 0x0100);	/* priority */
+	byte_stream_putle16(&bs, 1);	/* query message len */
+	byte_stream_put8(&bs, 0x00);	/* empty query message */
+
+	snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x000b, 0x0000, NULL, 0);
+	flap_connection_send_snac(od, flap_connection_findbygroup(od, SNAC_FAMILY_ICBM), SNAC_FAMILY_ICBM, 0x000b, 0x0000, snacid, &bs);
+	byte_stream_destroy(&bs);
+}
+
+/*
  * Subtype 0x000b - Receive the response from an ICQ status message
  * request (in which case this contains the ICQ status message) or
  * a file transfer or direct IM request was declined.
============================================================
--- libpurple/protocols/oscar/oscar.h	8d8b74cee08b3d344ef192b60a041e352efae7f6
+++ libpurple/protocols/oscar/oscar.h	dde54147235dd02ee01875cf7dbc8818f4722203
@@ -734,6 +734,7 @@ void aim_icbm_makecookie(guchar* cookie)
 /* 0x0014 */ int aim_im_sendmtn(OscarData *od, guint16 type1, const char *bn, guint16 type2);
 /* 0x000b */ int icq_relay_xstatus (OscarData *od, const char *sn, const guchar* cookie);
 void aim_icbm_makecookie(guchar* cookie);
+void aim_im_send_icq_confirmation(OscarData *od, const char *bn, const guchar *cookie);
 
 /* 0x0002 - family_locate.c */
 /*


More information about the Commits mailing list