changeset 25495:b81b1732fb64

- follow a change in oscar. - add workarounds for crash in yahoo_set_idle().
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 31 May 2007 11:30:42 +0000
parents a79b96ba2b49
children 295777a9e2a4
files libpurple/protocols/oscar/family_icbm.c libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo_packet.c
diffstat 3 files changed, 21 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_icbm.c	Thu May 31 07:40:00 2007 +0000
+++ b/libpurple/protocols/oscar/family_icbm.c	Thu May 31 11:30:42 2007 +0000
@@ -459,7 +459,7 @@
 	ByteStream hdrbs;
 	// yaz
 	char *ucs = NULL;
-	int bytes;
+	gsize bytes;
 
 	if (!od || !(conn = flap_connection_findbygroup(od, 0x0004)))
 		return -EINVAL;
@@ -517,9 +517,9 @@
 		byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */
 		byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT);
 
-		aim_tlvlist_add_16(&itl, 0x000a, 0x0001);
-		aim_tlvlist_add_noval(&itl, 0x000f);
-		aim_tlvlist_add_raw(&itl, 0x000c, strlen(msg), msg);
+		aim_tlvlist_add_16(&inner_tlvlist, 0x000a, 0x0001);
+		aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
+		aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, strlen(msg), msg);
 		free(ucs);
 	} else {
 		byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2+4+11);
@@ -540,12 +540,12 @@
 		}
 	}
 #if 0
-	aim_tlvlist_add_16(&itl, 0x000a, 0x0001);
-	aim_tlvlist_add_noval(&itl, 0x000f);
-	aim_tlvlist_add_str(&itl, 0x000c, msg);
+	aim_tlvlist_add_16(&inner_tlvlist, 0x000a, 0x0001);
+	aim_tlvlist_add_noval(&inner_tlvlist, 0x000f);
+	aim_tlvlist_add_str(&inner_tlvlist, 0x000c, msg);
 #endif
-	aim_tlvlist_add_chatroom(&itl, 0x2711, exchange, roomname, instance);
-	aim_tlvlist_write(&hdrbs, &itl);
+	aim_tlvlist_add_chatroom(&inner_tlvlist, 0x2711, exchange, roomname, instance);
+	aim_tlvlist_write(&hdrbs, &inner_tlvlist);
 
 	aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
 	g_free(hdrbs.data);
--- a/libpurple/protocols/yahoo/yahoo.c	Thu May 31 07:40:00 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Thu May 31 11:30:42 2007 +0000
@@ -3442,6 +3442,10 @@
 	}
 
 	pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0);
+	if(!pkt) {
+		purple_debug_info("yahoo", "yahoo_set_idle: pkt == NULL\n");
+		return;
+	}
 
 	yahoo_packet_hash_int(pkt, 10, yd->current_status);
 	if (yd->current_status == YAHOO_STATUS_CUSTOM) {
@@ -3452,7 +3456,7 @@
 		if (tmp != NULL) {
 			msg = yahoo_string_encode(gc, tmp, NULL);
 			msg2 = purple_markup_strip_html(msg);
-			yahoo_packet_hash_str(pkt, 19, msg2);
+			yahoo_packet_hash_str(pkt, 19, msg2); // yaz: pkt may be NULL.
 		} else {
 			/* get_yahoo_status_from_purple_status() returns YAHOO_STATUS_CUSTOM for
 			 * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */
--- a/libpurple/protocols/yahoo/yahoo_packet.c	Thu May 31 07:40:00 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoo_packet.c	Thu May 31 11:30:42 2007 +0000
@@ -42,6 +42,7 @@
 {
 	struct yahoo_pair *pair;
 
+	g_return_if_fail(pkt != NULL);
 	g_return_if_fail(value != NULL);
 
 	pair = g_new0(struct yahoo_pair, 1);
@@ -54,6 +55,9 @@
 {
 	struct yahoo_pair *pair;
 
+	g_return_if_fail(pkt != NULL);
+	g_return_if_fail(value != NULL);
+
 	pair = g_new0(struct yahoo_pair, 1);
 	pair->key = key;
 	pair->value = g_strdup_printf("%d", value);
@@ -368,6 +372,9 @@
 {
 	int ret;
 
+	g_return_if_fail(pkt != NULL);
+	g_return_if_fail(yd != NULL);
+
 	ret = yahoo_packet_send(pkt, yd);
 	yahoo_packet_free(pkt);
 	return ret;