Diffstat (limited to 'noncore/net/mail/libmailwrapper/mhwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/mhwrapper.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 85f9cf0..5adba55 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp @@ -58,27 +58,27 @@ void MHwrapper::clean_storage() MHwrapper::~MHwrapper() { clean_storage(); } void MHwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) { init_storage(); if (!m_storage) { return; } QString f = buildPath(mailbox); - int r = mailsession_select_folder(m_storage->sto_session,(char*)mailbox.latin1()); + int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); if (r!=MAIL_NO_ERROR) { - qDebug("error selecting folder!"); + qDebug("listMessages: error selecting folder!"); return; } parseList(target,m_storage->sto_session,f); Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); } QList<Folder>* MHwrapper::listFolders() { QList<Folder> * folders = new QList<Folder>(); folders->setAutoDelete( false ); init_storage(); if (!m_storage) { @@ -227,36 +227,39 @@ encodedString* MHwrapper::fetchRawBody(const RecMail&mail) if (r != MAIL_NO_ERROR) { Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); if (msg) mailmessage_free(msg); return 0; } result = new encodedString(data,size); if (msg) mailmessage_free(msg); return result; } void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) { -#if 0 - QString p = MHPath+"/"; - p+=mailbox; - mailmbox_folder*f = 0; - int r = mailmbox_init(p.latin1(),0,1,0,&f); - if (r != MAIL_NO_ERROR) { - qDebug("Error init folder"); + QString f = buildPath(mailbox); + int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); + if (r!=MAIL_NO_ERROR) { + qDebug("deleteMails: error selecting folder!"); return; } - deleteMails(f,target); - mailmbox_done(f); -#endif + RecMail*c = 0; + for (unsigned int i=0; i < target.count();++i) { + c = target.at(i); + r = mailsession_remove_message(m_storage->sto_session,c->getNumber()); + if (r != MAIL_NO_ERROR) { + qDebug("error deleting mail"); + break; + } + } } int MHwrapper::deleteAllMail(const Folder*tfolder) { init_storage(); if (!m_storage) { return 0; } int res = 1; if (!tfolder) return 0; int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); if (r!=MAIL_NO_ERROR) { |