summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/imapwrapper.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp68
1 files changed, 58 insertions, 10 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index e0fb6f9..bb8bbfc 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -1,3 +1,4 @@
+// CHANGED 2004-09-31 Lutz Rogowski
#include <stdlib.h>
#include <libetpan/libetpan.h>
#include <qpe/global.h>
@@ -202,7 +203,7 @@ void IMAPwrapper::logout()
m_Lastmbox = "";
}
-void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target )
+void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb)
{
int err = MAILIMAP_NO_ERROR;
clist *result = 0;
@@ -250,10 +251,12 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
msg_att = (mailimap_msg_att*)current->data;
RecMail*m = parse_list_result(msg_att);
if (m) {
- m->setNumber(i);
- m->setMbox(mailbox);
- m->setWrapper(this);
- target.append(m);
+ if ( maxSizeInKb == 0 || m->Msgsize()<=maxSizeInKb*1024 ) {
+ m->setNumber(i);
+ m->setMbox(mailbox);
+ m->setWrapper(this);
+ target.append(m);
+ }
}
}
Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count()));
@@ -866,7 +869,49 @@ void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which
target_part->setEncoding(encoding);
target_part->setSize(which->bd_size);
}
+void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target)
+{
+ mailimap_flag_list*flist;
+ mailimap_set *set;
+ mailimap_store_att_flags * store_flags;
+ int err;
+ login();
+ if (!m_imap) {
+ return;
+ }
+ int iii = 0;
+ int count = target.count();
+ qDebug("imap remove count %d ", count);
+ while (iii < count ) {
+ qDebug("IMAP remove %d ", iii);
+ RecMailP mail = (*target.at( iii ));
+ err = selectMbox(mail->getMbox());
+ if ( err != MAILIMAP_NO_ERROR ) {
+ return;
+ }
+ flist = mailimap_flag_list_new_empty();
+ mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
+ store_flags = mailimap_store_att_flags_new_set_flags(flist);
+ set = mailimap_set_new_single(mail->getNumber());
+ err = mailimap_store(m_imap,set,store_flags);
+ mailimap_set_free( set );
+ mailimap_store_att_flags_free(store_flags);
+
+ if (err != MAILIMAP_NO_ERROR) {
+ // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
+ return;
+ }
+ // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
+ /* should we realy do that at this moment? */
+
+ err = mailimap_expunge(m_imap);
+ if (err != MAILIMAP_NO_ERROR) {
+ Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
+ }
+ ++iii;
+ }
+}
void IMAPwrapper::deleteMail(const RecMailP&mail)
{
mailimap_flag_list*flist;
@@ -895,11 +940,13 @@ void IMAPwrapper::deleteMail(const RecMailP&mail)
}
// odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
/* should we realy do that at this moment? */
+
err = mailimap_expunge(m_imap);
if (err != MAILIMAP_NO_ERROR) {
- // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
+ Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
}
- // odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
+ qDebug("IMAPwrapper::deleteMail ");
+
}
void IMAPwrapper::answeredMail(const RecMailP&mail)
@@ -1120,10 +1167,11 @@ encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail)
}
void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
- const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
+ const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
{
- if (targetWrapper != this) {
- AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
+ if (targetWrapper != this || maxSizeInKb > 0 ) {
+ AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb);
+ qDebug("IMAPwrapper::mvcpAllMails::Using generic");
// odebug << "Using generic" << oendl;
return;
}