diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-03-06 05:08:45 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-03-06 05:08:45 +0800 |
commit | 4d126fb6748040e58f4d47966f4f832e66814811 (patch) | |
tree | eb4cc1f949aead9d0b4fde11de22881932c1be68 /camel/providers/smtp/camel-smtp-transport.c | |
parent | 944083d8b9805f6d352dac2f09c04f641b84fbc9 (diff) | |
download | gsoc2013-evolution-4d126fb6748040e58f4d47966f4f832e66814811.tar.gz gsoc2013-evolution-4d126fb6748040e58f4d47966f4f832e66814811.tar.zst gsoc2013-evolution-4d126fb6748040e58f4d47966f4f832e66814811.zip |
i18n'd some strings in here.
2001-03-05 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-store.c (imap_connect): i18n'd some
strings in here.
* providers/smtp/camel-smtp-transport.c (smtp_connect): Keep
trying to authenticate until either we succeed or until the user
cancels.
svn path=/trunk/; revision=8561
Diffstat (limited to 'camel/providers/smtp/camel-smtp-transport.c')
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 90a9c5f377..0d2c75398c 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -280,7 +280,10 @@ smtp_connect (CamelService *service, CamelException *ex) /* check to see if AUTH is required, if so...then AUTH ourselves */ if (service->url->authmech) { + CamelSession *session = camel_service_get_session (service); CamelServiceAuthType *authtype; + gboolean authenticated = FALSE; + char *errbuf = NULL; if (!transport->is_esmtp || !g_hash_table_lookup (transport->authtypes, service->url->authmech)) { camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, @@ -300,9 +303,58 @@ smtp_connect (CamelService *service, CamelException *ex) return FALSE; } - if (!smtp_auth (transport, authtype->authproto, ex)) { - camel_service_disconnect (service, TRUE, NULL); - return FALSE; + if (!authtype->need_password) { + /* authentication mechanism doesn't need a password, + so if it fails there's nothing we can do */ + authenticated = smtp_auth (transport, authtype->authproto, ex); + if (!authenticated) { + camel_service_disconnect (service, TRUE, NULL); + return FALSE; + } + } + + /* keep trying to login until either we succeed or the user cancels */ + while (!authenticated) { + if (errbuf) { + /* We need to un-cache the password before prompting again */ + camel_session_query_authenticator ( + session, CAMEL_AUTHENTICATOR_TELL, NULL, + TRUE, service, "password", ex); + g_free (service->url->passwd); + service->url->passwd = NULL; + } + + if (!service->url->passwd) { + char *prompt; + + prompt = g_strdup_printf (_("%sPlease enter the SMTP password for %s@%s"), + errbuf ? errbuf : "", service->url->user, + service->url->host); + + service->url->passwd = + camel_session_query_authenticator ( + session, CAMEL_AUTHENTICATOR_ASK, + prompt, TRUE, service, "password", ex); + + g_free (prompt); + g_free (errbuf); + errbuf = NULL; + + if (!service->url->passwd) { + camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, + _("You didn't enter a password.")); + camel_service_disconnect (service, TRUE, NULL); + return FALSE; + } + } + + authenticated = smtp_auth (transport, authtype->authproto, ex); + if (!authenticated) { + errbuf = g_strdup_printf (_("Unable to authenticate " + "to IMAP server.\n%s\n\n"), + camel_exception_get_description (ex)); + camel_exception_clear (ex); + } } /* we have to re-EHLO */ |