summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp5
-rw-r--r--noncore/net/mail/pop3wrapper.cpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 6decb6a..1538d50 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -52,49 +52,54 @@ RecMail *POP3wrapper::parseHeader( const char *h )
QString header( h );
//TODO: parse header - maybe something like this is already implemented in libetpan?
mail->setSubject( "Blah blubb" );
return mail;
}
void POP3wrapper::login()
{
if ( m_pop3 != NULL ) logout();
const char *server, *user, *pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
server = account->getServer().latin1();
port = account->getPort().toUInt();
user = account->getUser().latin1();
pass = account->getPassword().latin1();
m_pop3 = mailpop3_new( 200, &pop3_progress );
// connect
+ if (account->getSSL()) {
+ err = mailpop3_ssl_connect( m_pop3, (char*)server, port );
+ } else {
err = mailpop3_socket_connect( m_pop3, (char *) server, port );
+ }
+
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "pop3: error connecting to %s\n reason: %s", server,
m_pop3->response );
mailpop3_free( m_pop3 );
m_pop3 = NULL;
return;
}
qDebug( "POP3: connected!" );
// login
// TODO: decide if apop or plain login should be used
err = mailpop3_login( m_pop3, (char *) user, (char *) pass );
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "pop3: error logging in: %s", m_pop3->response );
logout();
return;
}
qDebug( "POP3: logged in!" );
}
void POP3wrapper::logout()
{
int err = MAILPOP3_NO_ERROR;
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp
index 6decb6a..1538d50 100644
--- a/noncore/net/mail/pop3wrapper.cpp
+++ b/noncore/net/mail/pop3wrapper.cpp
@@ -52,49 +52,54 @@ RecMail *POP3wrapper::parseHeader( const char *h )
QString header( h );
//TODO: parse header - maybe something like this is already implemented in libetpan?
mail->setSubject( "Blah blubb" );
return mail;
}
void POP3wrapper::login()
{
if ( m_pop3 != NULL ) logout();
const char *server, *user, *pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
server = account->getServer().latin1();
port = account->getPort().toUInt();
user = account->getUser().latin1();
pass = account->getPassword().latin1();
m_pop3 = mailpop3_new( 200, &pop3_progress );
// connect
+ if (account->getSSL()) {
+ err = mailpop3_ssl_connect( m_pop3, (char*)server, port );
+ } else {
err = mailpop3_socket_connect( m_pop3, (char *) server, port );
+ }
+
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "pop3: error connecting to %s\n reason: %s", server,
m_pop3->response );
mailpop3_free( m_pop3 );
m_pop3 = NULL;
return;
}
qDebug( "POP3: connected!" );
// login
// TODO: decide if apop or plain login should be used
err = mailpop3_login( m_pop3, (char *) user, (char *) pass );
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "pop3: error logging in: %s", m_pop3->response );
logout();
return;
}
qDebug( "POP3: logged in!" );
}
void POP3wrapper::logout()
{
int err = MAILPOP3_NO_ERROR;