pidgin: 666fdc04: Rename two variables based on insight fr...

markdoliner at pidgin.im markdoliner at pidgin.im
Sun Sep 6 17:20:26 EDT 2009


-----------------------------------------------------------------
Revision: 666fdc04d64fbb0f2e275c735e7edb200b890adc
Ancestor: ea303ca5206ca8f9eb645430e9f1ee7e9ec4ac55
Author: markdoliner at pidgin.im
Date: 2009-09-06T21:16:57
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/666fdc04d64fbb0f2e275c735e7edb200b890adc

Modified files:
        libpurple/protocols/oscar/family_icbm.c
        libpurple/protocols/oscar/oscar.c
        libpurple/protocols/oscar/oscar.h

ChangeLog: 

Rename two variables based on insight from
http://dev.aol.com/aim/oscar/#ICBM__CLIENT_EVENT

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/family_icbm.c	0e2bb3cdad00d000de8475587ad80ef9e2e3381c
+++ libpurple/protocols/oscar/family_icbm.c	ded57ce4424f17f04656b6539fe824e5b2167d17
@@ -2714,7 +2714,7 @@ int aim_im_reqofflinemsgs(OscarData *od)
  * 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 @@ int aim_im_sendmtn(OscarData *od, guint1
 
 	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 @@ int aim_im_sendmtn(OscarData *od, guint1
 	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 @@ static int mtn_receive(OscarData *od, Fl
 	aim_rxcallback_t userfunc;
 	char *bn;
 	guint8 bnlen;
-	guint16 type1, type2;
+	guint16 channel, event;
 
-	byte_stream_advance(bs, 8); /* Unknown - All 0's */
-	type1 = byte_stream_get16(bs);
+	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);
 
============================================================
--- libpurple/protocols/oscar/oscar.c	30e87e6ef00929edd5d21dba83a159533e278e1f
+++ libpurple/protocols/oscar/oscar.c	e8d20222205b810c91ebed0d7193d2004cc2777f
@@ -3230,16 +3230,16 @@ static int purple_parse_mtn(OscarData *o
 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 @@ static int purple_parse_mtn(OscarData *o
 			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;
 	}
 
============================================================
--- libpurple/protocols/oscar/oscar.h	8e6040772095177f4500880d9d532839a6cbe2f0
+++ libpurple/protocols/oscar/oscar.h	2de8c7a05a5eab49b9740237973e5d7e62fb6d17
@@ -1006,7 +1006,7 @@ struct aim_incomingim_ch4_args
 /* 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);


More information about the Commits mailing list