Mercurial > pidgin.yaz
changeset 20127:a4fda4159937
Add disconnection reasons to sametime.
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Tue, 02 Oct 2007 15:57:32 +0000 |
parents | 5eb52c076a2f |
children | 57e9d1ecefff |
files | libpurple/protocols/sametime/sametime.c |
diffstat | 1 files changed, 43 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/sametime/sametime.c Tue Oct 02 00:27:50 2007 +0000 +++ b/libpurple/protocols/sametime/sametime.c Tue Oct 02 15:57:32 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(pd->gc, _("Connection closed (writing)")); + purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, + _("Connection closed (writing)")); #if 0 close(pd->socket); @@ -1552,7 +1553,38 @@ if(GPOINTER_TO_UINT(info) & ERR_FAILURE) { char *err = mwError(GPOINTER_TO_UINT(info)); - purple_connection_error(gc, err); + PurpleDisconnectReason reason; + switch (GPOINTER_TO_UINT(info)) { + case VERSION_MISMATCH: + reason = PURPLE_REASON_OTHER_ERROR; + break; + + case USER_RESTRICTED: + case INCORRECT_LOGIN: + case USER_UNREGISTERED: + case GUEST_IN_USE: + reason = PURPLE_REASON_AUTHENTICATION_FAILED; + break; + + case ENCRYPT_MISMATCH: + case ERR_ENCRYPT_NO_SUPPORT: + case ERR_NO_COMMON_ENCRYPT: + reason = PURPLE_REASON_ENCRYPTION_ERROR; + break; + + case VERIFICATION_DOWN: + reason = PURPLE_REASON_AUTHENTICATION_IMPOSSIBLE; + break; + + case MULTI_SERVER_LOGIN: + case MULTI_SERVER_LOGIN2: + reason = PURPLE_REASON_NAME_IN_USE; + break; + + default: + reason = PURPLE_REASON_NETWORK_ERROR; + } + purple_connection_error_reason(gc, reason, err); g_free(err); } break; @@ -1698,8 +1730,9 @@ } if(! ret) { + const char *msg = _("Connection reset"); DEBUG_INFO("connection reset\n"); - purple_connection_error(pd->gc, _("Connection reset")); + purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, msg); } else if(ret < 0) { char *msg = strerror(err); @@ -1707,7 +1740,7 @@ DEBUG_INFO("error in read callback: %s\n", msg); msg = g_strdup_printf(_("Error reading from socket: %s"), msg); - purple_connection_error(pd->gc, msg); + purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, msg); g_free(msg); } } @@ -1729,7 +1762,8 @@ } else { /* this is a regular connect, error out */ - purple_connection_error(pd->gc, _("Unable to connect to host")); + const char *msg = _("Unable to connect to host"); + purple_connection_error_reason(pd->gc, PURPLE_REASON_NETWORK_ERROR, msg); } return; @@ -3611,7 +3645,8 @@ static void prompt_host_cancel_cb(PurpleConnection *gc) { - purple_connection_error(gc, _("No Sametime Community Server specified")); + const char *msg = _("No Sametime Community Server specified"); + purple_connection_error_reason(gc, PURPLE_REASON_INVALID_USERNAME, msg); } @@ -3723,7 +3758,8 @@ 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(gc, _("Unable to connect to host")); + purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, + _("Unable to connect to host")); } }