summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp11
-rw-r--r--noncore/net/mail/pop3wrapper.cpp11
2 files changed, 16 insertions, 6 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
@@ -16,25 +16,25 @@ POP3wrapper::~POP3wrapper()
void POP3wrapper::pop3_progress( size_t current, size_t maximum )
{
qDebug( "POP3: %i of %i", current, maximum );
}
void POP3wrapper::listMessages( QList<RecMail> &target )
{
int err = MAILPOP3_NO_ERROR;
char *header;
size_t length;
carray *messages;
-
+
login();
mailpop3_list( m_pop3, &messages );
for ( int i = carray_count( messages ); i > 0; i-- ) {
mailpop3_msg_info *info = (mailpop3_msg_info *) carray_get( messages, i - 1 );
err = mailpop3_header( m_pop3, info->index, &header, &length );
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "POP3: error retrieving header msgid: %i", info->index );
logout();
return;
}
@@ -64,27 +64,32 @@ void POP3wrapper::login()
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
- err = mailpop3_socket_connect( m_pop3, (char *) server, port );
+ 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,
+ 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 );
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
@@ -16,25 +16,25 @@ POP3wrapper::~POP3wrapper()
void POP3wrapper::pop3_progress( size_t current, size_t maximum )
{
qDebug( "POP3: %i of %i", current, maximum );
}
void POP3wrapper::listMessages( QList<RecMail> &target )
{
int err = MAILPOP3_NO_ERROR;
char *header;
size_t length;
carray *messages;
-
+
login();
mailpop3_list( m_pop3, &messages );
for ( int i = carray_count( messages ); i > 0; i-- ) {
mailpop3_msg_info *info = (mailpop3_msg_info *) carray_get( messages, i - 1 );
err = mailpop3_header( m_pop3, info->index, &header, &length );
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "POP3: error retrieving header msgid: %i", info->index );
logout();
return;
}
@@ -64,27 +64,32 @@ void POP3wrapper::login()
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
- err = mailpop3_socket_connect( m_pop3, (char *) server, port );
+ 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,
+ 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 );