Mercurial > pidgin.yaz
diff libpurple/protocols/simple/simple.c @ 27463:f541583e31bd
More uniformity among disconnect error messages
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 06 Jul 2009 09:07:42 +0000 |
parents | b1847ec1ba5f |
children | 2cb6ea4420a0 |
line wrap: on
line diff
--- a/libpurple/protocols/simple/simple.c Mon Jul 06 07:26:12 2009 +0000 +++ b/libpurple/protocols/simple/simple.c Mon Jul 06 09:07:42 2009 +0000 @@ -428,11 +428,13 @@ if(written < 0 && errno == EAGAIN) written = 0; - else if(written <= 0) { + else if (written <= 0) { /*TODO: do we really want to disconnect on a failure to write?*/ + gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), + g_strerror(errno)); purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Could not write")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + g_free(tmp); return; } @@ -441,15 +443,17 @@ static void simple_input_cb(gpointer data, gint source, PurpleInputCondition cond); -static void send_later_cb(gpointer data, gint source, const gchar *error) { +static void send_later_cb(gpointer data, gint source, const gchar *error_message) { PurpleConnection *gc = data; struct simple_account_data *sip; struct sip_connection *conn; if(source < 0) { + gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), + error_message); purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Could not connect")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + g_free(tmp); return; } @@ -475,7 +479,7 @@ if(!sip->connecting) { purple_debug_info("simple", "connecting to %s port %d\n", sip->realhostname ? sip->realhostname : "{NULL}", sip->realport); if (purple_proxy_connect(gc, sip->account, sip->realhostname, sip->realport, send_later_cb, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Couldn't create socket")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); } sip->connecting = TRUE; } @@ -1120,7 +1124,7 @@ purple_account_set_password(sip->gc->account, NULL); purple_connection_error_reason(sip->gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Incorrect password.")); + _("Incorrect password")); return TRUE; } tmp = sipmsg_find_header(msg, "WWW-Authenticate"); @@ -1135,7 +1139,7 @@ if (sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { purple_connection_error_reason(sip->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unknown server response.")); + _("Unknown server response")); return TRUE; } sip->registerstatus = SIMPLE_REGISTER_RETRY; @@ -1729,9 +1733,11 @@ struct sip_connection *conn; if(source < 0) { + gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), + error_message); purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Could not connect")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); + g_free(tmp); return; } @@ -1767,7 +1773,7 @@ if(listenfd == -1) { purple_connection_error_reason(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Could not create listen socket")); + _("Unable to create listen socket")); return; } @@ -1792,7 +1798,7 @@ if (!hosts || !hosts->data) { purple_connection_error_reason(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Couldn't resolve host")); + _("Unable to resolve hostname")); return; } @@ -1813,7 +1819,7 @@ if (sip->listen_data == NULL) { purple_connection_error_reason(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Could not create listen socket")); + _("Unable to create listen socket")); return; } } @@ -1828,7 +1834,7 @@ if(sip->listenfd == -1) { purple_connection_error_reason(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Could not create listen socket")); + _("Unable to create listen socket")); return; } @@ -1843,7 +1849,7 @@ sip->realport, login_cb, sip->gc) == NULL) { purple_connection_error_reason(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Couldn't create socket")); + _("Unable to connect")); } } @@ -1883,7 +1889,7 @@ if (sip->listen_data == NULL) { purple_connection_error_reason(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Could not create listen socket")); + _("Unable to create listen socket")); return; } } else { /* UDP */ @@ -1893,7 +1899,7 @@ if (sip->query_data == NULL) { purple_connection_error_reason(sip->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Could not resolve hostname")); + _("Unable to resolve hostname")); } } }