changeset 6076:8d6aa792e0f6

[gaim-migrate @ 6535] make the jabber error code, and the core error code more betterer. this should fix luke's problem with downed jabber servers committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 10 Jul 2003 18:56:52 +0000
parents f7ddc1f6227e
children b2c8e08508af
files src/connection.c src/protocols/jabber/jabber.c
diffstat 2 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/connection.c	Thu Jul 10 06:55:23 2003 +0000
+++ b/src/connection.c	Thu Jul 10 18:56:52 2003 +0000
@@ -175,9 +175,11 @@
 gboolean
 gaim_connection_disconnect_cb(gpointer data)
 {
-	GaimConnection *gc = data;
+	GaimAccount *account = data;
+	GaimConnection *gc = gaim_account_get_connection(account);
 
-	gaim_connection_disconnect(gc);
+	if(gc)
+		gaim_connection_disconnect(gc);
 
 	return FALSE;
 }
@@ -371,7 +373,8 @@
 	if (ops != NULL && ops->disconnected != NULL)
 		ops->disconnected(gc, text);
 
-	g_timeout_add(0, gaim_connection_disconnect_cb, gc);
+	g_timeout_add(0, gaim_connection_disconnect_cb,
+			gaim_connection_get_account(gc));
 }
 
 void
--- a/src/protocols/jabber/jabber.c	Thu Jul 10 06:55:23 2003 +0000
+++ b/src/protocols/jabber/jabber.c	Thu Jul 10 18:56:52 2003 +0000
@@ -551,13 +551,17 @@
 {
 	if (gjc && gjc->state != JCONN_STATE_OFF) {
 		char *buf = xmlnode2str(x);
-		if (buf)
+		if (buf) {
 #ifndef _WIN32
-			write(gjc->fd, buf, strlen(buf));
+			if(write(gjc->fd, buf, strlen(buf)) < 0) {
 #else
-			send(gjc->fd, buf, strlen(buf), 0);
+			if(send(gjc->fd, buf, strlen(buf), 0) < 0) {
 #endif
-		gaim_debug(GAIM_DEBUG_MISC, "jabber", "gjab_send: %s\n", buf);
+				gaim_connection_error(GJ_GC(gjc), _("Write error"));
+			} else {
+				gaim_debug(GAIM_DEBUG_MISC, "jabber", "gjab_send: %s\n", buf);
+			}
+		}
 	}
 }
 
@@ -572,8 +576,7 @@
 #else
 		if(send(gjc->fd, str, strlen(str), 0) < 0) {
 #endif
-			fprintf(stderr, "DBG: Problem sending.  Error: %d\n", errno);
-			fflush(stderr);
+			gaim_connection_error(GJ_GC(gjc), _("Write error"));
 		}
 		/* printing keepalives to the debug window is really annoying */
 		if(strcmp(str, JABBER_KEEPALIVE_STRING))