-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 29 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.h | 8 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 6 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.h | 3 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 68 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.h | 6 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.cpp | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.h | 3 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/nntpwrapper.cpp | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/nntpwrapper.h | 3 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.cpp | 21 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.h | 4 |
12 files changed, 128 insertions, 33 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index 128a7c0..3998abd 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #include "abstractmail.h" | 2 | #include "abstractmail.h" |
2 | #include "imapwrapper.h" | 3 | #include "imapwrapper.h" |
3 | #include "pop3wrapper.h" | 4 | #include "pop3wrapper.h" |
4 | #include "nntpwrapper.h" | 5 | #include "nntpwrapper.h" |
5 | #include "mhwrapper.h" | 6 | #include "mhwrapper.h" |
6 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
7 | 8 | ||
8 | 9 | ||
@@ -132,34 +133,48 @@ QString AbstractMail::draftFolder() | |||
132 | { | 133 | { |
133 | return QString("Drafts"); | 134 | return QString("Drafts"); |
134 | } | 135 | } |
135 | 136 | ||
136 | /* temporary - will be removed when implemented in all classes */ | 137 | /* temporary - will be removed when implemented in all classes */ |
137 | void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) | 138 | void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) |
138 | { | 139 | { |
139 | } | 140 | } |
141 | void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) | ||
142 | { | ||
143 | qDebug("AbstractMail::deleteMailList:: Please reimplement! "); | ||
140 | 144 | ||
145 | } | ||
141 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, | 146 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, |
142 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 147 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
148 | { | ||
149 | QValueList<RecMailP> t; | ||
150 | listMessages(fromFolder->getName(),t, maxSizeInKb); | ||
151 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | ||
152 | |||
153 | } | ||
154 | void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, | ||
155 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | ||
143 | { | 156 | { |
144 | QValueList<RecMailP> t; | 157 | |
145 | listMessages(fromFolder->getName(),t); | ||
146 | encodedString*st = 0; | 158 | encodedString*st = 0; |
147 | while (t.count()>0) { | 159 | int iii = 0; |
148 | RecMailP r = (*t.begin()); | 160 | int count = t.count(); |
161 | while (iii < count ) { | ||
162 | RecMailP r = (*t.at( iii )); | ||
149 | st = fetchRawBody(r); | 163 | st = fetchRawBody(r); |
150 | if (st) { | 164 | if (st) { |
151 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | 165 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); |
152 | delete st; | 166 | delete st; |
153 | } | 167 | } |
154 | t.remove(t.begin()); | 168 | ++iii; |
155 | } | 169 | } |
156 | if (moveit) { | 170 | if (moveit) { |
157 | deleteAllMail(fromFolder); | 171 | deleteMailList( t ); |
172 | //deleteAllMail(fromFolder); | ||
158 | } | 173 | } |
159 | } | 174 | } |
160 | 175 | ||
161 | void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 176 | void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
162 | { | 177 | { |
163 | encodedString*st = 0; | 178 | encodedString*st = 0; |
164 | st = fetchRawBody(mail); | 179 | st = fetchRawBody(mail); |
165 | if (st) { | 180 | if (st) { |
diff --git a/kmicromail/libmailwrapper/abstractmail.h b/kmicromail/libmailwrapper/abstractmail.h index e5d64a6..cae83f4 100644 --- a/kmicromail/libmailwrapper/abstractmail.h +++ b/kmicromail/libmailwrapper/abstractmail.h | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #ifndef __abstract_mail_ | 2 | #ifndef __abstract_mail_ |
2 | #define __abstract_mail_ | 3 | #define __abstract_mail_ |
3 | 4 | ||
4 | #include "maildefines.h" | 5 | #include "maildefines.h" |
5 | 6 | ||
6 | #include "settings.h" | 7 | #include "settings.h" |
7 | 8 | ||
8 | #include <qobject.h> | 9 | #include <qobject.h> |
@@ -17,33 +18,36 @@ struct folderStat; | |||
17 | 18 | ||
18 | class AbstractMail:public QObject | 19 | class AbstractMail:public QObject |
19 | { | 20 | { |
20 | Q_OBJECT | 21 | Q_OBJECT |
21 | public: | 22 | public: |
22 | AbstractMail(){}; | 23 | AbstractMail(){}; |
23 | virtual ~AbstractMail(){} | 24 | virtual ~AbstractMail(){} |
24 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0; | 25 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0; |
25 | virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target )=0; | 26 | virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target, int sizeInKb = 0 )=0; |
26 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; | 27 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; |
27 | virtual RecBodyP fetchBody(const RecMailP&mail)=0; | 28 | virtual RecBodyP fetchBody(const RecMailP&mail)=0; |
28 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0; | 29 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0; |
29 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0; | 30 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0; |
30 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0; | 31 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0; |
31 | virtual encodedString* fetchRawBody(const RecMailP&mail)=0; | 32 | virtual encodedString* fetchRawBody(const RecMailP&mail)=0; |
32 | 33 | ||
33 | virtual void deleteMail(const RecMailP&mail)=0; | 34 | virtual void deleteMail(const RecMailP&mail)=0; |
35 | virtual void deleteMailList(const QValueList<RecMailP>&target); | ||
34 | virtual void answeredMail(const RecMailP&mail)=0; | 36 | virtual void answeredMail(const RecMailP&mail)=0; |
35 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0; | 37 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0; |
36 | virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> >&target); | 38 | virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> >&target); |
37 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0; | 39 | virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0; |
38 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 40 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
39 | 41 | ||
40 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, | 42 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
41 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 43 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int sizeInKb = 0); |
44 | virtual void mvcpMailList(const QValueList<RecMailP>& t, | ||
45 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | ||
42 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 46 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
43 | 47 | ||
44 | virtual void cleanMimeCache(){}; | 48 | virtual void cleanMimeCache(){}; |
45 | /* mail box methods */ | 49 | /* mail box methods */ |
46 | /* parameter is the box to create. | 50 | /* parameter is the box to create. |
47 | * if the implementing subclass has prefixes, | 51 | * if the implementing subclass has prefixes, |
48 | * them has to be appended automatic. | 52 | * them has to be appended automatic. |
49 | */ | 53 | */ |
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index f804e44..1fd4bb1 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #include "genericwrapper.h" | 2 | #include "genericwrapper.h" |
2 | #include <libetpan/libetpan.h> | 3 | #include <libetpan/libetpan.h> |
3 | #include "mailtypes.h" | 4 | #include "mailtypes.h" |
4 | 5 | ||
5 | 6 | ||
6 | 7 | ||
7 | using namespace Opie::Core; | 8 | using namespace Opie::Core; |
8 | Genericwrapper::Genericwrapper() | 9 | Genericwrapper::Genericwrapper() |
@@ -387,17 +388,17 @@ QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) | |||
387 | } | 388 | } |
388 | if (h.length()>0) { | 389 | if (h.length()>0) { |
389 | res.append(h); | 390 | res.append(h); |
390 | } | 391 | } |
391 | } | 392 | } |
392 | return res; | 393 | return res; |
393 | } | 394 | } |
394 | 395 | ||
395 | void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) | 396 | void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb) |
396 | { | 397 | { |
397 | int r; | 398 | int r; |
398 | mailmessage_list * env_list = 0; | 399 | mailmessage_list * env_list = 0; |
399 | r = mailsession_get_messages_list(session,&env_list); | 400 | r = mailsession_get_messages_list(session,&env_list); |
400 | if (r != MAIL_NO_ERROR) { | 401 | if (r != MAIL_NO_ERROR) { |
401 | ; // odebug << "Error message list" << oendl; | 402 | ; // odebug << "Error message list" << oendl; |
402 | return; | 403 | return; |
403 | } | 404 | } |
@@ -467,14 +468,15 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & | |||
467 | char * text = (char*)refs->mid_list->first->data; | 468 | char * text = (char*)refs->mid_list->first->data; |
468 | mail->setReplyto(QString(text)); | 469 | mail->setReplyto(QString(text)); |
469 | } | 470 | } |
470 | #endif | 471 | #endif |
471 | if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && | 472 | if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && |
472 | clist_count(single_fields.fld_in_reply_to->mid_list)) { | 473 | clist_count(single_fields.fld_in_reply_to->mid_list)) { |
473 | mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); | 474 | mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); |
474 | } | 475 | } |
475 | target.append(mail); | 476 | if ( maxSizeInKb == 0 || mail->Msgsize()<=maxSizeInKb*1024 ) |
477 | target.append(mail); | ||
476 | } | 478 | } |
477 | if (env_list) { | 479 | if (env_list) { |
478 | mailmessage_list_free(env_list); | 480 | mailmessage_list_free(env_list); |
479 | } | 481 | } |
480 | } | 482 | } |
diff --git a/kmicromail/libmailwrapper/genericwrapper.h b/kmicromail/libmailwrapper/genericwrapper.h index 8be9212..235e116 100644 --- a/kmicromail/libmailwrapper/genericwrapper.h +++ b/kmicromail/libmailwrapper/genericwrapper.h | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #ifndef __GENERIC_WRAPPER_H | 2 | #ifndef __GENERIC_WRAPPER_H |
2 | #define __GENERIC_WRAPPER_H | 3 | #define __GENERIC_WRAPPER_H |
3 | 4 | ||
4 | #include "abstractmail.h" | 5 | #include "abstractmail.h" |
5 | #include <qmap.h> | 6 | #include <qmap.h> |
6 | #include <qstring.h> | 7 | #include <qstring.h> |
7 | #include <libetpan/clist.h> | 8 | #include <libetpan/clist.h> |
8 | 9 | ||
@@ -49,17 +50,17 @@ protected: | |||
49 | QString parseGroup( mailimf_group *group ); | 50 | QString parseGroup( mailimf_group *group ); |
50 | QString parseAddressList( mailimf_address_list *list ); | 51 | QString parseAddressList( mailimf_address_list *list ); |
51 | QString parseDateTime( mailimf_date_time *date ); | 52 | QString parseDateTime( mailimf_date_time *date ); |
52 | 53 | ||
53 | void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); | 54 | void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); |
54 | static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime); | 55 | static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime); |
55 | static void fillParameters(RecPartP&target,clist*parameters); | 56 | static void fillParameters(RecPartP&target,clist*parameters); |
56 | static QString getencoding(mailmime_mechanism*aEnc); | 57 | static QString getencoding(mailmime_mechanism*aEnc); |
57 | virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); | 58 | virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0); |
58 | QStringList parseInreplies(mailimf_in_reply_to * in_replies); | 59 | QStringList parseInreplies(mailimf_in_reply_to * in_replies); |
59 | 60 | ||
60 | QString msgTempName; | 61 | QString msgTempName; |
61 | unsigned int last_msg_id; | 62 | unsigned int last_msg_id; |
62 | QMap<QString,encodedString*> bodyCache; | 63 | QMap<QString,encodedString*> bodyCache; |
63 | mailstorage * m_storage; | 64 | mailstorage * m_storage; |
64 | mailfolder*m_folder; | 65 | mailfolder*m_folder; |
65 | }; | 66 | }; |
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,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #include <stdlib.h> | 2 | #include <stdlib.h> |
2 | #include <libetpan/libetpan.h> | 3 | #include <libetpan/libetpan.h> |
3 | #include <qpe/global.h> | 4 | #include <qpe/global.h> |
4 | #include <qapplication.h> | 5 | #include <qapplication.h> |
5 | #include "imapwrapper.h" | 6 | #include "imapwrapper.h" |
6 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
7 | #include "logindialog.h" | 8 | #include "logindialog.h" |
8 | 9 | ||
@@ -197,17 +198,17 @@ void IMAPwrapper::logout() | |||
197 | if (!m_imap) return; | 198 | if (!m_imap) return; |
198 | err = mailimap_logout( m_imap ); | 199 | err = mailimap_logout( m_imap ); |
199 | err = mailimap_close( m_imap ); | 200 | err = mailimap_close( m_imap ); |
200 | mailimap_free( m_imap ); | 201 | mailimap_free( m_imap ); |
201 | m_imap = 0; | 202 | m_imap = 0; |
202 | m_Lastmbox = ""; | 203 | m_Lastmbox = ""; |
203 | } | 204 | } |
204 | 205 | ||
205 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) | 206 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) |
206 | { | 207 | { |
207 | int err = MAILIMAP_NO_ERROR; | 208 | int err = MAILIMAP_NO_ERROR; |
208 | clist *result = 0; | 209 | clist *result = 0; |
209 | clistcell *current; | 210 | clistcell *current; |
210 | mailimap_fetch_type *fetchType = 0; | 211 | mailimap_fetch_type *fetchType = 0; |
211 | mailimap_set *set = 0; | 212 | mailimap_set *set = 0; |
212 | 213 | ||
213 | login(); | 214 | login(); |
@@ -245,20 +246,22 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
245 | if ( err == MAILIMAP_NO_ERROR ) { | 246 | if ( err == MAILIMAP_NO_ERROR ) { |
246 | mailimap_msg_att * msg_att; | 247 | mailimap_msg_att * msg_att; |
247 | int i = 0; | 248 | int i = 0; |
248 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { | 249 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
249 | ++i; | 250 | ++i; |
250 | msg_att = (mailimap_msg_att*)current->data; | 251 | msg_att = (mailimap_msg_att*)current->data; |
251 | RecMail*m = parse_list_result(msg_att); | 252 | RecMail*m = parse_list_result(msg_att); |
252 | if (m) { | 253 | if (m) { |
253 | m->setNumber(i); | 254 | if ( maxSizeInKb == 0 || m->Msgsize()<=maxSizeInKb*1024 ) { |
254 | m->setMbox(mailbox); | 255 | m->setNumber(i); |
255 | m->setWrapper(this); | 256 | m->setMbox(mailbox); |
256 | target.append(m); | 257 | m->setWrapper(this); |
258 | target.append(m); | ||
259 | } | ||
257 | } | 260 | } |
258 | } | 261 | } |
259 | Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); | 262 | Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); |
260 | } else { | 263 | } else { |
261 | Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); | 264 | Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); |
262 | } | 265 | } |
263 | if (result) mailimap_fetch_list_free(result); | 266 | if (result) mailimap_fetch_list_free(result); |
264 | } | 267 | } |
@@ -861,17 +864,59 @@ void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which | |||
861 | } | 864 | } |
862 | } | 865 | } |
863 | if (which->bd_description) { | 866 | if (which->bd_description) { |
864 | target_part->setDescription(QString(which->bd_description)); | 867 | target_part->setDescription(QString(which->bd_description)); |
865 | } | 868 | } |
866 | target_part->setEncoding(encoding); | 869 | target_part->setEncoding(encoding); |
867 | target_part->setSize(which->bd_size); | 870 | target_part->setSize(which->bd_size); |
868 | } | 871 | } |
872 | void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | ||
873 | { | ||
874 | mailimap_flag_list*flist; | ||
875 | mailimap_set *set; | ||
876 | mailimap_store_att_flags * store_flags; | ||
877 | int err; | ||
878 | login(); | ||
879 | if (!m_imap) { | ||
880 | return; | ||
881 | } | ||
882 | int iii = 0; | ||
883 | int count = target.count(); | ||
884 | qDebug("imap remove count %d ", count); | ||
885 | while (iii < count ) { | ||
886 | qDebug("IMAP remove %d ", iii); | ||
887 | RecMailP mail = (*target.at( iii )); | ||
869 | 888 | ||
889 | err = selectMbox(mail->getMbox()); | ||
890 | if ( err != MAILIMAP_NO_ERROR ) { | ||
891 | return; | ||
892 | } | ||
893 | flist = mailimap_flag_list_new_empty(); | ||
894 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | ||
895 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | ||
896 | set = mailimap_set_new_single(mail->getNumber()); | ||
897 | err = mailimap_store(m_imap,set,store_flags); | ||
898 | mailimap_set_free( set ); | ||
899 | mailimap_store_att_flags_free(store_flags); | ||
900 | |||
901 | if (err != MAILIMAP_NO_ERROR) { | ||
902 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; | ||
903 | return; | ||
904 | } | ||
905 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; | ||
906 | /* should we realy do that at this moment? */ | ||
907 | |||
908 | err = mailimap_expunge(m_imap); | ||
909 | if (err != MAILIMAP_NO_ERROR) { | ||
910 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); | ||
911 | } | ||
912 | ++iii; | ||
913 | } | ||
914 | } | ||
870 | void IMAPwrapper::deleteMail(const RecMailP&mail) | 915 | void IMAPwrapper::deleteMail(const RecMailP&mail) |
871 | { | 916 | { |
872 | mailimap_flag_list*flist; | 917 | mailimap_flag_list*flist; |
873 | mailimap_set *set; | 918 | mailimap_set *set; |
874 | mailimap_store_att_flags * store_flags; | 919 | mailimap_store_att_flags * store_flags; |
875 | int err; | 920 | int err; |
876 | login(); | 921 | login(); |
877 | if (!m_imap) { | 922 | if (!m_imap) { |
@@ -890,21 +935,23 @@ void IMAPwrapper::deleteMail(const RecMailP&mail) | |||
890 | mailimap_store_att_flags_free(store_flags); | 935 | mailimap_store_att_flags_free(store_flags); |
891 | 936 | ||
892 | if (err != MAILIMAP_NO_ERROR) { | 937 | if (err != MAILIMAP_NO_ERROR) { |
893 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; | 938 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; |
894 | return; | 939 | return; |
895 | } | 940 | } |
896 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; | 941 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
897 | /* should we realy do that at this moment? */ | 942 | /* should we realy do that at this moment? */ |
943 | |||
898 | err = mailimap_expunge(m_imap); | 944 | err = mailimap_expunge(m_imap); |
899 | if (err != MAILIMAP_NO_ERROR) { | 945 | if (err != MAILIMAP_NO_ERROR) { |
900 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; | 946 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); |
901 | } | 947 | } |
902 | // odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; | 948 | qDebug("IMAPwrapper::deleteMail "); |
949 | |||
903 | } | 950 | } |
904 | 951 | ||
905 | void IMAPwrapper::answeredMail(const RecMailP&mail) | 952 | void IMAPwrapper::answeredMail(const RecMailP&mail) |
906 | { | 953 | { |
907 | mailimap_flag_list*flist; | 954 | mailimap_flag_list*flist; |
908 | mailimap_set *set; | 955 | mailimap_set *set; |
909 | mailimap_store_att_flags * store_flags; | 956 | mailimap_store_att_flags * store_flags; |
910 | int err; | 957 | int err; |
@@ -1115,20 +1162,21 @@ const QString&IMAPwrapper::getName()const | |||
1115 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) | 1162 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) |
1116 | { | 1163 | { |
1117 | // dummy | 1164 | // dummy |
1118 | QValueList<int> path; | 1165 | QValueList<int> path; |
1119 | return fetchRawPart(mail,path,false); | 1166 | return fetchRawPart(mail,path,false); |
1120 | } | 1167 | } |
1121 | 1168 | ||
1122 | void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | 1169 | void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, |
1123 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 1170 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
1124 | { | 1171 | { |
1125 | if (targetWrapper != this) { | 1172 | if (targetWrapper != this || maxSizeInKb > 0 ) { |
1126 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); | 1173 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); |
1174 | qDebug("IMAPwrapper::mvcpAllMails::Using generic"); | ||
1127 | // odebug << "Using generic" << oendl; | 1175 | // odebug << "Using generic" << oendl; |
1128 | return; | 1176 | return; |
1129 | } | 1177 | } |
1130 | mailimap_set *set = 0; | 1178 | mailimap_set *set = 0; |
1131 | login(); | 1179 | login(); |
1132 | if (!m_imap) { | 1180 | if (!m_imap) { |
1133 | return; | 1181 | return; |
1134 | } | 1182 | } |
diff --git a/kmicromail/libmailwrapper/imapwrapper.h b/kmicromail/libmailwrapper/imapwrapper.h index e56605a..222fe95 100644 --- a/kmicromail/libmailwrapper/imapwrapper.h +++ b/kmicromail/libmailwrapper/imapwrapper.h | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #ifndef __IMAPWRAPPER | 2 | #ifndef __IMAPWRAPPER |
2 | #define __IMAPWRAPPER | 3 | #define __IMAPWRAPPER |
3 | 4 | ||
4 | #include <qlist.h> | 5 | #include <qlist.h> |
5 | #include "mailwrapper.h" | 6 | #include "mailwrapper.h" |
6 | #include "abstractmail.h" | 7 | #include "abstractmail.h" |
7 | #include <libetpan/clist.h> | 8 | #include <libetpan/clist.h> |
8 | 9 | ||
@@ -19,25 +20,26 @@ class encodedString; | |||
19 | 20 | ||
20 | class IMAPwrapper : public AbstractMail | 21 | class IMAPwrapper : public AbstractMail |
21 | { | 22 | { |
22 | Q_OBJECT | 23 | Q_OBJECT |
23 | public: | 24 | public: |
24 | IMAPwrapper( IMAPaccount *a ); | 25 | IMAPwrapper( IMAPaccount *a ); |
25 | virtual ~IMAPwrapper(); | 26 | virtual ~IMAPwrapper(); |
26 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); | 27 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
27 | virtual void listMessages(const QString & mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | 28 | virtual void listMessages(const QString & mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> >&target , int sizeInKb = 0); |
28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 29 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
29 | 30 | ||
30 | virtual void deleteMail(const RecMailP&mail); | 31 | virtual void deleteMail(const RecMailP&mail); |
32 | void deleteMailList(const QValueList<RecMailP>&target); | ||
31 | virtual void answeredMail(const RecMailP&mail); | 33 | virtual void answeredMail(const RecMailP&mail); |
32 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&folder); | 34 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&folder); |
33 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); | 35 | virtual void storeMessage(const char*msg,size_t length, const QString&folder); |
34 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, | 36 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
35 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 37 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit,int sizeInKb = 0); |
36 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 38 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
37 | 39 | ||
38 | virtual RecBodyP fetchBody(const RecMailP&mail); | 40 | virtual RecBodyP fetchBody(const RecMailP&mail); |
39 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); | 41 | virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); |
40 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); | 42 | virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); |
41 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); | 43 | virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); |
42 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 44 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
43 | 45 | ||
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp index 7ef9b32..cbc52d9 100644 --- a/kmicromail/libmailwrapper/mhwrapper.cpp +++ b/kmicromail/libmailwrapper/mhwrapper.cpp | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #include "mhwrapper.h" | 2 | #include "mhwrapper.h" |
2 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
3 | #include "mailwrapper.h" | 4 | #include "mailwrapper.h" |
4 | #include <libetpan/libetpan.h> | 5 | #include <libetpan/libetpan.h> |
5 | #include <qdir.h> | 6 | #include <qdir.h> |
6 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
7 | #include <stdlib.h> | 8 | #include <stdlib.h> |
8 | #include <qpe/global.h> | 9 | #include <qpe/global.h> |
@@ -57,29 +58,29 @@ void MHwrapper::clean_storage() | |||
57 | } | 58 | } |
58 | } | 59 | } |
59 | 60 | ||
60 | MHwrapper::~MHwrapper() | 61 | MHwrapper::~MHwrapper() |
61 | { | 62 | { |
62 | clean_storage(); | 63 | clean_storage(); |
63 | } | 64 | } |
64 | 65 | ||
65 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) | 66 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) |
66 | { | 67 | { |
67 | init_storage(); | 68 | init_storage(); |
68 | if (!m_storage) { | 69 | if (!m_storage) { |
69 | return; | 70 | return; |
70 | } | 71 | } |
71 | QString f = buildPath(mailbox); | 72 | QString f = buildPath(mailbox); |
72 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 73 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
73 | if (r!=MAIL_NO_ERROR) { | 74 | if (r!=MAIL_NO_ERROR) { |
74 | qDebug("listMessages: error selecting folder! "); | 75 | qDebug("listMessages: error selecting folder! "); |
75 | return; | 76 | return; |
76 | } | 77 | } |
77 | parseList(target,m_storage->sto_session,f); | 78 | parseList(target,m_storage->sto_session,f, false, maxSizeInKb ); |
78 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); | 79 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); |
79 | } | 80 | } |
80 | 81 | ||
81 | QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() | 82 | QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() |
82 | { | 83 | { |
83 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); | 84 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); |
84 | /* this is needed! */ | 85 | /* this is needed! */ |
85 | if (m_storage) mailstorage_disconnect(m_storage); | 86 | if (m_storage) mailstorage_disconnect(m_storage); |
diff --git a/kmicromail/libmailwrapper/mhwrapper.h b/kmicromail/libmailwrapper/mhwrapper.h index 4310c84..550824d 100644 --- a/kmicromail/libmailwrapper/mhwrapper.h +++ b/kmicromail/libmailwrapper/mhwrapper.h | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #ifndef __MH_WRAPPER_H | 2 | #ifndef __MH_WRAPPER_H |
2 | #define __MH_WRAPPER_H | 3 | #define __MH_WRAPPER_H |
3 | 4 | ||
4 | #include "maildefines.h" | 5 | #include "maildefines.h" |
5 | 6 | ||
6 | #include "genericwrapper.h" | 7 | #include "genericwrapper.h" |
7 | #include <qstring.h> | 8 | #include <qstring.h> |
8 | 9 | ||
@@ -12,17 +13,17 @@ namespace Opie {namespace Core {class OProcess;}} | |||
12 | 13 | ||
13 | class MHwrapper : public Genericwrapper | 14 | class MHwrapper : public Genericwrapper |
14 | { | 15 | { |
15 | Q_OBJECT | 16 | Q_OBJECT |
16 | public: | 17 | public: |
17 | MHwrapper(const QString & dir,const QString&name); | 18 | MHwrapper(const QString & dir,const QString&name); |
18 | virtual ~MHwrapper(); | 19 | virtual ~MHwrapper(); |
19 | 20 | ||
20 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ); | 21 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); |
21 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); | 22 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
22 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 23 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
23 | 24 | ||
24 | virtual void deleteMail(const RecMailP&mail); | 25 | virtual void deleteMail(const RecMailP&mail); |
25 | virtual void answeredMail(const RecMailP&mail); | 26 | virtual void answeredMail(const RecMailP&mail); |
26 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 27 | virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
27 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, | 28 | virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, |
28 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 29 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
diff --git a/kmicromail/libmailwrapper/nntpwrapper.cpp b/kmicromail/libmailwrapper/nntpwrapper.cpp index daa128e..f5d7f16 100644 --- a/kmicromail/libmailwrapper/nntpwrapper.cpp +++ b/kmicromail/libmailwrapper/nntpwrapper.cpp | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #include "nntpwrapper.h" | 2 | #include "nntpwrapper.h" |
2 | #include "logindialog.h" | 3 | #include "logindialog.h" |
3 | #include "mailtypes.h" | 4 | #include "mailtypes.h" |
4 | 5 | ||
5 | #include <qfile.h> | 6 | #include <qfile.h> |
6 | 7 | ||
7 | #include <stdlib.h> | 8 | #include <stdlib.h> |
8 | 9 | ||
@@ -93,24 +94,24 @@ RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { | |||
93 | mailmessage_free(mailmsg); | 94 | mailmessage_free(mailmsg); |
94 | if (message) | 95 | if (message) |
95 | free(message); | 96 | free(message); |
96 | 97 | ||
97 | return body; | 98 | return body; |
98 | } | 99 | } |
99 | 100 | ||
100 | 101 | ||
101 | void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) | 102 | void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb) |
102 | { | 103 | { |
103 | login(); | 104 | login(); |
104 | if (!m_nntp) | 105 | if (!m_nntp) |
105 | return; | 106 | return; |
106 | uint32_t res_messages,res_recent,res_unseen; | 107 | uint32_t res_messages,res_recent,res_unseen; |
107 | mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen); | 108 | mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen); |
108 | parseList(target,m_nntp->sto_session,which,true); | 109 | parseList(target,m_nntp->sto_session,which,true, maxSizeInKb); |
109 | } | 110 | } |
110 | 111 | ||
111 | void NNTPwrapper::login() | 112 | void NNTPwrapper::login() |
112 | { | 113 | { |
113 | if (account->getOffline()) | 114 | if (account->getOffline()) |
114 | return; | 115 | return; |
115 | /* we'll hold the line */ | 116 | /* we'll hold the line */ |
116 | if ( m_nntp != NULL ) | 117 | if ( m_nntp != NULL ) |
diff --git a/kmicromail/libmailwrapper/nntpwrapper.h b/kmicromail/libmailwrapper/nntpwrapper.h index 2fb82f2..5d4e5ce 100644 --- a/kmicromail/libmailwrapper/nntpwrapper.h +++ b/kmicromail/libmailwrapper/nntpwrapper.h | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #ifndef __NNTPWRAPPER | 2 | #ifndef __NNTPWRAPPER |
2 | #define __NNTPWRAPPER | 3 | #define __NNTPWRAPPER |
3 | 4 | ||
4 | #include "mailwrapper.h" | 5 | #include "mailwrapper.h" |
5 | #include "genericwrapper.h" | 6 | #include "genericwrapper.h" |
6 | #include <qstring.h> | 7 | #include <qstring.h> |
7 | #include <libetpan/clist.h> | 8 | #include <libetpan/clist.h> |
8 | 9 | ||
@@ -15,17 +16,17 @@ class NNTPwrapper : public Genericwrapper | |||
15 | 16 | ||
16 | Q_OBJECT | 17 | Q_OBJECT |
17 | 18 | ||
18 | public: | 19 | public: |
19 | NNTPwrapper( NNTPaccount *a ); | 20 | NNTPwrapper( NNTPaccount *a ); |
20 | virtual ~NNTPwrapper(); | 21 | virtual ~NNTPwrapper(); |
21 | 22 | ||
22 | /* mailbox will be ignored */ | 23 | /* mailbox will be ignored */ |
23 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ); | 24 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); |
24 | /* should only get the subscribed one */ | 25 | /* should only get the subscribed one */ |
25 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); | 26 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
26 | /* mailbox will be ignored */ | 27 | /* mailbox will be ignored */ |
27 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 28 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
28 | QStringList listAllNewsgroups(const QString&mask = QString::null); | 29 | QStringList listAllNewsgroups(const QString&mask = QString::null); |
29 | virtual void deleteMail(const RecMailP&mail); | 30 | virtual void deleteMail(const RecMailP&mail); |
30 | virtual void answeredMail(const RecMailP&mail); | 31 | virtual void answeredMail(const RecMailP&mail); |
31 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 32 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp index e5d083a..7a84b30 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.cpp +++ b/kmicromail/libmailwrapper/pop3wrapper.cpp | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #include <stdlib.h> | 2 | #include <stdlib.h> |
2 | #include "pop3wrapper.h" | 3 | #include "pop3wrapper.h" |
3 | #include "mailtypes.h" | 4 | #include "mailtypes.h" |
4 | #include "logindialog.h" | 5 | #include "logindialog.h" |
5 | #include <libetpan/libetpan.h> | 6 | #include <libetpan/libetpan.h> |
6 | 7 | ||
7 | 8 | ||
8 | #include <qpe/global.h> | 9 | #include <qpe/global.h> |
@@ -91,24 +92,24 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { | |||
91 | if (mailmsg) | 92 | if (mailmsg) |
92 | mailmessage_free(mailmsg); | 93 | mailmessage_free(mailmsg); |
93 | if (message) | 94 | if (message) |
94 | free(message); | 95 | free(message); |
95 | 96 | ||
96 | return body; | 97 | return body; |
97 | } | 98 | } |
98 | 99 | ||
99 | void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) | 100 | void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) |
100 | { | 101 | { |
101 | login(); | 102 | login(); |
102 | if (!m_pop3) | 103 | if (!m_pop3) |
103 | return; | 104 | return; |
104 | uint32_t res_messages,res_recent,res_unseen; | 105 | uint32_t res_messages,res_recent,res_unseen; |
105 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); | 106 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); |
106 | parseList(target,m_pop3->sto_session,"INBOX"); | 107 | parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb); |
107 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); | 108 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); |
108 | } | 109 | } |
109 | 110 | ||
110 | void POP3wrapper::login() | 111 | void POP3wrapper::login() |
111 | { | 112 | { |
112 | if (account->getOffline()) | 113 | if (account->getOffline()) |
113 | return; | 114 | return; |
114 | /* we'll hold the line */ | 115 | /* we'll hold the line */ |
@@ -187,16 +188,32 @@ void POP3wrapper::logout() | |||
187 | 188 | ||
188 | QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { | 189 | QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { |
189 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); | 190 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); |
190 | FolderP inb=new Folder("INBOX","/"); | 191 | FolderP inb=new Folder("INBOX","/"); |
191 | folders->append(inb); | 192 | folders->append(inb); |
192 | return folders; | 193 | return folders; |
193 | } | 194 | } |
194 | 195 | ||
196 | void POP3wrapper::deleteMailList(QValueList<RecMailP>&target) | ||
197 | { | ||
198 | login(); | ||
199 | if (!m_pop3) | ||
200 | return; | ||
201 | int iii = 0; | ||
202 | int count = target.count(); | ||
203 | while (iii < count ) { | ||
204 | RecMailP mail = (*target.at( iii )); | ||
205 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); | ||
206 | if (err != MAIL_NO_ERROR) { | ||
207 | Global::statusMessage(tr("error deleting mail")); | ||
208 | } | ||
209 | ++iii; | ||
210 | } | ||
211 | } | ||
195 | void POP3wrapper::deleteMail(const RecMailP&mail) { | 212 | void POP3wrapper::deleteMail(const RecMailP&mail) { |
196 | login(); | 213 | login(); |
197 | if (!m_pop3) | 214 | if (!m_pop3) |
198 | return; | 215 | return; |
199 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); | 216 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); |
200 | if (err != MAIL_NO_ERROR) { | 217 | if (err != MAIL_NO_ERROR) { |
201 | Global::statusMessage(tr("error deleting mail")); | 218 | Global::statusMessage(tr("error deleting mail")); |
202 | } | 219 | } |
diff --git a/kmicromail/libmailwrapper/pop3wrapper.h b/kmicromail/libmailwrapper/pop3wrapper.h index 5101fa5..ee754a4 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.h +++ b/kmicromail/libmailwrapper/pop3wrapper.h | |||
@@ -1,8 +1,9 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | ||
1 | #ifndef __POP3WRAPPER | 2 | #ifndef __POP3WRAPPER |
2 | #define __POP3WRAPPER | 3 | #define __POP3WRAPPER |
3 | 4 | ||
4 | #include "mailwrapper.h" | 5 | #include "mailwrapper.h" |
5 | #include "genericwrapper.h" | 6 | #include "genericwrapper.h" |
6 | #include <qstring.h> | 7 | #include <qstring.h> |
7 | 8 | ||
8 | class encodedString; | 9 | class encodedString; |
@@ -12,23 +13,24 @@ struct mailfolder; | |||
12 | class POP3wrapper : public Genericwrapper | 13 | class POP3wrapper : public Genericwrapper |
13 | { | 14 | { |
14 | Q_OBJECT | 15 | Q_OBJECT |
15 | 16 | ||
16 | public: | 17 | public: |
17 | POP3wrapper( POP3account *a ); | 18 | POP3wrapper( POP3account *a ); |
18 | virtual ~POP3wrapper(); | 19 | virtual ~POP3wrapper(); |
19 | /* mailbox will be ignored */ | 20 | /* mailbox will be ignored */ |
20 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ); | 21 | virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); |
21 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); | 22 | virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); |
22 | /* mailbox will be ignored */ | 23 | /* mailbox will be ignored */ |
23 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); | 24 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); |
24 | 25 | ||
25 | virtual void deleteMail(const RecMailP&mail); | 26 | virtual void deleteMail(const RecMailP&mail); |
26 | virtual void answeredMail(const RecMailP&mail); | 27 | virtual void answeredMail(const RecMailP&mail); |
28 | virtual void deleteMailList(QValueList<RecMailP>&target); | ||
27 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); | 29 | virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); |
28 | 30 | ||
29 | virtual RecBodyP fetchBody( const RecMailP &mail ); | 31 | virtual RecBodyP fetchBody( const RecMailP &mail ); |
30 | virtual encodedString* fetchRawBody(const RecMailP&mail); | 32 | virtual encodedString* fetchRawBody(const RecMailP&mail); |
31 | virtual void logout(); | 33 | virtual void logout(); |
32 | virtual MAILLIB::ATYPE getType()const; | 34 | virtual MAILLIB::ATYPE getType()const; |
33 | virtual const QString&getName()const; | 35 | virtual const QString&getName()const; |
34 | static void pop3_progress( size_t current, size_t maximum ); | 36 | static void pop3_progress( size_t current, size_t maximum ); |