summaryrefslogtreecommitdiffabout
Side-by-side diff
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,55 +1,59 @@
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 ************
Bugfixes in KO/Pi.
********** VERSION 2.0.4 ************
KO/Pi:
Fixed problem loading translations for summary/location edit boxes in event/todo editor.
Added a general "select week number" to the toolbar.
Fixed some small problem of the new features introduced in version 2.0.3.
Made it possible to specify one specific category as category color,
if more than one categories are selected.
Fixed a bug in saving colors for categories with non-ascii characters.
(Like, e.g. German Umlauts).
Propably you have to set your colors again for those categories.
********** VERSION 2.0.3 ************
KO/Pi:
Added feature for changing alarm settings for many items at once:
Open list view (or search dialog), select the desired items and choose in
the popup menu: Set alarm for selected...
Added to the event/todo viewer the option to send an email to
all attendees or all selected (with RSVP) attendees.
Made the week-month mode changing in month view faster.
Made month view better useable with keyboard.
Now TAB key jumps to next cell with an event/todo.
Scroll in cell with coursor keys, scroll in time (next week) with
Shift/Control + coursorkeys.
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
@@ -78,185 +78,192 @@ bool IMAPwrapper::start_tls(bool force_tls)
int err;
bool try_tls = force_tls;
mailimap_capability_data * cap_data = 0;
err = mailimap_capability(m_imap,&cap_data);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage("error getting capabilities!");
return false;
}
clistiter * cur;
for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) {
struct mailimap_capability * cap;
cap = (struct mailimap_capability *)clist_content(cur);
if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) {
if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) {
try_tls = true;
break;
}
}
}
if (cap_data) {
mailimap_capability_data_free(cap_data);
}
if (try_tls) {
err = mailimap_starttls(m_imap);
if (err != MAILIMAP_NO_ERROR && force_tls) {
Global::statusMessage(i18n("Server has no TLS support!"));
try_tls = false;
} else {
mailstream_low * low;
mailstream_low * new_low;
low = mailstream_get_low(m_imap->imap_stream);
if (!low) {
try_tls = false;
} else {
int fd = mailstream_low_get_fd(low);
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();
} else {
mailstream_flush(m_imap->imap_stream);
return;
}
}
server = account->getServer();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser();
pass = login.getPassword();
} else {
// cancel
return;
}
} else {
user = account->getUser();
pass = account->getPassword();
}
m_imap = mailimap_new( 20, &imap_progress );
/* connect */
bool ssl = false;
bool try_tls = false;
bool force_tls = false;
if ( account->ConnectionType() == 2 ) {
ssl = true;
}
if (account->ConnectionType()==1) {
force_tls = true;
}
if ( ssl ) {
qDebug("using ssl ");
err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port );
qDebug("back ");
} else {
err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port );
}
if ( err != MAILIMAP_NO_ERROR &&
err != MAILIMAP_NO_ERROR_AUTHENTICATED &&
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()
{
int err = MAILIMAP_NO_ERROR;
if (!m_imap) return;
err = mailimap_logout( m_imap );
err = mailimap_close( m_imap );
mailimap_free( m_imap );
m_imap = 0;
m_Lastmbox = "";
}
void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb)
{
int tryAgain = 1;
while ( tryAgain >= 0 ) {
int err = MAILIMAP_NO_ERROR;
clist *result = 0;
clistcell *current;
mailimap_fetch_type *fetchType = 0;
mailimap_set *set = 0;
login();
if (!m_imap) {
return;
}
/* select mailbox READONLY for operations */
err = selectMbox(mailbox);
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
int last = m_imap->imap_selection_info->sel_exists;
if (last == 0) {
Global::statusMessage(i18n("Mailbox has no mails"));
return;
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
@@ -11,75 +11,75 @@ struct mailimap;
struct mailimap_body;
struct mailimap_body_type_1part;
struct mailimap_body_type_text;
struct mailimap_body_type_basic;
struct mailimap_body_type_msg;
struct mailimap_body_type_mpart;
struct mailimap_body_fields;
struct mailimap_msg_att;
class encodedString;
class IMAPwrapper : public AbstractMail
{
Q_OBJECT
public:
IMAPwrapper( IMAPaccount *a );
virtual ~IMAPwrapper();
virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
virtual void listMessages(const QString & mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> >&target , int sizeInKb = 0);
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMailP&mail);
void deleteMailList(const QValueList<RecMailP>&target);
virtual void answeredMail(const RecMailP&mail);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&folder);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit,int sizeInKb = 0);
virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual RecBodyP fetchBody(const RecMailP&mail);
virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchRawBody(const RecMailP&mail);
virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0,
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);
/* just helpers */
static void fillBodyFields(RecPartP&target_part,mailimap_body_fields*which);
static QStringList address_list_to_stringlist(clist*list);
static void progress(QString mess = QString::null);
static int mCurrent;
static int mMax;
IMAPaccount *account;
mailimap *m_imap;
QString m_Lastmbox;
};
#endif