# HG changeset patch # User Sean Egan # Date 1016396614 0 # Node ID 793fb2e9d53b456b8f194ccd8e9244cbcbe05244 # Parent 22c82a341c320543b49475d68c76a0873ad0774f [gaim-migrate @ 3088] Less ambiguous error message when you get kicked offline. Thanks, JSeymour. committer: Tailor Script diff -r 22c82a341c32 -r 793fb2e9d53b src/multi.c --- a/src/multi.c Sun Mar 17 18:55:39 2002 +0000 +++ b/src/multi.c Sun Mar 17 20:23:34 2002 +0000 @@ -1401,6 +1401,17 @@ hide_login_progress_common(gc, why, _("Notice"), gc->username); } +/* + * Like hide_login_progress(), but for non-signon error messages. + * + */ +void hide_login_progress_error(struct gaim_connection *gc, char *why) +{ + char buf[2048]; + g_snprintf(buf, sizeof(buf), _("%s has been signed off"), gc->username); + hide_login_progress_common(gc, why, _("Connection Error"), buf); +} + void signoff_all() { GSList *c = connections; diff -r 22c82a341c32 -r 793fb2e9d53b src/multi.h --- a/src/multi.h Sun Mar 17 18:55:39 2002 +0000 +++ b/src/multi.h Sun Mar 17 20:23:34 2002 +0000 @@ -112,5 +112,6 @@ void set_login_progress(struct gaim_connection *, float, char *); void hide_login_progress(struct gaim_connection *, char *); void hide_login_progress_notice(struct gaim_connection *, char *); +void hide_login_progress_error(struct gaim_connection *, char *); #endif /* _MULTI_H_ */ diff -r 22c82a341c32 -r 793fb2e9d53b src/protocols/irc/irc.c --- a/src/protocols/irc/irc.c Sun Mar 17 18:55:39 2002 +0000 +++ b/src/protocols/irc/irc.c Sun Mar 17 20:23:34 2002 +0000 @@ -1161,7 +1161,7 @@ i = read(idata->fd, buf, 1024); if (i <= 0) { - hide_login_progress(gc, "Read error"); + hide_login_progress_error(gc, "Read error"); signoff(gc); return; } diff -r 22c82a341c32 -r 793fb2e9d53b src/protocols/jabber/jabber.c --- 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, ""); 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")); diff -r 22c82a341c32 -r 793fb2e9d53b src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Sun Mar 17 18:55:39 2002 +0000 +++ b/src/protocols/msn/msn.c Sun Mar 17 20:23:34 2002 +0000 @@ -1205,7 +1205,7 @@ len = read(md->fd, buf, sizeof(buf)); if (len <= 0) { - hide_login_progress(gc, "Error reading from server"); + hide_login_progress_error(gc, "Error reading from server"); signoff(gc); return; } diff -r 22c82a341c32 -r 793fb2e9d53b src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Sun Mar 17 18:55:39 2002 +0000 +++ b/src/protocols/oscar/oscar.c Sun Mar 17 20:23:34 2002 +0000 @@ -375,7 +375,7 @@ if ((conn->type == AIM_CONN_TYPE_BOS) || !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { debug_printf(_("major connection error\n")); - hide_login_progress(gc, _("Disconnected.")); + hide_login_progress_error(gc, _("Disconnected.")); signoff(gc); } else if (conn->type == AIM_CONN_TYPE_CHAT) { struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); diff -r 22c82a341c32 -r 793fb2e9d53b src/protocols/toc/toc.c --- a/src/protocols/toc/toc.c Sun Mar 17 18:55:39 2002 +0000 +++ b/src/protocols/toc/toc.c Sun Mar 17 20:23:34 2002 +0000 @@ -486,7 +486,7 @@ /* there's data waiting to be read, so read it. */ if (wait_reply(gc, buf, 8 * 1024) <= 0) { - hide_login_progress(gc, _("Connection Closed")); + hide_login_progress_error(gc, _("Connection Closed")); signoff(gc); return; } diff -r 22c82a341c32 -r 793fb2e9d53b src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Sun Mar 17 18:55:39 2002 +0000 +++ b/src/protocols/yahoo/yahoo.c Sun Mar 17 20:23:34 2002 +0000 @@ -711,7 +711,7 @@ len = read(yd->fd, buf, sizeof(buf)); if (len <= 0) { - hide_login_progress(gc, "Unable to read"); + hide_login_progress_error(gc, "Unable to read"); signoff(gc); return; }