Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index eae85a7..dc02780 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp @@ -29,3 +29,3 @@ void IMAPwrapper::login() int err = MAILIMAP_NO_ERROR; - + server = account->getServer().latin1(); @@ -34,7 +34,13 @@ void IMAPwrapper::login() pass = account->getPassword().latin1(); - - m_imap = mailimap_new( 20, &imap_progress ); + + m_imap = mailimap_new( 20, &imap_progress ); /* connect */ - err = mailimap_socket_connect( m_imap, (char*)server, port ); - if ( err != MAILIMAP_NO_ERROR && + // err = mailimap_socket_connect( m_imap, (char*)server, port ); + if (account->getSSL()) { + err = mailimap_ssl_connect( m_imap, (char*)server, port ); + } else { + err = mailimap_socket_connect( m_imap, (char*)server, port ); + } + + if ( err != MAILIMAP_NO_ERROR && err != MAILIMAP_NO_ERROR_AUTHENTICATED && @@ -46,3 +52,3 @@ void IMAPwrapper::login() } - + /* login */ @@ -76,3 +82,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) mailimap_set *set; - + mb = mailbox.latin1(); @@ -97,4 +103,4 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) } - - result = clist_new(); + + result = clist_new(); /* the range has to start at 1!!! not with 0!!!! */ @@ -104,3 +110,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) fetchAttDate = mailimap_fetch_att_new_internaldate(); - + //fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); @@ -110,3 +116,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) mailimap_fetch_type_new_fetch_att_list_add(fetchType,fetchAttDate); - + err = mailimap_fetch( m_imap, set, fetchType, &result ); @@ -146,3 +152,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders() clistcell *current; - + QList<IMAPFolder> * folders = new QList<IMAPFolder>(); @@ -153,3 +159,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders() } - + /* @@ -178,3 +184,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders() mailimap_list_result_free( result ); - + /* @@ -182,3 +188,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders() */ - mask = "*" ; + mask = "*" ; path = account->getPrefix().latin1(); @@ -198,3 +204,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders() folders->append(new IMAPFolder(temp)); - + } @@ -216,3 +222,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) QStringList addresslist; - + if (!m_att) { @@ -331,5 +337,5 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) mailimap_body*body_desc; - + mb = mail.getMbox().latin1(); - + login(); @@ -345,6 +351,6 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) } - result = clist_new(); + result = clist_new(); /* the range has to start at 1!!! not with 0!!!! */ set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); - fetchAtt = mailimap_fetch_att_new_body(); + fetchAtt = mailimap_fetch_att_new_body(); fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); @@ -363,3 +369,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) } - + } else { @@ -369,3 +375,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) clist_free(result); - logout(); + logout(); return body; @@ -398,5 +404,5 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap mailimap_set *set; - + mb = mail.getMbox().latin1(); - + if (!m_imap) { @@ -405,3 +411,3 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap - result = clist_new(); + result = clist_new(); /* the range has to start at 1!!! not with 0!!!! */ @@ -413,3 +419,3 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap mailimap_fetch_type_free( fetchType ); - + if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |