pidgin: 50e2f2c6: Propagate connect errors from the MSN pr...
qulogic at pidgin.im
qulogic at pidgin.im
Tue Jul 21 02:21:19 EDT 2009
-----------------------------------------------------------------
Revision: 50e2f2c66f304a73c2a9ef4d912be5e3f2ed39a5
Ancestor: 8fb81e99c6fe185a43a410f8095a003604fec30e
Author: qulogic at pidgin.im
Date: 2009-07-21T04:31:27
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/50e2f2c66f304a73c2a9ef4d912be5e3f2ed39a5
Modified files:
libpurple/protocols/msn/httpconn.c
libpurple/protocols/msn/servconn.c
libpurple/protocols/msn/servconn.h
ChangeLog:
Propagate connect errors from the MSN proxy callback to the servconn error
handling function so that the real proxy error is displayed instead of a
generic "Connect Error".
Fixes #8280.
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/httpconn.c 86006fd279cd756cf2f2646a2b33b1aecfa09117
+++ libpurple/protocols/msn/httpconn.c e2d878688a26ac6e0d22bf93825f12aa3e402d4e
@@ -293,7 +293,7 @@ read_cb(gpointer data, gint source, Purp
purple_debug_error("msn", "HTTP: servconn %03d read error, "
"len: %" G_GSSIZE_FORMAT ", errno: %d, error: %s\n",
servconn->num, len, error, g_strerror(errno));
- msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ);
+ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL);
return;
}
@@ -309,7 +309,7 @@ read_cb(gpointer data, gint source, Purp
{
/* Either we must wait for more input, or something went wrong */
if (error)
- msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ);
+ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL);
return;
}
@@ -317,7 +317,7 @@ read_cb(gpointer data, gint source, Purp
if (error)
{
purple_debug_error("msn", "HTTP: Special error\n");
- msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ);
+ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL);
return;
}
@@ -368,7 +368,7 @@ httpconn_write_cb(gpointer data, gint so
return;
/* Error! */
- msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE);
+ msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE, NULL);
return;
}
@@ -394,7 +394,7 @@ write_raw(MsnHttpConn *httpconn, const c
if ((res <= 0) && ((errno != EAGAIN) && (errno != EWOULDBLOCK)))
{
- msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE);
+ msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE, NULL);
return FALSE;
}
@@ -672,7 +672,7 @@ connect_cb(gpointer data, gint source, c
{
purple_debug_error("msn", "HTTP: Connection error: %s\n",
error_message ? error_message : "(null)");
- msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_CONNECT);
+ msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_CONNECT, error_message);
}
}
============================================================
--- libpurple/protocols/msn/servconn.c d60e355fd1b49d4cabcf883b332e77852958c4ce
+++ libpurple/protocols/msn/servconn.c 477d9859f1e8937f49828a78a915d115f2a9cba4
@@ -123,27 +123,29 @@ void
**************************************************************************/
void
-msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error)
+msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error,
+ const char *reason)
{
MsnSession *session = servconn->session;
MsnServConnType type = servconn->type;
- const char *reason;
const char *names[] = { "Notification", "Switchboard" };
const char *name;
name = names[type];
- switch (error)
- {
- case MSN_SERVCONN_ERROR_CONNECT:
- reason = _("Unable to connect"); break;
- case MSN_SERVCONN_ERROR_WRITE:
- reason = _("Writing error"); break;
- case MSN_SERVCONN_ERROR_READ:
- reason = _("Reading error"); break;
- default:
- reason = _("Unknown error"); break;
+ if (reason == NULL) {
+ switch (error)
+ {
+ case MSN_SERVCONN_ERROR_CONNECT:
+ reason = _("Unable to connect"); break;
+ case MSN_SERVCONN_ERROR_WRITE:
+ reason = _("Writing error"); break;
+ case MSN_SERVCONN_ERROR_READ:
+ reason = _("Reading error"); break;
+ default:
+ reason = _("Unknown error"); break;
+ }
}
purple_debug_error("msn", "Connection error from %s server (%s): %s\n",
@@ -196,7 +198,7 @@ connect_cb(gpointer data, gint source, c
else
{
purple_debug_error("msn", "Connection error: %s\n", error_message);
- msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_CONNECT);
+ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_CONNECT, error_message);
}
}
@@ -344,7 +346,7 @@ servconn_write_cb(gpointer data, gint so
if (ret < 0 && errno == EAGAIN)
return;
else if (ret <= 0) {
- msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE);
+ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE, NULL);
return;
}
@@ -401,7 +403,7 @@ msn_servconn_write(MsnServConn *servconn
if (ret == -1)
{
- msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE);
+ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE, NULL);
}
servconn_timeout_renew(servconn);
@@ -427,7 +429,7 @@ read_cb(gpointer data, gint source, Purp
purple_debug_error("msn", "servconn %03d read error, "
"len: %" G_GSSIZE_FORMAT ", errno: %d, error: %s\n",
servconn->num, len, errno, g_strerror(errno));
- msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ);
+ msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL);
return;
}
============================================================
--- libpurple/protocols/msn/servconn.h d03c10a54ddb0563c68837b1f00c2beb610d57f6
+++ libpurple/protocols/msn/servconn.h 3f640a3dd26e50e1d9e822d00bd8740840f968c4
@@ -170,7 +170,8 @@ gssize msn_servconn_write(MsnServConn *s
* @param servconn The servconn.
* @param error The error that happened.
*/
-void msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error);
+void msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error,
+ const char *reason);
/**
* Process the data in servconn->rx_buf. This is called after reading
More information about the Commits
mailing list