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 | |||
@@ -16,3 +16,2 @@ POP3wrapper::POP3wrapper( POP3account *a ) | |||
16 | m_pop3 = NULL; | 16 | m_pop3 = NULL; |
17 | m_folder = NULL; | ||
18 | msgTempName = a->getFileName()+"_msg_cache"; | 17 | msgTempName = a->getFileName()+"_msg_cache"; |
@@ -60,3 +59,3 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) { | |||
60 | last_msg_id = mail.getNumber(); | 59 | last_msg_id = mail.getNumber(); |
61 | err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); | 60 | err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); |
62 | err = mailmessage_fetch(mailmsg,&message,&length); | 61 | err = mailmessage_fetch(mailmsg,&message,&length); |
@@ -96,3 +95,4 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) { | |||
96 | 95 | ||
97 | void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) { | 96 | void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) |
97 | { | ||
98 | login(); | 98 | login(); |
@@ -101,4 +101,4 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) { | |||
101 | uint32_t res_messages,res_recent,res_unseen; | 101 | uint32_t res_messages,res_recent,res_unseen; |
102 | mailsession_status_folder(m_folder->fld_session,"INBOX",&res_messages,&res_recent,&res_unseen); | 102 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); |
103 | parseList(target,m_folder->fld_session,"INBOX"); | 103 | parseList(target,m_pop3->sto_session,"INBOX"); |
104 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); | 104 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); |
@@ -106,3 +106,4 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) { | |||
106 | 106 | ||
107 | void POP3wrapper::login() { | 107 | void POP3wrapper::login() |
108 | { | ||
108 | if (account->getOffline()) | 109 | if (account->getOffline()) |
@@ -159,12 +160,3 @@ void POP3wrapper::login() { | |||
159 | 160 | ||
160 | 161 | err = mailstorage_connect(m_pop3); | |
161 | m_folder = mailfolder_new(m_pop3, NULL, NULL); | ||
162 | |||
163 | if (m_folder==0) { | ||
164 | Global::statusMessage(tr("Error initializing folder")); | ||
165 | mailstorage_free(m_pop3); | ||
166 | m_pop3 = NULL; | ||
167 | return; | ||
168 | } | ||
169 | err = mailfolder_connect(m_folder); | ||
170 | if (err != MAIL_NO_ERROR) { | 162 | if (err != MAIL_NO_ERROR) { |
@@ -172,4 +164,2 @@ void POP3wrapper::login() { | |||
172 | Global::statusMessage(tr("Error initializing folder")); | 164 | Global::statusMessage(tr("Error initializing folder")); |
173 | mailfolder_free(m_folder); | ||
174 | m_folder = 0; | ||
175 | mailstorage_free(m_pop3); | 165 | mailstorage_free(m_pop3); |
@@ -179,3 +169,4 @@ void POP3wrapper::login() { | |||
179 | 169 | ||
180 | void POP3wrapper::logout() { | 170 | void POP3wrapper::logout() |
171 | { | ||
181 | int err = MAILPOP3_NO_ERROR; | 172 | int err = MAILPOP3_NO_ERROR; |
@@ -183,4 +174,2 @@ void POP3wrapper::logout() { | |||
183 | return; | 174 | return; |
184 | mailfolder_free(m_folder); | ||
185 | m_folder = 0; | ||
186 | mailstorage_free(m_pop3); | 175 | mailstorage_free(m_pop3); |
@@ -202,3 +191,3 @@ void POP3wrapper::deleteMail(const RecMail&mail) { | |||
202 | return; | 191 | return; |
203 | int err = mailsession_remove_message(m_folder->fld_session,mail.getNumber()); | 192 | int err = mailsession_remove_message(m_pop3->sto_session,mail.getNumber()); |
204 | if (err != MAIL_NO_ERROR) { | 193 | if (err != MAIL_NO_ERROR) { |
@@ -217,3 +206,3 @@ int POP3wrapper::deleteAllMail(const Folder*) { | |||
217 | uint32_t result = 0; | 206 | uint32_t result = 0; |
218 | int err = mailsession_messages_number(m_folder->fld_session,NULL,&result); | 207 | int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); |
219 | if (err != MAIL_NO_ERROR) { | 208 | if (err != MAIL_NO_ERROR) { |
@@ -223,3 +212,3 @@ int POP3wrapper::deleteAllMail(const Folder*) { | |||
223 | for (unsigned int i = 0; i < result; ++i) { | 212 | for (unsigned int i = 0; i < result; ++i) { |
224 | err = mailsession_remove_message(m_folder->fld_session,i+1); | 213 | err = mailsession_remove_message(m_pop3->sto_session,i+1); |
225 | if (err != MAIL_NO_ERROR) { | 214 | if (err != MAIL_NO_ERROR) { |
@@ -240,3 +229,3 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { | |||
240 | return; | 229 | return; |
241 | int r = mailsession_status_folder(m_folder->fld_session,0,&target_stat.message_count, | 230 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, |
242 | &target_stat.message_recent,&target_stat.message_unseen); | 231 | &target_stat.message_recent,&target_stat.message_unseen); |
@@ -249,3 +238,3 @@ encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) { | |||
249 | mailmessage * mailmsg = 0; | 238 | mailmessage * mailmsg = 0; |
250 | int err = mailsession_get_message(m_folder->fld_session, mail.getNumber(), &mailmsg); | 239 | int err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); |
251 | err = mailmessage_fetch(mailmsg,&target,&length); | 240 | err = mailmessage_fetch(mailmsg,&target,&length); |
@@ -263,3 +252,3 @@ const QString&POP3wrapper::getType()const { | |||
263 | 252 | ||
264 | const QString&POP3wrapper::getName()const { | 253 | const QString&POP3wrapper::getName()const{ |
265 | return account->getAccountName(); | 254 | return account->getAccountName(); |