summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-12 22:58:10 (UTC)
committer zautrix <zautrix>2005-02-12 22:58:10 (UTC)
commit00ec9899a4727a4c9100d320935dde7da4803801 (patch) (side-by-side diff)
tree22c5100623497bc135d13e65a1da993ed5999d4b
parentd45d293d045a8d0f68e09ff9414e2dd6d18dd651 (diff)
downloadkdepimpi-00ec9899a4727a4c9100d320935dde7da4803801.zip
kdepimpi-00ec9899a4727a4c9100d320935dde7da4803801.tar.gz
kdepimpi-00ec9899a4727a4c9100d320935dde7da4803801.tar.bz2
imap login fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp17
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.h2
3 files changed, 17 insertions, 6 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 77f5829..1a3f827 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,19 +1,23 @@
Info about the changes in new versions of KDE-Pim/Pi
********** VERSION 2.0.7 ************
Added global application font settings
(for all KDE-Pim/Pi apps) to the general settings.
+Fixed a problem in OM/Pi when trying to login to some IMAP servers
+(like the IMAP server of Apple: mail.mac.com )
+
+
********** VERSION 2.0.6 ************
Some bugfixes in the pi-sync mode.
Added German translation for pi-sync mode.
KO/Pi:
Made the todolist using alternate background.
Other minor fixes in KO/Pi.
********** VERSION 2.0.5 ************
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
@@ -114,25 +114,25 @@ bool IMAPwrapper::start_tls(bool force_tls)
if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) {
mailstream_low_free(low);
mailstream_set_low(m_imap->imap_stream, new_low);
} else {
try_tls = false;
}
}
}
}
return try_tls;
}
-void IMAPwrapper::login()
+void IMAPwrapper::login(bool tryTLS) // = true)
{
QString server, user, pass;
uint16_t port;
int err = MAILIMAP_NO_ERROR;
if (account->getOffline()) return;
/* we are connected this moment */
/* TODO: setup a timer holding the line or if connection closed - delete the value */
if (m_imap) {
err = mailimap_noop(m_imap);
if (err!=MAILIMAP_NO_ERROR) {
logout();
@@ -186,41 +186,48 @@ void IMAPwrapper::login()
err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
QString failure = "";
if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) {
failure="Connection refused";
} else {
failure="Unknown failure";
}
Global::statusMessage(i18n("error connecting imap server: %1").arg(failure));
mailimap_free( m_imap );
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!"));
ok = false;
}
/* 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;
}
}
if (!ok) {
err = mailimap_close( m_imap );
mailimap_free( m_imap );
m_imap = 0;
}
}
void IMAPwrapper::logout()
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
@@ -47,25 +47,25 @@ public:
const QString& delemiter="/",bool getsubfolder=false);
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder);
static void imap_progress( size_t current, size_t maximum );
virtual void logout();
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
virtual Account* getAccount() { return account; };
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="");
virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call);
int selectMbox(const QString&mbox);
void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description);
void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which);
void fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which);
void fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which);
void fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which);
void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,QValueList<int>recList,int current_count=1);