soc.2010.icq-tlc: b367bdaa: Turns out that ncc doesn't catch everyth...

ivan.komarov at soc.pidgin.im ivan.komarov at soc.pidgin.im
Wed Jul 28 20:01:00 EDT 2010


----------------------------------------------------------------------
Revision: b367bdaac1f79166db0e9478ae30e2a7628f6848
Parent:   410486a14dd2089707546e08d9e4f200e21e33d4
Author:   ivan.komarov at soc.pidgin.im
Date:     07/28/10 14:59:39
Branch:   im.pidgin.soc.2010.icq-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/b367bdaac1f79166db0e9478ae30e2a7628f6848

Changelog: 

Turns out that ncc doesn't catch everything, so continue killing things mercilessly.

Removed AIM_CHATROOM_FLAG_* defines
and everything that wasn't used in purple_conv_chat_info_update()
(pretty much all contents of a packet). Also, removed unused
aim_util_*() and aim_chat_getconn() functions.

Changes against parent 410486a14dd2089707546e08d9e4f200e21e33d4

  patched  libpurple/protocols/oscar/family_chat.c
  patched  libpurple/protocols/oscar/oscar.c
  patched  libpurple/protocols/oscar/oscar.h
  patched  libpurple/protocols/oscar/util.c

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	fa540568484a93f7bf1c03ac002ff36da18f1bfc
+++ libpurple/protocols/oscar/oscar.c	f68e1c25f3cab12fd8a3225dcf445a3d7850bffb
@@ -2512,13 +2512,7 @@ static int purple_conv_chat_info_update(
 
 static int purple_conv_chat_info_update(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
 	va_list ap;
-	aim_userinfo_t *userinfo;
-	struct aim_chat_roominfo *roominfo;
-	char *roomname;
-	int usercount;
-	char *roomdesc;
-	guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
-	guint32 creationtime;
+	guint16 maxmsglen, maxvisiblemsglen;
 	PurpleConnection *gc = od->gc;
 	struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn);
 
@@ -2526,16 +2520,7 @@ static int purple_conv_chat_info_update(
 		return 1;
 
 	va_start(ap, fr);
-	roominfo = va_arg(ap, struct aim_chat_roominfo *);
-	roomname = va_arg(ap, char *);
-	usercount= va_arg(ap, int);
-	userinfo = va_arg(ap, aim_userinfo_t *);
-	roomdesc = va_arg(ap, char *);
-	unknown_c9 = (guint16)va_arg(ap, unsigned int);
-	creationtime = va_arg(ap, guint32);
 	maxmsglen = (guint16)va_arg(ap, unsigned int);
-	unknown_d2 = (guint16)va_arg(ap, unsigned int);
-	unknown_d5 = (guint16)va_arg(ap, unsigned int);
 	maxvisiblemsglen = (guint16)va_arg(ap, unsigned int);
 	va_end(ap);
 
============================================================
--- libpurple/protocols/oscar/util.c	0076ddaff720c3bd454128dc379f9f1b45b36a0e
+++ libpurple/protocols/oscar/util.c	dae80a75d25e816eb1257b250d266097631a5694
@@ -107,91 +107,6 @@ gchar *oscar_get_clientstring(void)
 	return g_strdup_printf("%s/%s", name, version);;
 }
 
-/*
- * Tokenizing functions.  Used to portably replace strtok/sep.
- *   -- DMP.
- *
- */
-/* TODO: Get rid of this and use glib functions */
-int
-aimutil_tokslen(char *toSearch, int theindex, char dl)
-{
-	int curCount = 1;
-	char *next;
-	char *last;
-	int toReturn;
-
-	last = toSearch;
-	next = strchr(toSearch, dl);
-
-	while(curCount < theindex && next != NULL) {
-		curCount++;
-		last = next + 1;
-		next = strchr(last, dl);
-	}
-
-	if ((curCount < theindex) || (next == NULL))
-		toReturn = strlen(toSearch) - (curCount - 1);
-	else
-		toReturn = next - toSearch - (curCount - 1);
-
-	return toReturn;
-}
-
-int
-aimutil_itemcnt(char *toSearch, char dl)
-{
-	int curCount;
-	char *next;
-
-	curCount = 1;
-
-	next = strchr(toSearch, dl);
-
-	while(next != NULL) {
-		curCount++;
-		next = strchr(next + 1, dl);
-	}
-
-	return curCount;
-}
-
-char *
-aimutil_itemindex(char *toSearch, int theindex, char dl)
-{
-	int curCount;
-	char *next;
-	char *last;
-	char *toReturn;
-
-	curCount = 0;
-
-	last = toSearch;
-	next = strchr(toSearch, dl);
-
-	while (curCount < theindex && next != NULL) {
-		curCount++;
-		last = next + 1;
-		next = strchr(last, dl);
-	}
-	next = strchr(last, dl);
-
-	if (curCount < theindex) {
-		toReturn = g_malloc(sizeof(char));
-		*toReturn = '\0';
-	} else {
-		if (next == NULL) {
-			toReturn = g_malloc((strlen(last) + 1) * sizeof(char));
-			strcpy(toReturn, last);
-		} else {
-			toReturn = g_malloc((next - last + 1) * sizeof(char));
-			memcpy(toReturn, last, (next - last));
-			toReturn[next - last] = '\0';
-		}
-	}
-	return toReturn;
-}
-
 /**
  * Calculate the checksum of a given icon.
  */
============================================================
--- libpurple/protocols/oscar/family_chat.c	556b9a0e887eb643ef7235484d70967c445a0f2c
+++ libpurple/protocols/oscar/family_chat.c	e58b81d1573f775ba029e2d584a6eb654c88f55b
@@ -47,36 +47,6 @@ flap_connection_destroy_chat(OscarData *
 	return;
 }
 
-/* XXX get this into conn.c -- evil!! */
-FlapConnection *
-aim_chat_getconn(OscarData *od, const char *name)
-{
-	GSList *cur;
-
-	for (cur = od->oscar_connections; cur; cur = cur->next)
-	{
-		FlapConnection *conn;
-		struct chatconnpriv *ccp;
-
-		conn = cur->data;
-		ccp = (struct chatconnpriv *)conn->internal;
-
-		if (conn->type != SNAC_FAMILY_CHAT)
-			continue;
-		if (!conn->internal)
-		{
-			purple_debug_misc("oscar", "%sfaim: chat: chat connection with no name! (fd = %d)\n",
-					conn->gsc ? "(ssl) " : "", conn->gsc ? conn->gsc->fd : conn->fd);
-			continue;
-		}
-
-		if (strcmp(ccp->name, name) == 0)
-			return conn;
-	}
-
-	return NULL;
-}
-
 int
 aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo)
 {
@@ -102,21 +72,12 @@ infoupdate(OscarData *od, FlapConnection
 static int
 infoupdate(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
 {
-	aim_userinfo_t *userinfo = NULL;
 	aim_rxcallback_t userfunc;
 	int ret = 0;
-	int usercount;
 	guint8 detaillevel = 0;
-	char *roomname;
 	struct aim_chat_roominfo roominfo;
-	guint16 tlvcount = 0;
 	GSList *tlvlist;
-	aim_tlv_t *tlv;
-	char *roomdesc;
-	guint16 flags;
-	guint32 creationtime;
 	guint16 maxmsglen, maxvisiblemsglen;
-	guint16 unknown_d2, unknown_d5;
 
 	aim_chat_readroominfo(bs, &roominfo);
 
@@ -127,139 +88,27 @@ infoupdate(OscarData *od, FlapConnection
 		return 1;
 	}
 
-	tlvcount = byte_stream_get16(bs);
-
 	/*
 	 * Everything else are TLVs.
 	 */
 	tlvlist = aim_tlvlist_read(bs);
 
 	/*
-	 * TLV type 0x006a is the room name in Human Readable Form.
-	 */
-	roomname = aim_tlv_getstr(tlvlist, 0x006a, 1);
-
-	/*
-	 * Type 0x006f: Number of occupants.
-	 */
-	usercount = aim_tlv_get16(tlvlist, 0x006f, 1);
-
-	/*
-	 * Type 0x0073:  Occupant list.
-	 */
-	tlv = aim_tlv_gettlv(tlvlist, 0x0073, 1);
-	if (tlv != NULL)
-	{
-		int curoccupant = 0;
-		ByteStream occbs;
-
-		/* Allocate enough userinfo structs for all occupants */
-		userinfo = g_new0(aim_userinfo_t, usercount);
-
-		byte_stream_init(&occbs, tlv->value, tlv->length);
-
-		while (curoccupant < usercount)
-			aim_info_extract(od, &occbs, &userinfo[curoccupant++]);
-	}
-
-	/*
-	 * Type 0x00c9: Flags. (AIM_CHATROOM_FLAG)
-	 */
-	flags = aim_tlv_get16(tlvlist, 0x00c9, 1);
-
-	/*
-	 * Type 0x00ca: Creation time (4 bytes)
-	 */
-	creationtime = aim_tlv_get32(tlvlist, 0x00ca, 1);
-
-	/*
 	 * Type 0x00d1: Maximum Message Length
 	 */
 	maxmsglen = aim_tlv_get16(tlvlist, 0x00d1, 1);
 
 	/*
-	 * Type 0x00d2: Unknown. (2 bytes)
-	 */
-	unknown_d2 = aim_tlv_get16(tlvlist, 0x00d2, 1);
-
-	/*
-	 * Type 0x00d3: Room Description
-	 */
-	roomdesc = aim_tlv_getstr(tlvlist, 0x00d3, 1);
-
-#if 0
-	/*
-	 * Type 0x000d4: Unknown (flag only)
-	 */
-	if (aim_tlv_gettlv(tlvlist, 0x000d4, 1)) {
-		/* Unhandled */
-	}
-#endif
-
-	/*
-	 * Type 0x00d5: Unknown. (1 byte)
-	 */
-	unknown_d5 = aim_tlv_get8(tlvlist, 0x00d5, 1);
-
-#if 0
-	/*
-	 * Type 0x00d6: Encoding 1 ("us-ascii")
-	 */
-	if (aim_tlv_gettlv(tlvlist, 0x000d6, 1)) {
-		/* Unhandled */
-	}
-
-	/*
-	 * Type 0x00d7: Language 1 ("en")
-	 */
-	if (aim_tlv_gettlv(tlvlist, 0x000d7, 1)) {
-		/* Unhandled */
-	}
-
-	/*
-	 * Type 0x00d8: Encoding 2 ("us-ascii")
-	 */
-	if (aim_tlv_gettlv(tlvlist, 0x000d8, 1)) {
-		/* Unhandled */
-	}
-
-	/*
-	 * Type 0x00d9: Language 2 ("en")
-	 */
-	if (aim_tlv_gettlv(tlvlist, 0x000d9, 1)) {
-		/* Unhandled */
-	}
-#endif
-
-	/*
 	 * Type 0x00da: Maximum visible message length
 	 */
 	maxvisiblemsglen = aim_tlv_get16(tlvlist, 0x00da, 1);
 
 	if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) {
-		ret = userfunc(od, conn,
-				frame,
-				&roominfo,
-				roomname,
-				usercount,
-				userinfo,
-				roomdesc,
-				flags,
-				creationtime,
-				maxmsglen,
-				unknown_d2,
-				unknown_d5,
-				maxvisiblemsglen);
+		ret = userfunc(od, conn, frame, maxmsglen, maxvisiblemsglen);
 	}
 
 	g_free(roominfo.name);
 
-	while (usercount > 0)
-		aim_info_free(&userinfo[--usercount]);
-
-	g_free(userinfo);
-	g_free(roomname);
-	g_free(roomdesc);
 	aim_tlvlist_free(tlvlist);
 
 	return ret;
============================================================
--- libpurple/protocols/oscar/oscar.h	4d71f00678eab7a9634e4d9a899700879a6b6dec
+++ libpurple/protocols/oscar/oscar.h	875657ef6d3c8c054c4ae9d089259596f838b699
@@ -1138,16 +1138,6 @@ int aim_search_address(OscarData *, cons
 /* 0x000a - family_userlookup.c */
 int aim_search_address(OscarData *, const char *);
 
-
-
-/* 0x000d - family_chatnav.c */
-/* 0x000e - family_chat.c */
-/* These apply to exchanges as well. */
-#define AIM_CHATROOM_FLAG_EVILABLE 0x0001
-#define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002
-#define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004
-#define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008
-
 struct aim_chat_exchangeinfo
 {
 	guint16 number;
@@ -1163,7 +1153,6 @@ int aim_chat_join(OscarData *od, guint16
 #define AIM_CHATFLAGS_AWAY      0x0002
 int aim_chat_send_im(OscarData *od, FlapConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language);
 int aim_chat_join(OscarData *od, guint16 exchange, const char *roomname, guint16 instance);
-FlapConnection *aim_chat_getconn(OscarData *, const char *name);
 
 void aim_chatnav_reqrights(OscarData *od, FlapConnection *conn);
 
@@ -1472,9 +1461,6 @@ guint16 aimutil_iconsum(const guint8 *bu
 gchar *oscar_get_clientstring(void);
 
 guint16 aimutil_iconsum(const guint8 *buf, int buflen);
-int aimutil_tokslen(char *toSearch, int theindex, char dl);
-int aimutil_itemcnt(char *toSearch, char dl);
-char *aimutil_itemindex(char *toSearch, int theindex, char dl);
 
 gboolean oscar_util_valid_name(const char *bn);
 gboolean oscar_util_valid_name_icq(const char *bn);


More information about the Commits mailing list