im.pidgin.cpw.resiak.disconnectreason: a0fa9a976cc97e5d5a629a47490b757e0d5fbcdf
resiak at soc.pidgin.im
resiak at soc.pidgin.im
Wed Oct 3 13:57:30 EDT 2007
revision: a0fa9a976cc97e5d5a629a47490b757e0d5fbcdf
date: 2007-09-19T15:03:59
author: resiak at soc.pidgin.im
branch: im.pidgin.cpw.resiak.disconnectreason
changelog:
Use PurpleDisconnectReasons in prpl-jabber.
manifest:
format_version "1"
new_manifest [fb073ddba12cdcf314e727023ac3837377d74739]
old_revision [67c56a6c8e6b6373f9fccc1b6bf859ba5d0d10db]
patch "libpurple/protocols/jabber/auth.c"
from [43d0094f5eb9cee59b3edc6cbe6e7a9a430167df]
to [a4fd733d1146134bd72696af0398319f53055b57]
patch "libpurple/protocols/jabber/jabber.c"
from [9566f6a2fd23699865c6a8ba16b2315d3daa3153]
to [8191cbff23ad0d3c6c575bedbb597ac7e3dfe1e6]
patch "libpurple/protocols/jabber/parser.c"
from [1b318b9d587444798232cf9664a84dae8b5b66af]
to [e10abdfaf92499f8e3b23d4375f9b8fcfb5c8de8]
-------------- next part --------------
#
#
# patch "libpurple/protocols/jabber/auth.c"
# from [43d0094f5eb9cee59b3edc6cbe6e7a9a430167df]
# to [a4fd733d1146134bd72696af0398319f53055b57]
#
# patch "libpurple/protocols/jabber/jabber.c"
# from [9566f6a2fd23699865c6a8ba16b2315d3daa3153]
# to [8191cbff23ad0d3c6c575bedbb597ac7e3dfe1e6]
#
# patch "libpurple/protocols/jabber/parser.c"
# from [1b318b9d587444798232cf9664a84dae8b5b66af]
# to [e10abdfaf92499f8e3b23d4375f9b8fcfb5c8de8]
#
============================================================
--- libpurple/protocols/jabber/auth.c 43d0094f5eb9cee59b3edc6cbe6e7a9a430167df
+++ libpurple/protocols/jabber/auth.c a4fd733d1146134bd72696af0398319f53055b57
@@ -49,7 +49,8 @@ jabber_process_starttls(JabberStream *js
"<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1);
return TRUE;
} 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."));
return TRUE;
}
}
@@ -112,7 +113,8 @@ static void disallow_plaintext_auth(Purp
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"));
}
#ifdef HAVE_CYRUS_SASL
@@ -253,7 +255,8 @@ auth_no_pass_cb(PurpleConnection *conn,
js = conn->proto_data;
- 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 @@ static void jabber_auth_start_cyrus(Jabb
* error here.
*/
} else {
- 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"));
return;
}
/* not reached */
@@ -384,7 +389,9 @@ static void jabber_auth_start_cyrus(Jabb
jabber_send(js, auth);
xmlnode_free(auth);
} else {
- 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 @@ jabber_auth_start(JabberStream *js, xmln
mechs = xmlnode_get_child(packet, "mechanisms");
if(!mechs) {
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR,
+ _("Invalid response from server."));
return;
}
@@ -517,7 +525,7 @@ jabber_auth_start(JabberStream *js, xmln
}
finish_plaintext_authentication(js);
} else {
- purple_connection_error(js->gc,
+ purple_connection_error_reason (js->gc, PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE,
_("Server does not use any supported authentication method"));
}
#endif
@@ -543,7 +551,7 @@ static void auth_old_result_cb(JabberStr
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);
g_free(msg);
}
}
@@ -556,11 +564,13 @@ static void auth_old_cb(JabberStream *js
const char *pw = purple_connection_get_password(js->gc);
if(!type) {
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR,
+ _("Invalid response from server."));
return;
} 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,
+ msg);
g_free(msg);
} else if(!strcmp(type, "result")) {
query = xmlnode_get_child(packet, "query");
@@ -604,8 +614,9 @@ static void auth_old_cb(JabberStream *js
}
finish_plaintext_authentication(js);
} else {
- 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"));
return;
}
}
@@ -771,7 +782,8 @@ jabber_auth_handle_challenge(JabberStrea
GHashTable *parts;
if(!enc_in) {
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR,
+ _("Invalid response from server."));
return;
}
@@ -792,7 +804,8 @@ jabber_auth_handle_challenge(JabberStrea
"<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />",
-1);
} else {
- 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);
} else {
@@ -815,7 +828,8 @@ jabber_auth_handle_challenge(JabberStrea
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"));
else {
GString *response = g_string_new("");
char *a2;
@@ -887,7 +901,8 @@ jabber_auth_handle_challenge(JabberStrea
g_free(dec_in);
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,
+ _("SASL error"));
return;
} else {
response = xmlnode_new("response");
@@ -912,7 +927,8 @@ void jabber_auth_handle_success(JabberSt
#endif
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."));
return;
}
@@ -937,7 +953,8 @@ void jabber_auth_handle_success(JabberSt
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 @@ void jabber_auth_handle_failure(JabberSt
char *msg = jabber_parse_error(js, packet);
if(!msg) {
- purple_connection_error(js->gc, _("Invalid response from server."));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR,
+ _("Invalid response from server."));
} else {
- purple_connection_error(js->gc, msg);
+ purple_connection_error_reason (js->gc, PURPLE_REASON_AUTHENTICATION_FAILED,
+ msg);
g_free(msg);
}
}
============================================================
--- libpurple/protocols/jabber/jabber.c 9566f6a2fd23699865c6a8ba16b2315d3daa3153
+++ libpurple/protocols/jabber/jabber.c 8191cbff23ad0d3c6c575bedbb597ac7e3dfe1e6
@@ -89,7 +89,8 @@ jabber_session_initialized_cb(JabberStre
if(js->unregistration)
jabber_unregister_account_cb(js);
} else {
- 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 @@ static void jabber_bind_result_cb(Jabber
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 @@ static void jabber_bind_result_cb(Jabber
}
} else {
char *msg = jabber_parse_error(js, packet);
- purple_connection_error(js->gc, msg);
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, msg);
g_free(msg);
}
@@ -142,7 +144,8 @@ static void jabber_stream_features_parse
return;
} 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."));
return;
}
@@ -175,7 +178,10 @@ static void jabber_stream_handle_error(J
{
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);
+ else
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, msg);
g_free(msg);
}
@@ -256,7 +262,8 @@ static void jabber_send_cb(gpointer data
if (ret < 0 && errno == EAGAIN)
return;
else if (ret <= 0) {
- purple_connection_error(js->gc, _("Write error"));
+ purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR,
+ _("Write error"));
return;
}
@@ -309,7 +316,9 @@ void jabber_send_raw(JabberStream *js, c
}
if (ret < 0 && errno != EAGAIN)
- purple_connection_error(js->gc, _("Write error"));
+ purple_connection_error_reason (js->gc,
+ PURPLE_REASON_NETWORK_ERROR,
+ _("Write error"));
else if (ret < olen) {
if (ret < 0)
ret = 0;
@@ -337,7 +346,9 @@ void jabber_send_raw(JabberStream *js, c
}
if (ret < 0 && errno != EAGAIN)
- purple_connection_error(js->gc, _("Write error"));
+ purple_connection_error_reason (js->gc,
+ PURPLE_REASON_NETWORK_ERROR,
+ _("Write error"));
else if (ret < len) {
if (ret < 0)
ret = 0;
@@ -405,7 +416,9 @@ jabber_recv_cb_ssl(gpointer data, Purple
if(errno == EAGAIN)
return;
else
- purple_connection_error(gc, _("Read Error"));
+ purple_connection_error_reason (js->gc,
+ PURPLE_REASON_NETWORK_ERROR,
+ _("Read Error"));
}
static void
@@ -442,7 +455,9 @@ jabber_recv_cb(gpointer data, gint sourc
} else if(errno == EAGAIN) {
return;
} else {
- purple_connection_error(gc, _("Read Error"));
+ purple_connection_error_reason (js->gc,
+ PURPLE_REASON_NETWORK_ERROR,
+ _("Read Error"));
}
}
@@ -481,7 +496,7 @@ jabber_login_callback(gpointer data, gin
gchar *tmp;
tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"),
error);
- purple_connection_error(gc, tmp);
+ purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, tmp);
g_free(tmp);
return;
}
@@ -509,7 +524,7 @@ jabber_ssl_connect_failure(PurpleSslConn
js = gc->proto_data;
js->gsc = NULL;
- purple_connection_error(gc, purple_ssl_strerror(error));
+ purple_connection_ssl_error (gc, error);
}
static void tls_init(JabberStream *js)
@@ -526,7 +541,8 @@ static void jabber_login_connect(JabberS
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 @@ jabber_login(PurpleAccount *account)
js->old_length = -1;
if(!js->user) {
- purple_connection_error(gc, _("Invalid XMPP ID"));
+ purple_connection_error_reason (gc, PURPLE_REASON_INVALID_USERNAME,
+ _("Invalid XMPP ID"));
return;
}
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."));
return;
}
@@ -607,7 +625,8 @@ jabber_login(PurpleAccount *account)
purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl,
jabber_ssl_connect_failure, js->gc);
} else {
- 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 @@ void jabber_register_account(PurpleAccou
js->old_length = -1;
if(!js->user) {
- purple_connection_error(gc, _("Invalid XMPP ID"));
+ purple_connection_error_reason (gc, PURPLE_REASON_INVALID_USERNAME,
+ _("Invalid XMPP ID"));
return;
}
@@ -1092,7 +1112,8 @@ void jabber_register_account(PurpleAccou
purple_account_get_int(account, "port", 5222),
jabber_login_callback_ssl, jabber_ssl_connect_failure, gc);
} else {
- purple_connection_error(gc, _("SSL support unavailable"));
+ purple_connection_error_reason (gc, PURPLE_REASON_ENCRYPTION_ERROR,
+ _("SSL support unavailable"));
}
}
============================================================
--- libpurple/protocols/jabber/parser.c 1b318b9d587444798232cf9664a84dae8b5b66af
+++ libpurple/protocols/jabber/parser.c e10abdfaf92499f8e3b23d4375f9b8fcfb5c8de8
@@ -193,7 +193,8 @@ void jabber_parser_process(JabberStream
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,
+ _("XML Parse error"));
}
}
More information about the Commits
mailing list