author | zautrix <zautrix> | 2005-02-12 22:58:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-12 22:58:10 (UTC) |
commit | 00ec9899a4727a4c9100d320935dde7da4803801 (patch) (side-by-side diff) | |
tree | 22c5100623497bc135d13e65a1da993ed5999d4b /kmicromail | |
parent | d45d293d045a8d0f68e09ff9414e2dd6d18dd651 (diff) | |
download | kdepimpi-00ec9899a4727a4c9100d320935dde7da4803801.zip kdepimpi-00ec9899a4727a4c9100d320935dde7da4803801.tar.gz kdepimpi-00ec9899a4727a4c9100d320935dde7da4803801.tar.bz2 |
imap login fix
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 17 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.h | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 93fb7de..09e52b8 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -123,7 +123,7 @@ bool IMAPwrapper::start_tls(bool force_tls) return try_tls; } -void IMAPwrapper::login() +void IMAPwrapper::login(bool tryTLS) // = true) { QString server, user, pass; uint16_t port; @@ -195,11 +195,11 @@ void IMAPwrapper::login() m_imap = 0; return; } - - if (!ssl) { - try_tls = start_tls(force_tls); + if ( tryTLS ) { + if (!ssl) { + try_tls = start_tls(force_tls); + } } - bool ok = true; if (force_tls && !try_tls) { Global::statusMessage(i18n("Server has no TLS support!")); @@ -212,6 +212,13 @@ void IMAPwrapper::login() if (ok) { err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() ); if ( err != MAILIMAP_NO_ERROR ) { + if ( tryTLS && !force_tls && !try_tls ) { + err = mailimap_close( m_imap ); + mailimap_free( m_imap ); + m_imap = 0; + login( false ); + return; + } Global::statusMessage(i18n("error logging in imap server: %1").arg(m_imap->imap_response)); ok = false; } diff --git a/kmicromail/libmailwrapper/imapwrapper.h b/kmicromail/libmailwrapper/imapwrapper.h index 5535d8d..31c60a8 100644 --- a/kmicromail/libmailwrapper/imapwrapper.h +++ b/kmicromail/libmailwrapper/imapwrapper.h @@ -56,7 +56,7 @@ public: protected: RecMail*parse_list_result(mailimap_msg_att*); - void login(); + void login(bool tryTLS = true); bool start_tls(bool force=true); virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); |