author | alwin <alwin> | 2004-01-09 01:16:31 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-09 01:16:31 (UTC) |
commit | d3a4757e062ffc5ce5840cb1c52215435a468ff0 (patch) (unidiff) | |
tree | df5fdfdf42909e31c112b8e147e9e80c9bc0e94d /noncore/net/mail/libmailwrapper | |
parent | 9fc7d401f1445c5f3d3d74e173dea6de2ea4784a (diff) | |
download | opie-d3a4757e062ffc5ce5840cb1c52215435a468ff0.zip opie-d3a4757e062ffc5ce5840cb1c52215435a468ff0.tar.gz opie-d3a4757e062ffc5ce5840cb1c52215435a468ff0.tar.bz2 |
- MHfolder in accountview enhanced
- mv/cp mails has special methods when copy between folder inside a
mh storage
- removed obsolete vars inside pop3wrapper
Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/mhwrapper.cpp | 68 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mhwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 41 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 1 |
4 files changed, 85 insertions, 27 deletions
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 5adba55..512f778 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp | |||
@@ -333 +333,69 @@ const QString&MHwrapper::getName()const | |||
333 | } | 333 | } |
334 | void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | ||
335 | { | ||
336 | init_storage(); | ||
337 | if (!m_storage) { | ||
338 | return; | ||
339 | } | ||
340 | if (targetWrapper != this) { | ||
341 | qDebug("Using generic"); | ||
342 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); | ||
343 | return; | ||
344 | } | ||
345 | qDebug("Using internal routines for move/copy"); | ||
346 | QString tf = buildPath(targetFolder); | ||
347 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); | ||
348 | if (r != MAIL_NO_ERROR) { | ||
349 | qDebug("Error selecting source mailbox"); | ||
350 | return; | ||
351 | } | ||
352 | if (moveit) { | ||
353 | r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); | ||
354 | } else { | ||
355 | r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); | ||
356 | } | ||
357 | if (r != MAIL_NO_ERROR) { | ||
358 | qDebug("Error copy/moving mail internal (%i)",r); | ||
359 | } | ||
360 | } | ||
361 | |||
362 | void MHwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | ||
363 | { | ||
364 | init_storage(); | ||
365 | if (!m_storage) { | ||
366 | return; | ||
367 | } | ||
368 | if (targetWrapper != this) { | ||
369 | qDebug("Using generic"); | ||
370 | Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); | ||
371 | return; | ||
372 | } | ||
373 | if (!fromFolder) return; | ||
374 | int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); | ||
375 | if (r!=MAIL_NO_ERROR) { | ||
376 | qDebug("error selecting source folder!"); | ||
377 | return; | ||
378 | } | ||
379 | QString tf = buildPath(targetFolder); | ||
380 | mailmessage_list*l=0; | ||
381 | r = mailsession_get_messages_list(m_storage->sto_session,&l); | ||
382 | if (r != MAIL_NO_ERROR) { | ||
383 | qDebug("Error message list"); | ||
384 | } | ||
385 | unsigned j = 0; | ||
386 | for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) { | ||
387 | mailmessage * msg; | ||
388 | msg = (mailmessage*)carray_get(l->msg_tab, i); | ||
389 | j = msg->msg_index; | ||
390 | if (moveit) { | ||
391 | r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1()); | ||
392 | } else { | ||
393 | r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1()); | ||
394 | } | ||
395 | if (r != MAIL_NO_ERROR) { | ||
396 | qDebug("Error copy/moving mail internal (%i)",r); | ||
397 | break; | ||
398 | } | ||
399 | } | ||
400 | if (l) mailmessage_list_free(l); | ||
401 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h index 7f028b4..79dec30 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.h +++ b/noncore/net/mail/libmailwrapper/mhwrapper.h | |||
@@ -24,2 +24,4 @@ public: | |||
24 | virtual void answeredMail(const RecMail&mail); | 24 | virtual void answeredMail(const RecMail&mail); |
25 | virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | ||
26 | virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | ||
25 | 27 | ||
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); |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index d2b708d..a24b9cf 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -39,3 +39,2 @@ protected: | |||
39 | mailstorage*m_pop3; | 39 | mailstorage*m_pop3; |
40 | mailfolder*m_folder; | ||
41 | }; | 40 | }; |