changeset 9329:d42f3e4fd7ad

[gaim-migrate @ 10137] We were ignoring an extra packet the server is sending now on joining a room, which has extra members in it. This makes us process it. We do so one at a time though, so it prints a has joined message for them, which sucks but oh well. This also fixes a "bug" where we were getting confused and thinking keys were values and values were keys. But the reason we were getting confused is pretty weird. I think the server was intentionally trying to confuse us this way, to hide extra data from older clients. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sun, 20 Jun 2004 19:18:42 +0000
parents 33e6b2b92cfe
children b4dc3827470a
files src/protocols/yahoo/yahoo.c src/protocols/yahoo/yahoo_picture.c src/protocols/yahoo/yahoochat.c
diffstat 3 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c	Sun Jun 20 14:46:24 2004 +0000
+++ b/src/protocols/yahoo/yahoo.c	Sun Jun 20 19:18:42 2004 +0000
@@ -103,6 +103,20 @@
 
 		struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1);
 
+		/* this is weird, and in one of the chat packets, and causes us
+		 * think all the values are keys and all the keys are values after
+		 * this point if we don't handle it */
+		if (data[pos] == '\0') {
+			while (pos + 1 < len) {
+				if (data[pos] == 0xc0 && data[pos + 1] == 0x80)
+					break;
+				pos++;
+			}
+			pos += 2;
+			g_free(pair);
+			continue;
+		}
+
 		x = 0;
 		while (pos + 1 < len) {
 			if (data[pos] == 0xc0 && data[pos + 1] == 0x80)
@@ -241,6 +255,8 @@
 
 	yahoo_packet_dump(data, len);
 	ret = write(yd->fd, data, len);
+	if (ret != len)
+		gaim_debug_warning("yahoo", "Only wrote %d of %d bytes!", ret, len);
 	g_free(data);
 
 	return ret;
--- a/src/protocols/yahoo/yahoo_picture.c	Sun Jun 20 14:46:24 2004 +0000
+++ b/src/protocols/yahoo/yahoo_picture.c	Sun Jun 20 19:18:42 2004 +0000
@@ -232,8 +232,10 @@
 	struct yahoo_packet *pkt;
 	char *buf;
 
-	if (!yd->picture_url)
+	if (!yd->picture_url) {
+		gaim_debug_warning("yahoo", "Attempted to send picture info without a picture\n");
 		return;
+	}
 
 	pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, 0);
 	yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
--- a/src/protocols/yahoo/yahoochat.c	Sun Jun 20 14:46:24 2004 +0000
+++ b/src/protocols/yahoo/yahoochat.c	Sun Jun 20 19:18:42 2004 +0000
@@ -398,16 +398,14 @@
 		}
 	}
 
-	if (!room)
-		return;
 
-	if (yd->chat_name && gaim_utf8_strcasecmp(room, yd->chat_name))
+	if (room && yd->chat_name && gaim_utf8_strcasecmp(room, yd->chat_name))
 		yahoo_chat_leave(gc, room,
 				gaim_connection_get_display_name(gc), FALSE);
 
 	c = gaim_find_chat(gc, YAHOO_CHAT_ID);
 
-	if ((!c || gaim_conv_chat_has_left(GAIM_CONV_CHAT(c))) && members &&
+	if (room && (!c || gaim_conv_chat_has_left(GAIM_CONV_CHAT(c))) && members &&
 	   ((g_list_length(members) > 1) ||
 	     !g_ascii_strcasecmp(members->data, gaim_connection_get_display_name(gc)))) {
 		if (c && gaim_conv_chat_has_left(GAIM_CONV_CHAT(c))) {