changeset 28229:8d5380556f12

Rename two variables based on insight from http://dev.aol.com/aim/oscar/#ICBM__CLIENT_EVENT
author Mark Doliner <mark@kingant.net>
date Sun, 06 Sep 2009 21:16:57 +0000
parents 98c5109a3d1f
children dc0c781dce10
files libpurple/protocols/oscar/family_icbm.c libpurple/protocols/oscar/oscar.c libpurple/protocols/oscar/oscar.h
diffstat 3 files changed, 26 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_icbm.c	Sun Sep 06 21:07:56 2009 +0000
+++ b/libpurple/protocols/oscar/family_icbm.c	Sun Sep 06 21:16:57 2009 +0000
@@ -2714,7 +2714,7 @@
  * and Purple 0.60 and newer.
  *
  */
-int aim_im_sendmtn(OscarData *od, guint16 type1, const char *bn, guint16 type2)
+int aim_im_sendmtn(OscarData *od, guint16 channel, const char *bn, guint16 event)
 {
 	FlapConnection *conn;
 	ByteStream bs;
@@ -2730,19 +2730,14 @@
 
 	snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0014, 0x0000, NULL, 0);
 
-	/*
-	 * 8 days of light
-	 * Er, that is to say, 8 bytes of 0's
-	 */
-	byte_stream_put16(&bs, 0x0000);
-	byte_stream_put16(&bs, 0x0000);
-	byte_stream_put16(&bs, 0x0000);
-	byte_stream_put16(&bs, 0x0000);
+	/* ICBM cookie */
+	byte_stream_put32(&bs, 0x00000000);
+	byte_stream_put32(&bs, 0x00000000);
 
 	/*
-	 * Type 1 (should be 0x0001 for mtn)
+	 * Channel (should be 0x0001 for mtn)
 	 */
-	byte_stream_put16(&bs, type1);
+	byte_stream_put16(&bs, channel);
 
 	/*
 	 * Dest buddy name
@@ -2751,9 +2746,9 @@
 	byte_stream_putstr(&bs, bn);
 
 	/*
-	 * Type 2 (should be 0x0000, 0x0001, or 0x0002 for mtn)
+	 * Event (should be 0x0000, 0x0001, or 0x0002 for mtn)
 	 */
-	byte_stream_put16(&bs, type2);
+	byte_stream_put16(&bs, event);
 
 	flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0014, 0x0000, snacid, &bs);
 
@@ -2775,16 +2770,16 @@
 	aim_rxcallback_t userfunc;
 	char *bn;
 	guint8 bnlen;
-	guint16 type1, type2;
-
-	byte_stream_advance(bs, 8); /* Unknown - All 0's */
-	type1 = byte_stream_get16(bs);
+	guint16 channel, event;
+
+	byte_stream_advance(bs, 8); /* ICBM cookie */
+	channel = byte_stream_get16(bs);
 	bnlen = byte_stream_get8(bs);
 	bn = byte_stream_getstr(bs, bnlen);
-	type2 = byte_stream_get16(bs);
+	event = byte_stream_get16(bs);
 
 	if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
-		ret = userfunc(od, conn, frame, type1, bn, type2);
+		ret = userfunc(od, conn, frame, channel, bn, event);
 
 	g_free(bn);
 
--- a/libpurple/protocols/oscar/oscar.c	Sun Sep 06 21:07:56 2009 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Sun Sep 06 21:16:57 2009 +0000
@@ -3230,16 +3230,16 @@
 static int purple_parse_mtn(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	PurpleConnection *gc = od->gc;
 	va_list ap;
-	guint16 type1, type2;
+	guint16 channel, event;
 	char *bn;
 
 	va_start(ap, fr);
-	type1 = (guint16) va_arg(ap, unsigned int);
+	channel = (guint16) va_arg(ap, unsigned int);
 	bn = va_arg(ap, char *);
-	type2 = (guint16) va_arg(ap, unsigned int);
+	event = (guint16) va_arg(ap, unsigned int);
 	va_end(ap);
 
-	switch (type2) {
+	switch (event) {
 		case 0x0000: { /* Text has been cleared */
 			serv_got_typing_stopped(gc, bn);
 		} break;
@@ -3252,12 +3252,14 @@
 			serv_got_typing(gc, bn, 0, PURPLE_TYPING);
 		} break;
 
+		case 0x000f: { /* Closed IM window */
+			serv_got_typing_stopped(gc, bn);
+		} break;
+
 		default: {
-			/*
-			 * It looks like iChat sometimes sends typing notification
-			 * with type1=0x0001 and type2=0x000f.  Not sure why.
-			 */
-			purple_debug_info("oscar", "Received unknown typing notification message from %s.  Type1 is 0x%04x and type2 is 0x%04hx.\n", bn, type1, type2);
+			purple_debug_info("oscar", "Received unknown typing "
+					"notification message from %s.  Channel is 0x%04x "
+					"and event is 0x%04hx.\n", bn, channel, event);
 		} break;
 	}
 
--- a/libpurple/protocols/oscar/oscar.h	Sun Sep 06 21:07:56 2009 +0000
+++ b/libpurple/protocols/oscar/oscar.h	Sun Sep 06 21:16:57 2009 +0000
@@ -1006,7 +1006,7 @@
 /* 0x0008 */ int aim_im_warn(OscarData *od, FlapConnection *conn, const char *destbn, guint32 flags);
 /* 0x000b */ int aim_im_denytransfer(OscarData *od, const char *bn, const guchar *cookie, guint16 code);
 /* 0x0010 */ int aim_im_reqofflinemsgs(OscarData *od);
-/* 0x0014 */ int aim_im_sendmtn(OscarData *od, guint16 type1, const char *bn, guint16 type2);
+/* 0x0014 */ int aim_im_sendmtn(OscarData *od, guint16 channel, const char *bn, guint16 event);
 void aim_icbm_makecookie(guchar* cookie);
 gchar *oscar_encoding_extract(const char *encoding);
 gchar *oscar_encoding_to_utf8(PurpleAccount *account, const char *encoding, const char *text, int textlen);