Diffstat (limited to 'noncore/net/mail/libmailwrapper/pop3wrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index f5eca4a..14c2059 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp @@ -15,5 +15,4 @@ POP3wrapper::POP3wrapper( POP3account *a ) account = a; m_pop3 = NULL; - m_folder = NULL; msgTempName = a->getFileName()+"_msg_cache"; last_msg_id = 0; @@ -59,5 +58,5 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) { msg_cache.open(IO_ReadWrite|IO_Truncate); last_msg_id = mail.getNumber(); - err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); + err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); err = mailmessage_fetch(mailmsg,&message,&length); msg_cache.writeBlock(message,length); @@ -95,15 +94,17 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) { } -void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) { +void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) +{ login(); if (!m_pop3) return; uint32_t res_messages,res_recent,res_unseen; - mailsession_status_folder(m_folder->fld_session,"INBOX",&res_messages,&res_recent,&res_unseen); - parseList(target,m_folder->fld_session,"INBOX"); + mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); + parseList(target,m_pop3->sto_session,"INBOX"); Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); } -void POP3wrapper::login() { +void POP3wrapper::login() +{ if (account->getOffline()) return; @@ -158,19 +159,8 @@ void POP3wrapper::login() { - - m_folder = mailfolder_new(m_pop3, NULL, NULL); - - if (m_folder==0) { - Global::statusMessage(tr("Error initializing folder")); - mailstorage_free(m_pop3); - m_pop3 = NULL; - return; - } - err = mailfolder_connect(m_folder); + err = mailstorage_connect(m_pop3); if (err != MAIL_NO_ERROR) { qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); Global::statusMessage(tr("Error initializing folder")); - mailfolder_free(m_folder); - m_folder = 0; mailstorage_free(m_pop3); m_pop3 = 0; @@ -178,10 +168,9 @@ void POP3wrapper::login() { } -void POP3wrapper::logout() { +void POP3wrapper::logout() +{ int err = MAILPOP3_NO_ERROR; if ( m_pop3 == NULL ) return; - mailfolder_free(m_folder); - m_folder = 0; mailstorage_free(m_pop3); m_pop3 = 0; @@ -201,5 +190,5 @@ void POP3wrapper::deleteMail(const RecMail&mail) { if (!m_pop3) return; - int err = mailsession_remove_message(m_folder->fld_session,mail.getNumber()); + int err = mailsession_remove_message(m_pop3->sto_session,mail.getNumber()); if (err != MAIL_NO_ERROR) { Global::statusMessage(tr("error deleting mail")); @@ -216,5 +205,5 @@ int POP3wrapper::deleteAllMail(const Folder*) { uint32_t result = 0; - int err = mailsession_messages_number(m_folder->fld_session,NULL,&result); + int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); if (err != MAIL_NO_ERROR) { Global::statusMessage(tr("Error getting folder info")); @@ -222,5 +211,5 @@ int POP3wrapper::deleteAllMail(const Folder*) { } for (unsigned int i = 0; i < result; ++i) { - err = mailsession_remove_message(m_folder->fld_session,i+1); + err = mailsession_remove_message(m_pop3->sto_session,i+1); if (err != MAIL_NO_ERROR) { Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); @@ -239,5 +228,5 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { if (!m_pop3) return; - int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, + int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, &target_stat.message_recent,&target_stat.message_unseen); } @@ -248,5 +237,5 @@ encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) { encodedString*res = 0; mailmessage * mailmsg = 0; - int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); + int err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); err = mailmessage_fetch(mailmsg,&target,&length); if (mailmsg) @@ -262,5 +251,5 @@ const QString&POP3wrapper::getType()const { } -const QString&POP3wrapper::getName()const { +const QString&POP3wrapper::getName()const{ return account->getAccountName(); } |