--- a/libpurple/protocols/jabber/auth.c Wed Sep 19 15:01:47 2007 +0000
+++ b/libpurple/protocols/jabber/auth.c Wed Sep 19 15:03:59 2007 +0000
@@ -49,7 +49,8 @@
"<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1);
} else if(xmlnode_get_child(starttls, "required")) {
- purple_connection_error(js->gc, _("Server requires TLS/SSL for login. No TLS/SSL support found."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_ENCRYPTION_ERROR, + _("Server requires TLS/SSL for login. No TLS/SSL support found.")); @@ -112,7 +113,8 @@
static void disallow_plaintext_auth(PurpleAccount *account)
- purple_connection_error(account->gc, _("Server requires plaintext authentication over an unencrypted stream"));
+ purple_connection_error_reason (account->gc, PURPLE_REASON_ENCRYPTION_ERROR, + _("Server requires plaintext authentication over an unencrypted stream")); @@ -253,7 +255,8 @@
- purple_connection_error(conn, _("Password is required to sign on."));
+ purple_connection_error_reason (conn, PURPLE_REASON_AUTHENTICATION_FAILED, + _("Password is required to sign on.")); static void jabber_auth_start_cyrus(JabberStream *js)
@@ -329,7 +332,9 @@
- purple_connection_error(js->gc, _("Server does not use any supported authentication method"));
+ purple_connection_error_reason (js->gc, + PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE, + _("Server does not use any supported authentication method")); @@ -384,7 +389,9 @@
- purple_connection_error(js->gc, "SASL authentication failed\n");
+ purple_connection_error_reason (js->gc, + PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE, + "SASL authentication failed\n"); @@ -457,7 +464,8 @@
mechs = xmlnode_get_child(packet, "mechanisms");
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + _("Invalid response from server.")); @@ -517,7 +525,7 @@
finish_plaintext_authentication(js);
- purple_connection_error(js->gc,
+ purple_connection_error_reason (js->gc, PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE, _("Server does not use any supported authentication method"));
@@ -543,7 +551,7 @@
purple_account_set_password(js->gc->account, NULL);
- purple_connection_error(js->gc, msg);
+ purple_connection_error_reason (js->gc, PURPLE_REASON_OTHER_ERROR, msg); @@ -556,11 +564,13 @@
const char *pw = purple_connection_get_password(js->gc);
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + _("Invalid response from server.")); } else if(!strcmp(type, "error")) {
char *msg = jabber_parse_error(js, packet);
- purple_connection_error(js->gc, msg);
+ purple_connection_error_reason (js->gc, PURPLE_REASON_AUTHENTICATION_FAILED, } else if(!strcmp(type, "result")) {
query = xmlnode_get_child(packet, "query");
@@ -604,8 +614,9 @@
finish_plaintext_authentication(js);
- purple_connection_error(js->gc,
- _("Server does not use any supported authentication method"));
+ purple_connection_error_reason (js->gc, + PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE, + _("Server does not use any supported authentication method")); @@ -771,7 +782,8 @@
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + _("Invalid response from server.")); @@ -792,7 +804,8 @@
"<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />",
- purple_connection_error(js->gc, _("Invalid challenge from server"));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + _("Invalid challenge from server")); g_free(js->expected_rspauth);
@@ -815,7 +828,8 @@
realm = js->user->domain;
if (nonce == NULL || realm == NULL)
- purple_connection_error(js->gc, _("Invalid challenge from server"));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + _("Invalid challenge from server")); GString *response = g_string_new("");
@@ -887,7 +901,8 @@
if (js->sasl_state != SASL_CONTINUE && js->sasl_state != SASL_OK) {
purple_debug_error("jabber", "Error is %d : %s\n",js->sasl_state,sasl_errdetail(js->sasl));
- purple_connection_error(js->gc, _("SASL error"));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, response = xmlnode_new("response");
@@ -912,7 +927,8 @@
if(!ns || strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + _("Invalid response from server.")); @@ -937,7 +953,8 @@
if (js->sasl_state != SASL_OK) {
/* This should never happen! */
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + _("Invalid response from server.")); /* If we've negotiated a security layer, we need to enable it */
@@ -956,9 +973,11 @@
char *msg = jabber_parse_error(js, packet);
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + _("Invalid response from server.")); - purple_connection_error(js->gc, msg);
+ purple_connection_error_reason (js->gc, PURPLE_REASON_AUTHENTICATION_FAILED, --- a/libpurple/protocols/jabber/jabber.c Wed Sep 19 15:01:47 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c Wed Sep 19 15:03:59 2007 +0000
@@ -89,7 +89,8 @@
jabber_unregister_account_cb(js);
- purple_connection_error(js->gc, _("Error initializing session"));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + ("Error initializing session")); @@ -120,7 +121,8 @@
JabberBuddy *my_jb = NULL;
jabber_id_free(js->user);
if(!(js->user = jabber_id_new(full_jid))) {
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + _("Invalid response from server.")); if((my_jb = jabber_buddy_find(js, full_jid, TRUE)))
my_jb->subscription |= JABBER_SUB_BOTH;
@@ -128,7 +130,7 @@
char *msg = jabber_parse_error(js, packet);
- purple_connection_error(js->gc, msg);
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, msg); @@ -142,7 +144,8 @@
} else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !js->gsc) {
js->gc->wants_to_die = TRUE;
- purple_connection_error(js->gc, _("You require encryption, but it is not available on this server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_ENCRYPTION_ERROR, + _("You require encryption, but it is not available on this server.")); @@ -175,7 +178,10 @@
char *msg = jabber_parse_error(js, packet);
- purple_connection_error(js->gc, msg);
+ if (js->gc->wants_to_die) + purple_connection_error_reason (js->gc, PURPLE_REASON_OTHER_ERROR, msg); + purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, msg); @@ -256,7 +262,8 @@
if (ret < 0 && errno == EAGAIN)
- purple_connection_error(js->gc, _("Write error"));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, @@ -309,7 +316,9 @@
if (ret < 0 && errno != EAGAIN)
- purple_connection_error(js->gc, _("Write error"));
+ purple_connection_error_reason (js->gc, + PURPLE_REASON_NETWORK_ERROR, @@ -337,7 +346,9 @@
if (ret < 0 && errno != EAGAIN)
- purple_connection_error(js->gc, _("Write error"));
+ purple_connection_error_reason (js->gc, + PURPLE_REASON_NETWORK_ERROR, @@ -405,7 +416,9 @@
- purple_connection_error(gc, _("Read Error"));
+ purple_connection_error_reason (js->gc, + PURPLE_REASON_NETWORK_ERROR, @@ -442,7 +455,9 @@
} else if(errno == EAGAIN) {
- purple_connection_error(gc, _("Read Error"));
+ purple_connection_error_reason (js->gc, + PURPLE_REASON_NETWORK_ERROR, @@ -481,7 +496,7 @@
tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"),
- purple_connection_error(gc, tmp);
+ purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, tmp); @@ -509,7 +524,7 @@
- purple_connection_error(gc, purple_ssl_strerror(error));
+ purple_connection_ssl_error (gc, error); static void tls_init(JabberStream *js)
@@ -526,7 +541,8 @@
if (purple_proxy_connect(js->gc, js->gc->account, host,
port, jabber_login_callback, js->gc) == NULL)
- purple_connection_error(js->gc, _("Unable to create socket"));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + _("Unable to create socket")); static void srv_resolved_cb(PurpleSrvResponse *resp, int results, gpointer data)
@@ -572,12 +588,14 @@
- purple_connection_error(gc, _("Invalid XMPP ID"));
+ purple_connection_error_reason (gc, PURPLE_REASON_INVALID_USERNAME, if (!js->user->domain || *(js->user->domain) == '\0') {
- purple_connection_error(gc, _("Invalid XMPP ID. Domain must be set."));
+ purple_connection_error_reason (gc, PURPLE_REASON_INVALID_USERNAME, + _("Invalid XMPP ID. Domain must be set.")); @@ -607,7 +625,8 @@
purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl,
jabber_ssl_connect_failure, js->gc);
- purple_connection_error(js->gc, _("SSL support unavailable"));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_ENCRYPTION_ERROR, + _("SSL support unavailable")); @@ -1060,7 +1079,8 @@
- purple_connection_error(gc, _("Invalid XMPP ID"));
+ purple_connection_error_reason (gc, PURPLE_REASON_INVALID_USERNAME, @@ -1092,7 +1112,8 @@
purple_account_get_int(account, "port", 5222),
jabber_login_callback_ssl, jabber_ssl_connect_failure, gc);
- purple_connection_error(gc, _("SSL support unavailable"));
+ purple_connection_error_reason (gc, PURPLE_REASON_ENCRYPTION_ERROR, + _("SSL support unavailable")); --- a/libpurple/protocols/jabber/parser.c Wed Sep 19 15:01:47 2007 +0000
+++ b/libpurple/protocols/jabber/parser.c Wed Sep 19 15:03:59 2007 +0000
@@ -193,7 +193,8 @@
js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL);
xmlParseChunk(js->context, "", 0, 0);
} else if (xmlParseChunk(js->context, buf, len, 0) < 0) {
- purple_connection_error(js->gc, _("XML Parse error"));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_OTHER_ERROR,