Mercurial > pidgin.yaz
changeset 21358:ba41f2a60253
Rename:
* PurpleDisconnectReason to PurpleConnectionError;
* elements of that enum from PURPLE_REASON_* to PURPLE_CONNECTION_ERROR_*;
* purple_connection_reason_is_fatal to purple_connection_error_is_fatal.
line wrap: on
line diff
--- a/libpurple/connection.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/connection.c Sun Oct 14 21:08:42 2007 +0000 @@ -490,33 +490,34 @@ { /* prpls that have not been updated to use disconnection reasons will * be setting wants_to_die before calling this function, so choose - * PURPLE_REASON_OTHER_ERROR (which is fatal) if it's true, and - * PURPLE_REASON_NETWORK_ERROR (which isn't) if not. See the - * documentation in connection.h. + * PURPLE_CONNECTION_ERROR_OTHER_ERROR (which is fatal) if it's true, + * and PURPLE_CONNECTION_ERROR_NETWORK_ERROR (which isn't) if not. See + * the documentation in connection.h. */ - PurpleDisconnectReason reason = gc->wants_to_die - ? PURPLE_REASON_OTHER_ERROR - : PURPLE_REASON_NETWORK_ERROR; + PurpleConnectionError reason = gc->wants_to_die + ? PURPLE_CONNECTION_ERROR_OTHER_ERROR + : PURPLE_CONNECTION_ERROR_NETWORK_ERROR; purple_connection_error_reason (gc, reason, text); } void purple_connection_error_reason (PurpleConnection *gc, - PurpleDisconnectReason reason, + PurpleConnectionError reason, const char *description) { PurpleConnectionUiOps *ops; g_return_if_fail(gc != NULL); - /* This sanity check relies on PURPLE_REASON_OTHER_ERROR being the - * last member of the PurpleDisconnectReason enum in connection.h; if - * other reasons are added after it, this check should be updated. + /* This sanity check relies on PURPLE_CONNECTION_ERROR_OTHER_ERROR + * being the last member of the PurpleConnectionError enum in + * connection.h; if other reasons are added after it, this check should + * be updated. */ - if (reason > PURPLE_REASON_OTHER_ERROR) { + if (reason > PURPLE_CONNECTION_ERROR_OTHER_ERROR) { purple_debug_error("connection", "purple_connection_error_reason: reason %u isn't a " "valid reason\n", reason); - reason = PURPLE_REASON_OTHER_ERROR; + reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; } if (description == NULL) { @@ -528,7 +529,7 @@ if (gc->disconnect_timeout) return; - gc->wants_to_die = purple_connection_reason_is_fatal (reason); + gc->wants_to_die = purple_connection_error_is_fatal (reason); ops = purple_connections_get_ui_ops(); @@ -548,47 +549,48 @@ purple_connection_ssl_error (PurpleConnection *gc, PurpleSslErrorType ssl_error) { - PurpleDisconnectReason reason; + PurpleConnectionError reason; switch (ssl_error) { case PURPLE_SSL_HANDSHAKE_FAILED: case PURPLE_SSL_CONNECT_FAILED: - reason = PURPLE_REASON_ENCRYPTION_ERROR; + reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; break; case PURPLE_SSL_CERTIFICATE_INVALID: /* TODO: maybe PURPLE_SSL_* should be more specific? */ - reason = PURPLE_REASON_CERT_OTHER_ERROR; + reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; break; default: g_assert_not_reached (); - reason = PURPLE_REASON_ENCRYPTION_ERROR; + reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; } - purple_connection_error_reason (gc, reason, purple_ssl_strerror(ssl_error)); + purple_connection_error_reason (gc, reason, + purple_ssl_strerror(ssl_error)); } gboolean -purple_connection_reason_is_fatal (PurpleDisconnectReason reason) +purple_connection_error_is_fatal (PurpleConnectionError reason) { switch (reason) { - case PURPLE_REASON_NETWORK_ERROR: - case PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE: - case PURPLE_REASON_CERT_NOT_PROVIDED: - case PURPLE_REASON_CERT_UNTRUSTED: - case PURPLE_REASON_CERT_EXPIRED: - case PURPLE_REASON_CERT_NOT_ACTIVATED: - case PURPLE_REASON_CERT_HOSTNAME_MISMATCH: - case PURPLE_REASON_CERT_FINGERPRINT_MISMATCH: - case PURPLE_REASON_CERT_SELF_SIGNED: - case PURPLE_REASON_CERT_OTHER_ERROR: + case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: + case PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE: + case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: + case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: + case PURPLE_CONNECTION_ERROR_CERT_EXPIRED: + case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED: + case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH: + case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH: + case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED: + case PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR: return FALSE; - case PURPLE_REASON_AUTHENTICATION_FAILED: - case PURPLE_REASON_NO_SSL_SUPPORT: - case PURPLE_REASON_ENCRYPTION_ERROR: - case PURPLE_REASON_NAME_IN_USE: - case PURPLE_REASON_INVALID_SETTINGS: - case PURPLE_REASON_OTHER_ERROR: + case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: + case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT: + case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR: + case PURPLE_CONNECTION_ERROR_NAME_IN_USE: + case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS: + case PURPLE_CONNECTION_ERROR_OTHER_ERROR: return TRUE; default: g_return_val_if_reached(TRUE);
--- a/libpurple/connection.h Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/connection.h Sun Oct 14 21:08:42 2007 +0000 @@ -63,58 +63,58 @@ * there was some protocol error (such as the server sending malformed * data). */ - PURPLE_REASON_NETWORK_ERROR = 0, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR = 0, /** The username or password (or some other credential) was incorrect. */ - PURPLE_REASON_AUTHENTICATION_FAILED = 1, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED = 1, /** libpurple doesn't speak any of the authentication methods the * server offered. */ - PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE = 2, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE = 2, /** libpurple was built without SSL support, and the connection needs * SSL. */ - PURPLE_REASON_NO_SSL_SUPPORT = 3, + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT = 3, /** There was an error negotiating SSL on this connection, or the * server does not support encryption but an account option was set to * require it. */ - PURPLE_REASON_ENCRYPTION_ERROR = 4, + PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR = 4, /** Someone is already connected to the server using the name you are * trying to connect with. */ - PURPLE_REASON_NAME_IN_USE = 5, + PURPLE_CONNECTION_ERROR_NAME_IN_USE = 5, /** The username/server/other preference for the account isn't valid. * For instance, on IRC the screen name cannot contain white space. * This reason should not be used for incorrect passwords etc: use - * #PURPLE_REASON_AUTHENTICATION_FAILED for that. + * #PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED for that. * * @todo This reason really shouldn't be necessary. Usernames and * other account preferences should be validated when the * account is created. */ - PURPLE_REASON_INVALID_SETTINGS = 6, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS = 6, /** The server did not provide a SSL certificate. */ - PURPLE_REASON_CERT_NOT_PROVIDED = 7, + PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED = 7, /** The server's SSL certificate could not be trusted. */ - PURPLE_REASON_CERT_UNTRUSTED = 8, + PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED = 8, /** The server's SSL certificate has expired. */ - PURPLE_REASON_CERT_EXPIRED = 9, + PURPLE_CONNECTION_ERROR_CERT_EXPIRED = 9, /** The server's SSL certificate is not yet valid. */ - PURPLE_REASON_CERT_NOT_ACTIVATED = 10, + PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED = 10, /** The server's SSL certificate did not match its hostname. */ - PURPLE_REASON_CERT_HOSTNAME_MISMATCH = 11, + PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH = 11, /** The server's SSL certificate does not have the expected * fingerprint. */ - PURPLE_REASON_CERT_FINGERPRINT_MISMATCH = 12, + PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH = 12, /** The server's SSL certificate is self-signed. */ - PURPLE_REASON_CERT_SELF_SIGNED = 13, + PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED = 13, /** There was some other error validating the server's SSL certificate. */ - PURPLE_REASON_CERT_OTHER_ERROR = 14, + PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR = 14, /** Some other error occured which fits into none of the other * categories. @@ -123,8 +123,8 @@ * this is the last member of the enum when sanity-checking; if other * reasons are added after it, the check must be updated. */ - PURPLE_REASON_OTHER_ERROR = 15 -} PurpleDisconnectReason; + PURPLE_CONNECTION_ERROR_OTHER_ERROR = 15 +} PurpleConnectionError; #include <time.h> @@ -194,14 +194,14 @@ * #report_disconnect. If both are implemented, this will be called * first; however, there's no real reason to implement both. * @param reason why the connection ended, if known, or - * #PURPLE_REASON_OTHER_ERROR, if not. + * #PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not. * @param text a localized message describing the disconnection * in more detail to the user. * @see #purple_connection_error_reason * @since 2.3.0 */ void (*report_disconnect_reason)(PurpleConnection *gc, - PurpleDisconnectReason reason, + PurpleConnectionError reason, const char *text); void (*_purple_reserved1)(void); @@ -233,7 +233,7 @@ * reconnected (incorrect password, etc.). prpls should rely on * purple_connection_error_reason() to set this for them rather than * setting it themselves. - * @see purple_connection_reason_is_fatal + * @see purple_connection_error_is_fatal */ gboolean wants_to_die; @@ -391,16 +391,17 @@ * @deprecated in favour of #purple_connection_error_reason. Calling * @c purple_connection_error(gc, text) is equivalent to calling * @c purple_connection_error_reason(gc, reason, text) where @c reason is - * #PURPLE_REASON_OTHER_ERROR if @c gc->wants_to_die is @c TRUE, and - * #PURPLE_REASON_NETWORK_ERROR if not. (This is to keep auto-reconnection - * behaviour the same when using old prpls which don't use reasons yet.) + * #PURPLE_CONNECTION_ERROR_OTHER_ERROR if @c gc->wants_to_die is @c TRUE, and + * #PURPLE_CONNECTION_ERROR_NETWORK_ERROR if not. (This is to keep + * auto-reconnection behaviour the same when using old prpls which don't use + * reasons yet.) */ void purple_connection_error(PurpleConnection *gc, const char *reason); /** * Closes a connection with an error and an optional description of the * error. It also sets @c gc->wants_to_die to the value of - * #purple_connection_reason_is_fatal(@a reason). + * #purple_connection_error_is_fatal(@a reason). * * @param reason why the connection is closing. * @param description a localized description of the error. @@ -408,12 +409,12 @@ */ void purple_connection_error_reason (PurpleConnection *gc, - PurpleDisconnectReason reason, + PurpleConnectionError reason, const char *description); /** * Closes a connection due to an SSL error; this is basically a shortcut to - * turning the #PurpleSslErrorType into a #PurpleDisconnectReason and a + * turning the #PurpleSslErrorType into a #PurpleConnectionError and a * human-readable string and then calling purple_connection_error_reason(). * @since 2.3.0 */ @@ -425,14 +426,14 @@ * Reports whether a disconnection reason is fatal (in which case the account * should probably not be automatically reconnected) or transient (so * auto-reconnection is a good idea). - * For instance, #PURPLE_REASON_NETWORK_ERROR is a temporary + * For instance, #PURPLE_CONNECTION_ERROR_NETWORK_ERROR is a temporary * error, which might be caused by losing the network connection, so - * @a purple_connection_reason_is_fatal(PURPLE_REASON_NETWORK_ERROR) is - * @c FALSE. On the other hand, #PURPLE_REASON_AUTHENTICATION_FAILED probably - * indicates a misconfiguration of the account which needs the user to go fix - * it up, so @a - * purple_connection_reason_is_fatal(PURPLE_REASON_AUTHENTICATION_FAILED) - * is @c TRUE. + * @c purple_connection_error_is_fatal + * (@c PURPLE_CONNECTION_ERROR_NETWORK_ERROR) is @c FALSE. On the other hand, + * #PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED probably indicates a + * misconfiguration of the account which needs the user to go fix it up, so + * @c purple_connection_error_is_fatal + * (@c PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED) is @c TRUE. * * (This function is meant to replace checking PurpleConnection.wants_to_die.) * @@ -441,7 +442,7 @@ * @since 2.3.0 */ gboolean -purple_connection_reason_is_fatal (PurpleDisconnectReason reason); +purple_connection_error_is_fatal (PurpleConnectionError reason); /*@}*/
--- a/libpurple/protocols/bonjour/bonjour.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/bonjour/bonjour.c Sun Oct 14 21:08:42 2007 +0000 @@ -102,7 +102,8 @@ #ifdef _WIN32 if (!dns_sd_available()) { - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("The Apple Bonjour For Windows toolkit wasn't found, see the FAQ at: " "http://developer.pidgin.im/wiki/Using%20Pidgin#CanIusePidginforBonjourLink-LocalMessaging" " for more information.")); @@ -120,7 +121,8 @@ if (bonjour_jabber_start(bd->jabber_data) == -1) { /* Send a message about the connection error */ - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to listen for incoming IM connections\n")); return; } @@ -146,7 +148,8 @@ bd->dns_sd_data->account = account; if (!bonjour_dns_sd_start(bd->dns_sd_data)) { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to establish connection with the local mDNS server. Is it running?")); return; }
--- a/libpurple/protocols/bonjour/jabber.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Sun Oct 14 21:08:42 2007 +0000 @@ -581,7 +581,8 @@ { purple_debug_error("bonjour", "Cannot open socket: %s\n", strerror(errno)); purple_connection_error_reason (data->account->gc, - PURPLE_REASON_NETWORK_ERROR, _("Cannot open socket")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Cannot open socket")); return -1; } @@ -590,7 +591,8 @@ { purple_debug_error("bonjour", "Error setting socket options: %s\n", strerror(errno)); purple_connection_error_reason (data->account->gc, - PURPLE_REASON_NETWORK_ERROR, _("Error setting socket options")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Error setting socket options")); return -1; } @@ -615,7 +617,8 @@ { purple_debug_error("bonjour", "Cannot bind socket: %s\n", strerror(errno)); purple_connection_error_reason (data->account->gc, - PURPLE_REASON_NETWORK_ERROR, _("Could not bind socket to port")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Could not bind socket to port")); return -1; } @@ -624,7 +627,8 @@ { purple_debug_error("bonjour", "Cannot listen on socket: %s\n", strerror(errno)); purple_connection_error_reason (data->account->gc, - PURPLE_REASON_NETWORK_ERROR, _("Could not listen on socket")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Could not listen on socket")); return -1; }
--- a/libpurple/protocols/gg/gg.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/gg/gg.c Sun Oct 14 21:08:42 2007 +0000 @@ -381,14 +381,15 @@ if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { - purple_connection_error_reason (gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Fill in the registration fields.")); goto exit_err; } if (g_utf8_collate(p1, p2) != 0) { purple_connection_error_reason (gc, - PURPLE_REASON_AUTHENTICATION_FAILED, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Passwords do not match.")); goto exit_err; } @@ -397,7 +398,8 @@ token->id, t); h = gg_register3(email, p1, token->id, t, 0); if (h == NULL || !(s = h->data) || !s->success) { - purple_connection_error_reason (gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unable to register new account. Error occurred.\n")); goto exit_err; } @@ -1310,7 +1312,8 @@ if (!(ev = gg_watch_fd(info->session))) { purple_debug_error("gg", "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to read socket")); return; } @@ -1464,7 +1467,8 @@ if (!(ev = gg_watch_fd(info->session))) { purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to read socket")); return; } @@ -1512,7 +1516,7 @@ purple_input_remove(gc->inpa); gc->inpa = 0; purple_connection_error_reason (gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection failed.")); break; default: @@ -1719,7 +1723,8 @@ info->session = gg_login(glp); if (info->session == NULL) { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection failed.")); g_free(glp); return; @@ -2003,7 +2008,8 @@ if (gg_ping(info->session) < 0) { purple_debug_info("gg", "Not connected to the server " "or gg_session is not correct\n"); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Not connected to the server.")); } }
--- a/libpurple/protocols/irc/irc.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/irc/irc.c Sun Oct 14 21:08:42 2007 +0000 @@ -124,7 +124,8 @@ return; else if (ret <= 0) { PurpleConnection *gc = purple_account_get_connection(irc->account); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server has disconnected")); return; } @@ -163,7 +164,8 @@ irc->gsc ? " (ssl)" : "", tosend); */ if (ret <= 0 && errno != EAGAIN) { PurpleConnection *gc = purple_account_get_connection(irc->account); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server has disconnected")); } else if (ret < buflen) { if (ret < 0) @@ -297,7 +299,8 @@ gc->flags |= PURPLE_CONNECTION_NO_NEWLINES; if (strpbrk(username, " \t\v\r\n") != NULL) { - purple_connection_error_reason (gc, PURPLE_REASON_INVALID_SETTINGS, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("IRC nicks may not contain whitespace")); return; } @@ -327,7 +330,8 @@ purple_account_get_int(account, "port", IRC_DEFAULT_SSL_PORT), irc_login_cb_ssl, irc_ssl_connect_failure, gc); } else { - purple_connection_error_reason (gc, PURPLE_REASON_NO_SSL_SUPPORT, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); return; } @@ -339,7 +343,8 @@ purple_account_get_int(account, "port", IRC_DEFAULT_PORT), irc_login_cb, gc) == NULL) { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Couldn't create socket")); return; } @@ -420,7 +425,8 @@ struct irc_conn *irc = gc->proto_data; if (source < 0) { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Couldn't connect to host")); return; } @@ -609,11 +615,13 @@ /* Try again later */ return; } else if (len < 0) { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Read error")); return; } else if (len == 0) { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server has disconnected")); return; } @@ -636,11 +644,13 @@ if (len < 0 && errno == EAGAIN) { return; } else if (len < 0) { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Read error")); return; } else if (len == 0) { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server has disconnected")); return; }
--- a/libpurple/protocols/irc/msgs.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/irc/msgs.c Sun Oct 14 21:08:42 2007 +0000 @@ -913,7 +913,8 @@ _("Your selected nickname was rejected by the server. It probably contains invalid characters.")); } else { - purple_connection_error_reason (gc, PURPLE_REASON_INVALID_SETTINGS, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Your selected account name was rejected by the server. It probably contains invalid characters.")); } }
--- a/libpurple/protocols/irc/parse.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/irc/parse.c Sun Oct 14 21:08:42 2007 +0000 @@ -631,11 +631,13 @@ } else if (!strncmp(input, "ERROR ", 6)) { if (g_utf8_validate(input, -1, NULL)) { char *tmp = g_strdup_printf("%s\n%s", _("Disconnected."), input); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, tmp); + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); } else purple_connection_error_reason (gc, - PURPLE_REASON_NETWORK_ERROR, _("Disconnected.")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Disconnected.")); return; }
--- a/libpurple/protocols/jabber/auth.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/jabber/auth.c Sun Oct 14 21:08:42 2007 +0000 @@ -50,7 +50,8 @@ "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>", -1); return TRUE; } else if(xmlnode_get_child(starttls, "required")) { - purple_connection_error_reason (js->gc, PURPLE_REASON_NO_SSL_SUPPORT, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("Server requires TLS/SSL for login. No TLS/SSL support found.")); return TRUE; } @@ -114,7 +115,8 @@ static void disallow_plaintext_auth(PurpleAccount *account) { - purple_connection_error_reason (account->gc, PURPLE_REASON_ENCRYPTION_ERROR, + purple_connection_error_reason (account->gc, + PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("Server requires plaintext authentication over an unencrypted stream")); } @@ -334,7 +336,7 @@ */ } else { purple_connection_error_reason (js->gc, - PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, _("Server does not use any supported authentication method")); return; } @@ -391,7 +393,7 @@ xmlnode_free(auth); } else { purple_connection_error_reason (js->gc, - PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, "SASL authentication failed\n"); } } @@ -465,7 +467,8 @@ mechs = xmlnode_get_child(packet, "mechanisms"); if(!mechs) { - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server.")); return; } @@ -526,7 +529,8 @@ } finish_plaintext_authentication(js); } else { - purple_connection_error_reason (js->gc, PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, _("Server does not use any supported authentication method")); } #endif @@ -539,7 +543,7 @@ if(type && !strcmp(type, "result")) { jabber_stream_set_state(js, JABBER_STREAM_CONNECTED); } else { - PurpleDisconnectReason reason = PURPLE_REASON_NETWORK_ERROR; + PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = jabber_parse_error(js, packet, &reason); xmlnode *error; const char *err_code; @@ -548,7 +552,7 @@ if((error = xmlnode_get_child(packet, "error")) && (err_code = xmlnode_get_attrib(error, "code")) && !strcmp(err_code, "401")) { - reason = PURPLE_REASON_AUTHENTICATION_FAILED; + reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; /* Clear the pasword if it isn't being saved */ if (!purple_account_get_remember_password(js->gc->account)) purple_account_set_password(js->gc->account, NULL); @@ -567,11 +571,12 @@ const char *pw = purple_connection_get_password(js->gc); if(!type) { - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server.")); return; } else if(!strcmp(type, "error")) { - PurpleDisconnectReason reason = PURPLE_REASON_NETWORK_ERROR; + PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = jabber_parse_error(js, packet, &reason); purple_connection_error_reason (js->gc, reason, msg); g_free(msg); @@ -618,7 +623,7 @@ finish_plaintext_authentication(js); } else { purple_connection_error_reason (js->gc, - PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, _("Server does not use any supported authentication method")); return; } @@ -785,7 +790,8 @@ GHashTable *parts; if(!enc_in) { - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server.")); return; } @@ -807,7 +813,8 @@ "<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />", -1); } else { - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid challenge from server")); } g_free(js->expected_rspauth); @@ -831,7 +838,8 @@ realm = js->user->domain; if (nonce == NULL || realm == NULL) - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid challenge from server")); else { GString *response = g_string_new(""); @@ -904,7 +912,8 @@ 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_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("SASL error")); return; } else { @@ -930,7 +939,8 @@ #endif if(!ns || strcmp(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) { - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server.")); return; } @@ -956,7 +966,8 @@ if (js->sasl_state != SASL_OK) { /* This should never happen! */ - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server.")); } } @@ -973,11 +984,12 @@ void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet) { - PurpleDisconnectReason reason = PURPLE_REASON_NETWORK_ERROR; + PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = jabber_parse_error(js, packet, &reason); if(!msg) { - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server.")); } else { purple_connection_error_reason (js->gc, reason, msg);
--- a/libpurple/protocols/jabber/jabber.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sun Oct 14 21:08:42 2007 +0000 @@ -89,7 +89,8 @@ if(js->unregistration) jabber_unregister_account_cb(js); } else { - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, ("Error initializing session")); } } @@ -121,7 +122,8 @@ JabberBuddy *my_jb = NULL; jabber_id_free(js->user); if(!(js->user = jabber_id_new(full_jid))) { - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid response from server.")); } if((my_jb = jabber_buddy_find(js, full_jid, TRUE))) @@ -129,7 +131,7 @@ g_free(full_jid); } } else { - PurpleDisconnectReason reason = PURPLE_REASON_NETWORK_ERROR; + PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = jabber_parse_error(js, packet, &reason); purple_connection_error_reason (js->gc, reason, msg); g_free(msg); @@ -144,7 +146,8 @@ if(jabber_process_starttls(js, packet)) return; } else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !js->gsc) { - purple_connection_error_reason (js->gc, PURPLE_REASON_ENCRYPTION_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("You require encryption, but it is not available on this server.")); return; } @@ -176,7 +179,7 @@ static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet) { - PurpleDisconnectReason reason = PURPLE_REASON_NETWORK_ERROR; + PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; char *msg = jabber_parse_error(js, packet, &reason); purple_connection_error_reason (js->gc, reason, msg); @@ -261,7 +264,8 @@ if (ret < 0 && errno == EAGAIN) return; else if (ret <= 0) { - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Write error")); return; } @@ -316,7 +320,7 @@ if (ret < 0 && errno != EAGAIN) purple_connection_error_reason (js->gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Write error")); else if (ret < olen) { if (ret < 0) @@ -346,7 +350,7 @@ if (ret < 0 && errno != EAGAIN) purple_connection_error_reason (js->gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Write error")); else if (ret < len) { if (ret < 0) @@ -416,7 +420,7 @@ return; else purple_connection_error_reason (js->gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Read Error")); } @@ -455,7 +459,7 @@ return; } else { purple_connection_error_reason (js->gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Read Error")); } } @@ -495,7 +499,8 @@ gchar *tmp; tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"), error); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, tmp); + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } @@ -540,7 +545,8 @@ if (purple_proxy_connect(js->gc, js->gc->account, host, port, jabber_login_callback, js->gc) == NULL) - purple_connection_error_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to create socket")); } @@ -587,13 +593,15 @@ js->old_length = -1; if(!js->user) { - purple_connection_error_reason (gc, PURPLE_REASON_INVALID_SETTINGS, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Invalid XMPP ID")); return; } if (!js->user->domain || *(js->user->domain) == '\0') { - purple_connection_error_reason (gc, PURPLE_REASON_INVALID_SETTINGS, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Invalid XMPP ID. Domain must be set.")); return; } @@ -624,7 +632,8 @@ purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl, jabber_ssl_connect_failure, js->gc); } else { - purple_connection_error_reason (js->gc, PURPLE_REASON_NO_SSL_SUPPORT, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); } } @@ -1078,7 +1087,8 @@ js->old_length = -1; if(!js->user) { - purple_connection_error_reason (gc, PURPLE_REASON_INVALID_SETTINGS, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Invalid XMPP ID")); return; } @@ -1111,7 +1121,8 @@ purple_account_get_int(account, "port", 5222), jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); } else { - purple_connection_error_reason (gc, PURPLE_REASON_NO_SSL_SUPPORT, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); } } @@ -1827,7 +1838,7 @@ char *jabber_parse_error(JabberStream *js, xmlnode *packet, - PurpleDisconnectReason *reason) + PurpleConnectionError *reason) { xmlnode *error; const char *code = NULL, *text = NULL; @@ -1889,11 +1900,11 @@ } } else if(xmlns && !strcmp(xmlns, "urn:ietf:params:xml:ns:xmpp-sasl")) { /* Most common reason can be the default */ - SET_REASON(PURPLE_REASON_AUTHENTICATION_FAILED); + SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); if(xmlnode_get_child(packet, "aborted")) { text = _("Authorization Aborted"); } else if(xmlnode_get_child(packet, "incorrect-encoding")) { - SET_REASON(PURPLE_REASON_NETWORK_ERROR); + SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); text = _("Incorrect encoding in authorization"); } else if(xmlnode_get_child(packet, "invalid-authzid")) { text = _("Invalid authzid"); @@ -1907,7 +1918,7 @@ purple_account_set_password(js->gc->account, NULL); text = _("Not Authorized"); } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { - SET_REASON(PURPLE_REASON_NETWORK_ERROR); + SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); text = _("Temporary Authentication Failure"); } else { text = _("Authentication Failure"); @@ -1916,13 +1927,13 @@ (!strcmp(packet->name, "error") && xmlns && !strcmp(xmlns, "http://etherx.jabber.org/streams"))) { /* Most common reason as default: */ - SET_REASON(PURPLE_REASON_NETWORK_ERROR); + SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); if(xmlnode_get_child(packet, "bad-format")) { text = _("Bad Format"); } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) { text = _("Bad Namespace Prefix"); } else if(xmlnode_get_child(packet, "conflict")) { - SET_REASON(PURPLE_REASON_NAME_IN_USE); + SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); text = _("Resource Conflict"); } else if(xmlnode_get_child(packet, "connection-timeout")) { text = _("Connection Timeout");
--- a/libpurple/protocols/jabber/jabber.h Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.h Sun Oct 14 21:08:42 2007 +0000 @@ -223,7 +223,7 @@ * @param reason where to store the disconnection reason, or @c NULL if you * don't care or you don't intend to close the connection. */ -char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleDisconnectReason *reason); +char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleConnectionError *reason); void jabber_add_feature(const gchar *shortname, const gchar *namespace, JabberFeatureEnabled cb); /* cb may be NULL */ void jabber_remove_feature(const gchar *shortname);
--- a/libpurple/protocols/jabber/parser.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/jabber/parser.c Sun Oct 14 21:08:42 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_reason (js->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (js->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("XML Parse error")); } }
--- a/libpurple/protocols/msn/contact.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/msn/contact.c Sun Oct 14 21:08:42 2007 +0000 @@ -945,7 +945,7 @@ msn_get_address_book(contact, NULL, NULL); */ msn_session_disconnect(session); - purple_connection_error_reason(session->account->gc, PURPLE_REASON_NETWORK_ERROR, _("Unable to retrieve MSN Address Book")); + purple_connection_error_reason(session->account->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to retrieve MSN Address Book")); return FALSE; } }
--- a/libpurple/protocols/msn/msn.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/msn/msn.c Sun Oct 14 21:08:42 2007 +0000 @@ -820,7 +820,8 @@ if (!purple_ssl_is_supported()) { - purple_connection_error_reason (gc, PURPLE_REASON_NO_SSL_SUPPORT, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support is needed for MSN. Please install a supported " "SSL library.")); return; @@ -849,7 +850,8 @@ purple_account_set_username(account, username); if (!msn_session_connect(session, host, port, http_method)) - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Failed to connect to server.")); }
--- a/libpurple/protocols/msn/session.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/msn/session.c Sun Oct 14 21:08:42 2007 +0000 @@ -325,7 +325,7 @@ const char *info) { PurpleConnection *gc; - PurpleDisconnectReason reason; + PurpleConnectionError reason; char *msg; gc = purple_account_get_connection(session->account); @@ -333,49 +333,49 @@ switch (error) { case MSN_ERROR_SERVCONN: - reason = PURPLE_REASON_NETWORK_ERROR; + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(info); break; case MSN_ERROR_UNSUPPORTED_PROTOCOL: - reason = PURPLE_REASON_NETWORK_ERROR; + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("Our protocol is not supported by the " "server.")); break; case MSN_ERROR_HTTP_MALFORMED: - reason = PURPLE_REASON_NETWORK_ERROR; + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("Error parsing HTTP.")); break; case MSN_ERROR_SIGN_OTHER: - reason = PURPLE_REASON_NAME_IN_USE; + reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; msg = g_strdup(_("You have signed on from another location.")); if (!purple_account_get_remember_password(session->account)) purple_account_set_password(session->account, NULL); break; case MSN_ERROR_SERV_UNAVAILABLE: - reason = PURPLE_REASON_NETWORK_ERROR; + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("The MSN servers are temporarily " "unavailable. Please wait and try " "again.")); break; case MSN_ERROR_SERV_DOWN: - reason = PURPLE_REASON_NETWORK_ERROR; + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("The MSN servers are going down " "temporarily.")); break; case MSN_ERROR_AUTH: - reason = PURPLE_REASON_AUTHENTICATION_FAILED; + reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; msg = g_strdup_printf(_("Unable to authenticate: %s"), (info == NULL ) ? _("Unknown error") : info); break; case MSN_ERROR_BAD_BLIST: - reason = PURPLE_REASON_NETWORK_ERROR; + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("Your MSN buddy list is temporarily " "unavailable. Please wait and try " "again.")); break; default: - reason = PURPLE_REASON_NETWORK_ERROR; + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; msg = g_strdup(_("Unknown error.")); break; }
--- a/libpurple/protocols/myspace/myspace.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Sun Oct 14 21:08:42 2007 +0000 @@ -292,7 +292,7 @@ purple_notify_error(acct, _("MySpaceIM Error"), str, NULL); purple_connection_error_reason (gc, - PURPLE_REASON_AUTHENTICATION_FAILED, str); + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, str); g_free(str); return; } @@ -315,7 +315,8 @@ if (!purple_proxy_connect(gc, acct, host, port, msim_connect_cb, gc)) { /* TODO: try other ports if in auto mode, then save * working port and try that first next time. */ - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Couldn't create socket")); return; } @@ -354,7 +355,8 @@ if (nc_len != MSIM_AUTH_CHALLENGE_LENGTH) { purple_debug_info("msim", "bad nc length: %x != 0x%x\n", nc_len, MSIM_AUTH_CHALLENGE_LENGTH); - purple_connection_error_reason (session->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (session->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unexpected challenge length from server")); return FALSE; } @@ -1292,7 +1294,7 @@ purple_debug_info("msim", "msim_check_alive: %s > interval of %d, presumed dead\n", errmsg, MSIM_KEEPALIVE_INTERVAL); purple_connection_error_reason (session->gc, - PURPLE_REASON_NETWORK_ERROR, errmsg); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, errmsg); purple_notify_error(session->gc, NULL, errmsg, NULL); @@ -1558,7 +1560,8 @@ purple_notify_error(session->account, _("No username set"), _("Please go to http://editprofile.myspace.com/index.cfm?fuseaction=profile.username and choose a username and try to login again."), NULL); - purple_connection_error_reason (session->gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("No username set")); + purple_connection_error_reason (session->gc, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("No username set")); return FALSE; } @@ -1794,16 +1797,16 @@ /* Destroy session if fatal. */ if (msim_msg_get(msg, "fatal")) { - PurpleDisconnectReason reason = PURPLE_REASON_NETWORK_ERROR; + PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; purple_debug_info("msim", "fatal error, closing\n"); switch (err) { case 260: /* Incorrect password */ - reason = PURPLE_REASON_AUTHENTICATION_FAILED; + reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; if (!purple_account_get_remember_password(session->account)) purple_account_set_password(session->account, NULL); break; case 6: /* Logged in elsewhere */ - reason = PURPLE_REASON_NAME_IN_USE; + reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; if (!purple_account_get_remember_password(session->account)) purple_account_set_password(session->account, NULL); break; @@ -2319,7 +2322,8 @@ /* libpurple/eventloop.h only defines these two */ if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) { purple_debug_info("msim_input_cb", "unknown condition=%d\n", cond); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Invalid input condition")); return; } @@ -2338,7 +2342,8 @@ purple_debug_error("msim", "msim_input_cb: %d-byte read buffer full! rxoff=%d\n", MSIM_READ_BUF_SIZE, session->rxoff); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Read buffer full")); return; } @@ -2358,12 +2363,14 @@ purple_debug_error("msim", "msim_input_cb: read error, ret=%d, " "error=%s, source=%d, fd=%d (%X))\n", n, strerror(errno), source, session->fd, session->fd); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Read error")); return; } else if (n == 0) { purple_debug_info("msim", "msim_input_cb: server disconnected\n"); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server has disconnected")); return; } @@ -2372,7 +2379,8 @@ purple_debug_info("msim_input_cb", "received %d bytes, pushing rxoff to %d, over buffer size of %d\n", n, n + session->rxoff, MSIM_READ_BUF_SIZE); /* TODO: g_realloc like msn, yahoo, irc, jabber? */ - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Read buffer full")); } @@ -2388,7 +2396,8 @@ purple_debug_info("msim", "msim_input_cb: strlen=%d, but read %d bytes" "--null byte encountered?\n", strlen(session->rxbuf + session->rxoff), n); - /*purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + /*purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Invalid message - null byte on input"); */ return; } @@ -2412,7 +2421,8 @@ msg = msim_parse(g_strdup(session->rxbuf)); if (!msg) { purple_debug_info("msim", "msim_input_cb: couldn't parse rxbuf\n"); - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unparseable message")); } else { /* Process message and then free it (processing function should @@ -2480,7 +2490,8 @@ session = (MsimSession *)gc->proto_data; if (source < 0) { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, g_strdup_printf(_("Couldn't connect to host: %s (%d)"), error_message ? error_message : "no message given", source));
--- a/libpurple/protocols/novell/novell.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/novell/novell.c Sun Oct 14 21:08:42 2007 +0000 @@ -120,7 +120,7 @@ _check_for_disconnect(user, rc); } else { - PurpleDisconnectReason reason; + PurpleConnectionError reason; char *err = g_strdup_printf(_("Login failed (%s)."), nm_error_to_string (ret_code)); @@ -133,11 +133,11 @@ */ if (!purple_account_get_remember_password(gc->account)) purple_account_set_password(gc->account, NULL); - reason = PURPLE_REASON_AUTHENTICATION_FAILED; + reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; break; default: /* FIXME: There are other reasons login could fail */ - reason = PURPLE_REASON_NETWORK_ERROR; + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; } purple_connection_error_reason (gc, reason, err); @@ -1126,7 +1126,8 @@ if (_is_disconnect_error(err)) { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error communicating with server. Closing connection.")); return TRUE; @@ -1697,7 +1698,7 @@ if (_is_disconnect_error(rc)) { purple_connection_error_reason (gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error communicating with server. Closing connection.")); } else { purple_debug(PURPLE_DEBUG_INFO, "novell", @@ -1737,7 +1738,8 @@ conn->connected = TRUE; purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc); } else { - purple_connection_error_reason (gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect to server.")); } @@ -2020,9 +2022,10 @@ { if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); - purple_connection_error_reason (gc, PURPLE_REASON_NAME_IN_USE, - _("You have been logged out because you" - " logged in at another workstation.")); + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_NAME_IN_USE, + _("You have been logged out because you" + " logged in at another workstation.")); } } @@ -2176,7 +2179,8 @@ */ /* ...but for now just error out with a nice message. */ - purple_connection_error_reason (gc, PURPLE_REASON_INVALID_SETTINGS, + purple_connection_error_reason (gc, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("Unable to connect to server. Please enter the " "address of the server you wish to connect to.")); return; @@ -2205,7 +2209,7 @@ novell_ssl_connected_cb, novell_ssl_connect_error, gc); if (user->conn->ssl_conn->data == NULL) { purple_connection_error_reason (gc, - PURPLE_REASON_NO_SSL_SUPPORT, + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("Error. SSL support is not installed.")); } }
--- a/libpurple/protocols/oscar/flap_connection.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/oscar/flap_connection.c Sun Oct 14 21:08:42 2007 +0000 @@ -380,10 +380,10 @@ { /* No more FLAP connections! Sign off this PurpleConnection! */ gchar *tmp; - PurpleDisconnectReason reason = PURPLE_REASON_NETWORK_ERROR; + PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; if (conn->disconnect_code == 0x0001) { - reason = PURPLE_REASON_NAME_IN_USE; + reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; tmp = g_strdup(_("You have signed on from another location.")); if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL);
--- a/libpurple/protocols/oscar/oscar.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/oscar/oscar.c Sun Oct 14 21:08:42 2007 +0000 @@ -994,7 +994,7 @@ gchar *msg; msg = g_strdup_printf(_("Could not connect to authentication server:\n%s"), error_message); - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, msg); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); } else if (conn->type == SNAC_FAMILY_LOCATE) @@ -1002,7 +1002,7 @@ gchar *msg; msg = g_strdup_printf(_("Could not connect to BOS server:\n%s"), error_message); - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, msg); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); g_free(msg); } else @@ -1260,7 +1260,7 @@ if (!aim_snvalid(purple_account_get_username(account))) { gchar *buf; buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account)); - purple_connection_error_reason(gc, PURPLE_REASON_INVALID_SETTINGS, buf); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, buf); g_free(buf); } @@ -1281,7 +1281,7 @@ connection_established_cb, newconn); if (newconn->connect_data == NULL) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Couldn't connect to host")); return; } @@ -1343,37 +1343,37 @@ switch (info->errorcode) { case 0x01: /* Unregistered screen name */ - purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Invalid screen name.")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Invalid screen name.")); break; case 0x05: /* Incorrect password */ if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Incorrect password.")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password.")); break; case 0x11: /* Suspended account */ - purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Your account is currently suspended.")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Your account is currently suspended.")); break; case 0x14: /* service temporarily unavailable */ - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("The AOL Instant Messenger service is temporarily unavailable.")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("The AOL Instant Messenger service is temporarily unavailable.")); break; case 0x18: /* screen name connecting too frequently */ - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); break; case 0x1c: /* client too old */ g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), PURPLE_WEBSITE); - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, buf); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, buf); break; case 0x1d: /* IP address connecting too frequently */ - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); break; default: - purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, _("Authentication failed")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Authentication failed")); break; } purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode); @@ -1403,7 +1403,7 @@ g_free(host); if (newconn->connect_data == NULL) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Could Not Connect")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Could Not Connect")); return 0; } @@ -1428,7 +1428,8 @@ PurpleConnection *gc = user_data; /* Disconnect */ - purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("The SecurID key entered is invalid.")); }
--- a/libpurple/protocols/qq/keep_alive.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/qq/keep_alive.c Sun Oct 14 21:08:42 2007 +0000 @@ -84,7 +84,7 @@ /* segments[0] and segment[1] are all 0x30 ("0") */ qd->all_online = strtol(segments[2], NULL, 10); if(0 == qd->all_online) - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Keep alive error")); g_free(qd->my_ip); qd->my_ip = g_strdup(segments[3]);
--- a/libpurple/protocols/qq/login_logout.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/qq/login_logout.c Sun Oct 14 21:08:42 2007 +0000 @@ -405,7 +405,7 @@ ">>> %d bytes -> [default] decrypt and dump\n%s", buf_len, hex_dump); try_dump_as_gbk(buf, buf_len); - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Error requesting login token")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error requesting login token")); } g_free(hex_dump); } @@ -482,11 +482,11 @@ if (!purple_account_get_remember_password(gc->account)) purple_account_set_password(gc->account, NULL); purple_connection_error_reason(gc, - PURPLE_REASON_AUTHENTICATION_FAILED, _("Incorrect password.")); + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password.")); break; case QQ_LOGIN_REPLY_MISC_ERROR: purple_connection_error_reason(gc, - PURPLE_REASON_NETWORK_ERROR, _("Unable to login, check debug log")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to login, check debug log")); break; case QQ_LOGIN_REPLY_OK: purple_debug(PURPLE_DEBUG_INFO, "QQ", "Login replys OK, everything is fine\n");
--- a/libpurple/protocols/qq/qq.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/qq/qq.c Sun Oct 14 21:08:42 2007 +0000 @@ -136,7 +136,7 @@ purple_connection_update_progress(gc, _("Connecting"), 0, QQ_CONNECT_STEPS); if (qq_connect(account, qq_server, strtol(qq_port, NULL, 10), use_tcp, FALSE) < 0) - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect.")); }
--- a/libpurple/protocols/qq/qq_proxy.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/qq/qq_proxy.c Sun Oct 14 21:08:42 2007 +0000 @@ -139,7 +139,7 @@ g_return_if_fail(gc != NULL && gc->proto_data != NULL); if (source < 0) { /* socket returns -1 */ - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, error_message); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); return; } @@ -494,7 +494,7 @@ ret = send(qd->fd, data, len, 0); } if (ret == -1) - purple_connection_error_reason(qd->gc, PURPLE_REASON_NETWORK_ERROR, strerror(errno)); + purple_connection_error_reason(qd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, strerror(errno)); return ret; }
--- a/libpurple/protocols/qq/recv_core.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/qq/recv_core.c Sun Oct 14 21:08:42 2007 +0000 @@ -306,7 +306,7 @@ gc = (PurpleConnection *) data; if(cond != PURPLE_INPUT_READ) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Socket error")); return; } @@ -317,7 +317,7 @@ /* here we have UDP proxy suppport */ len = qq_proxy_read(qd, buf, MAX_PACKET_SIZE); if (len <= 0) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to read from socket")); return; } else {
--- a/libpurple/protocols/qq/sendqueue.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/qq/sendqueue.c Sun Oct 14 21:08:42 2007 +0000 @@ -121,7 +121,7 @@ if (qd->logged_in) { purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Connection lost!\n"); purple_connection_error_reason(gc, - PURPLE_REASON_NETWORK_ERROR, _("Connection lost")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection lost")); qd->logged_in = FALSE; } p->resend_times = -1; @@ -130,7 +130,7 @@ case QQ_CMD_REQUEST_LOGIN_TOKEN: if (!qd->logged_in) /* cancel login progress */ purple_connection_error_reason(gc, - PURPLE_REASON_NETWORK_ERROR, _("Login failed, no reply")); + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Login failed, no reply")); p->resend_times = -1; break; default:{
--- a/libpurple/protocols/sametime/sametime.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/sametime/sametime.c Sun Oct 14 21:08:42 2007 +0000 @@ -414,7 +414,8 @@ } else if(len > 0) { DEBUG_ERROR("write returned %i, %i bytes left unwritten\n", ret, len); - purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(pd->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection closed (writing)")); #if 0 @@ -1553,36 +1554,36 @@ if(GPOINTER_TO_UINT(info) & ERR_FAILURE) { char *err = mwError(GPOINTER_TO_UINT(info)); - PurpleDisconnectReason reason; + PurpleConnectionError reason; switch (GPOINTER_TO_UINT(info)) { case VERSION_MISMATCH: - reason = PURPLE_REASON_OTHER_ERROR; + reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; break; case USER_RESTRICTED: case INCORRECT_LOGIN: case USER_UNREGISTERED: case GUEST_IN_USE: - reason = PURPLE_REASON_AUTHENTICATION_FAILED; + reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; break; case ENCRYPT_MISMATCH: case ERR_ENCRYPT_NO_SUPPORT: case ERR_NO_COMMON_ENCRYPT: - reason = PURPLE_REASON_ENCRYPTION_ERROR; + reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; break; case VERIFICATION_DOWN: - reason = PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE; + reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE; break; case MULTI_SERVER_LOGIN: case MULTI_SERVER_LOGIN2: - reason = PURPLE_REASON_NAME_IN_USE; + reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; break; default: - reason = PURPLE_REASON_NETWORK_ERROR; + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; } purple_connection_error_reason(gc, reason, err); g_free(err); @@ -1732,7 +1733,9 @@ if(! ret) { const char *msg = _("Connection reset"); DEBUG_INFO("connection reset\n"); - purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, msg); + purple_connection_error_reason(pd->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + msg); } else if(ret < 0) { char *msg = strerror(err); @@ -1740,7 +1743,9 @@ DEBUG_INFO("error in read callback: %s\n", msg); msg = g_strdup_printf(_("Error reading from socket: %s"), msg); - purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, msg); + purple_connection_error_reason(pd->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + msg); g_free(msg); } } @@ -1763,7 +1768,9 @@ } else { /* this is a regular connect, error out */ const char *msg = _("Unable to connect to host"); - purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, msg); + purple_connection_error_reason(pd->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + msg); } return; @@ -3646,7 +3653,9 @@ static void prompt_host_cancel_cb(PurpleConnection *gc) { const char *msg = _("No Sametime Community Server specified"); - purple_connection_error_reason(gc, PURPLE_REASON_INVALID_SETTINGS, msg); + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, + msg); } @@ -3758,7 +3767,7 @@ purple_connection_update_progress(gc, _("Connecting"), 1, MW_CONNECT_STEPS); if (purple_proxy_connect(gc, account, host, port, connect_cb, pd) == NULL) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect to host")); } }
--- a/libpurple/protocols/silc/silc.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/silc/silc.c Sun Oct 14 21:08:42 2007 +0000 @@ -215,7 +215,7 @@ /* Close the connection */ if (!sg->detaching) purple_connection_error_reason(gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Disconnected by server")); else /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ @@ -223,30 +223,30 @@ break; case SILC_CLIENT_CONN_ERROR: - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error during connecting to SILC Server")); g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); break; case SILC_CLIENT_CONN_ERROR_KE: - purple_connection_error_reason(gc, PURPLE_REASON_ENCRYPTION_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, _("Key Exchange failed")); break; case SILC_CLIENT_CONN_ERROR_AUTH: - purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Authentication failed")); break; case SILC_CLIENT_CONN_ERROR_RESUME: - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Resuming detached session failed. " "Press Reconnect to create new connection.")); g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); break; case SILC_CLIENT_CONN_ERROR_TIMEOUT: - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection Timeout")); break; } @@ -268,7 +268,7 @@ sg = gc->proto_data; if (status != SILC_SOCKET_OK) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection failed")); silc_pkcs_public_key_free(sg->public_key); silc_pkcs_private_key_free(sg->private_key); @@ -315,7 +315,7 @@ sg = gc->proto_data; if (source < 0) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection failed")); silc_pkcs_public_key_free(sg->public_key); silc_pkcs_private_key_free(sg->private_key); @@ -357,7 +357,7 @@ (char *)purple_account_get_string(account, "private-key", prd), (gc->password == NULL) ? "" : gc->password, &sg->public_key, &sg->private_key)) { - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Could not load SILC key pair")); gc->proto_data = NULL; silc_free(sg); @@ -371,7 +371,7 @@ purple_account_get_int(account, "port", 706), silcpurple_login_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to create connection")); gc->proto_data = NULL; silc_free(sg); @@ -401,7 +401,7 @@ /* Allocate SILC client */ client = silc_client_alloc(&ops, ¶ms, gc, NULL); if (!client) { - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Out of memory")); return; } @@ -444,14 +444,14 @@ /* Init SILC client */ if (!silc_client_init(client, username, hostname, realname, silcpurple_running, account)) { - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Cannot initialize SILC protocol")); return; } /* Check the ~/.silc dir and create it, and new key pair if necessary. */ if (!silcpurple_check_silc_dir(gc)) { - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Error loading SILC key pair")); return; }
--- a/libpurple/protocols/silc/util.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/silc/util.c Sun Oct 14 21:08:42 2007 +0000 @@ -212,7 +212,7 @@ (gc->password == NULL) ? "" : gc->password, NULL, NULL, FALSE)) { - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Cannot create SILC key pair\n")); return FALSE; } @@ -255,7 +255,7 @@ (gc->password == NULL) ? "" : gc->password, NULL, NULL, FALSE)) { - purple_connection_error_reason(gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Cannot create SILC key pair\n")); return FALSE; }
--- a/libpurple/protocols/simple/simple.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/simple/simple.c Sun Oct 14 21:08:42 2007 +0000 @@ -413,7 +413,8 @@ written = 0; else if(written <= 0) { /*TODO: do we really want to disconnect on a failure to write?*/ - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Could not write")); return; } @@ -436,7 +437,8 @@ } if(source < 0) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Could not connect")); return; } @@ -463,7 +465,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_REASON_NETWORK_ERROR, _("Couldn't create socket")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Couldn't create socket")); } sip->connecting = TRUE; } @@ -1045,7 +1047,7 @@ if (!purple_account_get_remember_password(sip->gc->account)) purple_account_set_password(sip->gc->account, NULL); purple_connection_error_reason(sip->gc, - PURPLE_REASON_AUTHENTICATION_FAILED, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password.")); return TRUE; } @@ -1059,7 +1061,8 @@ if (sip->registerstatus != SIMPLE_REGISTER_RETRY) { purple_debug_info("simple", "Unrecognized return code for REGISTER.\n"); if (sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { - purple_connection_error_reason(sip->gc, PURPLE_REASON_OTHER_ERROR, + purple_connection_error_reason(sip->gc, + PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Unknown server response.")); return TRUE; } @@ -1530,7 +1533,8 @@ } if(source < 0) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Could not connect")); return; } @@ -1565,7 +1569,8 @@ sip->listen_data = NULL; if(listenfd == -1) { - purple_connection_error_reason(sip->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(sip->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Could not create listen socket")); return; } @@ -1590,7 +1595,7 @@ if (!hosts || !hosts->data) { purple_connection_error_reason(sip->gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Couldn't resolve host")); return; } @@ -1611,7 +1616,7 @@ simple_udp_host_resolved_listen_cb, sip); if (sip->listen_data == NULL) { purple_connection_error_reason(sip->gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Could not create listen socket")); return; } @@ -1626,7 +1631,7 @@ sip->listenfd = listenfd; if(sip->listenfd == -1) { purple_connection_error_reason(sip->gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Could not create listen socket")); return; } @@ -1641,7 +1646,7 @@ if (purple_proxy_connect(sip->gc, sip->account, sip->realhostname, sip->realport, login_cb, sip->gc) == NULL) { purple_connection_error_reason(sip->gc, - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Couldn't create socket")); } } @@ -1680,7 +1685,8 @@ sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_STREAM, simple_tcp_connect_listen_cb, sip); if (sip->listen_data == NULL) { - purple_connection_error_reason(sip->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(sip->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Could not create listen socket")); return; } @@ -1689,7 +1695,8 @@ sip->query_data = purple_dnsquery_a(hostname, port, simple_udp_host_resolved, sip); if (sip->query_data == NULL) { - purple_connection_error_reason(sip->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(sip->gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Could not resolve hostname")); } } @@ -1706,7 +1713,8 @@ gc = purple_account_get_connection(account); if (strpbrk(username, " \t\v\r\n") != NULL) { - purple_connection_error_reason(gc, PURPLE_REASON_INVALID_SETTINGS, + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, _("SIP screen names may not contain whitespaces or @ symbols")); return; }
--- a/libpurple/protocols/yahoo/yahoo.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Sun Oct 14 21:08:42 2007 +0000 @@ -203,7 +203,7 @@ if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { if (!purple_account_get_remember_password(account)) purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, PURPLE_REASON_NAME_IN_USE, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _("You have signed on from another location.")); return; } @@ -2139,7 +2139,7 @@ else fullmsg = g_strdup(msg); - purple_connection_error_reason(gc, PURPLE_REASON_AUTHENTICATION_FAILED, fullmsg); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, fullmsg); g_free(msg); g_free(fullmsg); } @@ -2463,11 +2463,11 @@ tmp = g_strdup_printf(_("Lost connection with server:\n%s"), strerror(errno)); - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, tmp); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } else if (len == 0) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server closed the connection.")); return; } @@ -2559,7 +2559,7 @@ gchar *tmp; tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"), error_message); - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, tmp); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } @@ -2591,7 +2591,7 @@ gchar *tmp; tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"), error_message); - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, tmp); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } @@ -2631,11 +2631,11 @@ tmp = g_strdup_printf(_("Lost connection with server:\n%s"), strerror(errno)); - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, tmp); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } else if (len == 0) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server closed the connection.")); return; } @@ -2651,7 +2651,7 @@ if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) && strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Received unexpected HTTP response from server.")); return; } @@ -2676,7 +2676,7 @@ if (purple_proxy_connect(gc, account, "wcs2.msg.dcn.yahoo.com", purple_account_get_int(account, "port", YAHOO_PAGER_PORT), yahoo_got_web_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection problem")); return; } @@ -2705,7 +2705,7 @@ gc->inpa = 0; tmp = g_strdup_printf(_("Lost connection with %s:\n%s"), "login.yahoo.com:80", strerror(errno)); - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, tmp); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } @@ -2730,7 +2730,7 @@ gchar *tmp; tmp = g_strdup_printf(_("Could not establish a connection with %s:\n%s"), "login.yahoo.com:80", error_message); - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, tmp); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); g_free(tmp); return; } @@ -2814,7 +2814,7 @@ if (error_message != NULL) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); return; } @@ -2864,7 +2864,7 @@ g_hash_table_destroy(hash); yd->auth = g_string_free(url, FALSE); if (purple_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection problem")); return; } @@ -2968,7 +2968,7 @@ purple_account_get_int(account, "port", YAHOO_PAGER_PORT), yahoo_got_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection problem")); return; } @@ -2979,7 +2979,7 @@ purple_account_get_int(account, "port", YAHOO_PAGER_PORT), yahoo_got_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Connection problem")); return; }
--- a/libpurple/protocols/yahoo/yahoo_packet.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/yahoo/yahoo_packet.c Sun Oct 14 21:08:42 2007 +0000 @@ -304,7 +304,7 @@ return; else if (ret < 0) { /* TODO: what to do here - do we really have to disconnect? */ - purple_connection_error_reason(yd->gc, PURPLE_REASON_NETWORK_ERROR, + purple_connection_error_reason(yd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Write Error")); return; }
--- a/libpurple/protocols/yahoo/ycht.c Sun Oct 14 12:19:20 2007 +0000 +++ b/libpurple/protocols/yahoo/ycht.c Sun Oct 14 21:08:42 2007 +0000 @@ -286,7 +286,7 @@ /* TODO: error handling */ /* purple_connection_error_reason(purple_account_get_connection(irc->account), - PURPLE_REASON_NETWORK_ERROR, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Server has disconnected")); */ return;
--- a/pidgin/gtkconn.c Sun Oct 14 12:19:20 2007 +0000 +++ b/pidgin/gtkconn.c Sun Oct 14 21:08:42 2007 +0000 @@ -139,7 +139,7 @@ static void pidgin_connection_report_disconnect_reason (PurpleConnection *gc, - PurpleDisconnectReason reason, + PurpleConnectionError reason, const char *text) { PurpleAccount *account = NULL; @@ -150,7 +150,7 @@ info = g_hash_table_lookup(auto_reconns, account); pidgin_blist_update_account_error_state(account, text); - if (!purple_connection_reason_is_fatal (reason)) { + if (!purple_connection_error_is_fatal (reason)) { if (info == NULL) { info = g_new0(PidginAutoRecon, 1); g_hash_table_insert(auto_reconns, account, info); @@ -183,7 +183,7 @@ p = g_strdup_printf(_("%s disconnected"), n); switch (reason) { - case PURPLE_REASON_NO_SSL_SUPPORT: + case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT: s = g_strdup_printf( _("%s\n\n" "%s will not attempt to reconnect the account until you " @@ -191,7 +191,7 @@ "compile %s with SSL support."), text, PIDGIN_NAME, "http://developer.pidgin.im/wiki/FAQssl", PIDGIN_NAME); break; - case PURPLE_REASON_NAME_IN_USE: + case PURPLE_CONNECTION_ERROR_NAME_IN_USE: s = g_strdup_printf( _("%s\n\n" "%s will not attempt to reconnect the account until you "