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 | |
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')
-rw-r--r-- | camel/ChangeLog | 9 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 10 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 58 |
3 files changed, 68 insertions, 9 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 2c9ae16994..faa4e4f074 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,12 @@ +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. + 2001-03-04 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c: Wrote a new version of header_fold() that diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 26cfeb765f..ec65d499b3 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -404,9 +404,8 @@ imap_connect (CamelService *service, CamelException *ex) if (service->url->authmech) { if (!g_hash_table_lookup (store->authtypes, service->url->authmech)) { camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, - "IMAP server %s does not " - "support requested " - "authentication type %s", + _("IMAP server %s does not support requested " + "authentication type %s"), service->url->host, service->url->authmech); camel_service_disconnect (service, TRUE, NULL); @@ -416,8 +415,7 @@ imap_connect (CamelService *service, CamelException *ex) authtype = camel_sasl_authtype (service->url->authmech); if (!authtype) { camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, - "No support for " - "authentication type %s", + _("No support for authentication type %s"), service->url->authmech); camel_service_disconnect (service, TRUE, NULL); return FALSE; @@ -460,7 +458,7 @@ imap_connect (CamelService *service, CamelException *ex) if (!service->url->passwd) { camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, - "You didn\'t enter a password."); + _("You didn't enter a password.")); camel_service_disconnect (service, TRUE, NULL); return FALSE; } 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 */ |