diff src/protocols/jabber/jabber.c @ 3074:793fb2e9d53b

[gaim-migrate @ 3088] Less ambiguous error message when you get kicked offline. Thanks, JSeymour. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 17 Mar 2002 20:23:34 +0000
parents 966c4e460ebb
children da324fe688b3
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Sun Mar 17 18:55:39 2002 +0000
+++ b/src/protocols/jabber/jabber.c	Sun Mar 17 20:23:34 2002 +0000
@@ -76,10 +76,15 @@
 
 #define USEROPT_PORT 0
 
+/*
+ * Note: "was_connected" may seem redundant, but it was needed and I
+ * didn't want to touch the Jabber state stuff not specific to Gaim.
+ */
 typedef struct gjconn_struct {
 	/* Core structure */
 	pool p;			/* Memory allocation pool */
 	int state;		/* Connection state flag */
+	int was_connected;	/* We were once connected */
 	int fd;			/* Connection file descriptor */
 	jid user;		/* User info */
 	char *pass;		/* User passwd */
@@ -209,6 +214,7 @@
 	gjc->pass = pstrdup(p, pass);
 
 	gjc->state = JCONN_STATE_OFF;
+	gjc->was_connected = 0;
 	gjc->id = 1;
 	gjc->fd = -1;
 
@@ -249,6 +255,7 @@
 
 	gjab_send_raw(gjc, "</stream:stream>");
 	gjc->state = JCONN_STATE_OFF;
+	gjc->was_connected = 0;
 	close(gjc->fd);
 	gjc->fd = -1;
 	XML_ParserFree(gjc->parser);
@@ -1401,10 +1408,15 @@
 {
 	switch (state) {
 	case JCONN_STATE_OFF:
-		hide_login_progress(GJ_GC(gjc), _("Unable to connect"));
+		if(gjc->was_connected) {
+			hide_login_progress_error(GJ_GC(gjc), _("Connection lost"));
+		} else {
+			hide_login_progress(GJ_GC(gjc), _("Unable to connect"));
+		}
 		signoff(GJ_GC(gjc));
 		break;
 	case JCONN_STATE_CONNECTED:
+		gjc->was_connected = 1;
 		set_login_progress(GJ_GC(gjc), 2, _("Connected"));
 		break;
 	case JCONN_STATE_ON:
@@ -2804,10 +2816,15 @@
 {
 	switch (state) {
 	case JCONN_STATE_OFF:
-		hide_login_progress(GJ_GC(gjc), _("Unable to connect"));
+		if(gjc->was_connected) {
+			hide_login_progress_error(GJ_GC(gjc), _("Connection lost"));
+		} else {
+			hide_login_progress(GJ_GC(gjc), _("Unable to connect"));
+		}
 		signoff(GJ_GC(gjc));
 		break;
 	case JCONN_STATE_CONNECTED:
+		gjc->was_connected = 1;
 		/*
 		 * TBD?
 		set_login_progress(GJ_GC(gjc), 2, _("Connected"));