changeset 27012:a667ba192449

merge of '2d746b537f7c15aca747b7df2e1eedb540eb0baf' and 'e09226ff43686401f45368b4047b907c205abfba'
author Paul Aurich <paul@darkrain42.org>
date Fri, 22 May 2009 00:21:49 +0000
parents f82f3dc29f9b (diff) 401f580d56d4 (current diff)
children 6105fa42b60c
files
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/bosh.c	Fri May 22 00:13:38 2009 +0000
+++ b/libpurple/protocols/jabber/bosh.c	Fri May 22 00:21:49 2009 +0000
@@ -301,7 +301,7 @@
 		return;
 	}
 
-	packet = g_string_new("");
+	packet = g_string_new(NULL);
 
 	g_string_printf(packet, "<body "
 	                "rid='%" G_GUINT64_FORMAT "' "
@@ -488,7 +488,7 @@
 }
 
 static void jabber_bosh_connection_boot(PurpleBOSHConnection *conn) {
-	GString *buf = g_string_new("");
+	GString *buf = g_string_new(NULL);
 
 	g_string_printf(buf, "<body content='text/xml; charset=utf-8' "
 	                "secure='true' "
@@ -686,7 +686,7 @@
 	int cnt, count = 0;
 
 	if (!conn->buf)
-		conn->buf = g_string_new("");
+		conn->buf = g_string_new(NULL);
 
 	/* Read once to prime cnt before the loop */
 	if (conn->psc)
@@ -705,7 +705,8 @@
 
 	if (cnt == 0 || (cnt < 0 && errno != EAGAIN)) {
 		if (cnt < 0)
-			purple_debug_info("jabber", "bosh read=%d, errno=%d\n", cnt, errno);
+			purple_debug_info("jabber", "bosh read=%d, errno=%d, error=%s\n",
+			                  cnt, errno, g_strerror(errno));
 		else
 			purple_debug_info("jabber", "bosh server closed the connection\n");
 
@@ -718,8 +719,8 @@
 		/* Process what we do have */
 	}
 
-
-	jabber_bosh_http_connection_process(conn);
+	if (conn->buf->len > 0)
+		jabber_bosh_http_connection_process(conn);
 }
 
 static void