author | harlekin <harlekin> | 2003-12-10 02:02:53 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-10 02:02:53 (UTC) |
commit | 1f0b92e554b76852af210ceb277b3e9ecb09a43d (patch) (side-by-side diff) | |
tree | a813761b2f0d1a2b8a9a1a996d6e37d511d24f0f /noncore/net | |
parent | a908d0ffdb5cee72b7823fc411119b8e1e3faad8 (diff) | |
download | opie-1f0b92e554b76852af210ceb277b3e9ecb09a43d.zip opie-1f0b92e554b76852af210ceb277b3e9ecb09a43d.tar.gz opie-1f0b92e554b76852af210ceb277b3e9ecb09a43d.tar.bz2 |
ssl for imap now working
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 60 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 60 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 2 |
3 files changed, 67 insertions, 55 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index eae85a7..dc02780 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/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)) ) { 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)) ) { diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 3edfff1..6d13a8b 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -17,3 +17,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) { - setCaption( tr( "Opie-Mail" ) ); + setCaption( tr( "Mail" ) ); setToolBarsMovable( false ); |