Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 31 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 1 |
3 files changed, 29 insertions, 5 deletions
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index b609aa7..5dc4cab 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -26,20 +26,20 @@ public: | |||
26 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; | 26 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; |
27 | 27 | ||
28 | virtual void deleteMail(const RecMail&mail)=0; | 28 | virtual void deleteMail(const RecMail&mail)=0; |
29 | virtual void answeredMail(const RecMail&mail)=0; | 29 | virtual void answeredMail(const RecMail&mail)=0; |
30 | virtual void cleanMimeCache(){}; | 30 | virtual void cleanMimeCache(){}; |
31 | virtual int deleteAllMail(const Folder*){return 1;} | 31 | virtual int deleteAllMail(const Folder*){return 1;} |
32 | virtual int deleteMbox(const Folder*){return 1;} | ||
32 | 33 | ||
33 | /* mail box methods */ | 34 | /* mail box methods */ |
34 | /* parameter is the box to create. | 35 | /* parameter is the box to create. |
35 | * if the implementing subclass has prefixes, | 36 | * if the implementing subclass has prefixes, |
36 | * them has to be appended automatic. | 37 | * them has to be appended automatic. |
37 | */ | 38 | */ |
38 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false){return 0;} | 39 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false){return 0;} |
39 | virtual int deleteMbox(const Folder*){return 1;} | ||
40 | 40 | ||
41 | static AbstractMail* getWrapper(IMAPaccount *a); | 41 | static AbstractMail* getWrapper(IMAPaccount *a); |
42 | static AbstractMail* getWrapper(POP3account *a); | 42 | static AbstractMail* getWrapper(POP3account *a); |
43 | /* mbox only! */ | 43 | /* mbox only! */ |
44 | static AbstractMail* getWrapper(const QString&a); | 44 | static AbstractMail* getWrapper(const QString&a); |
45 | 45 | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index b85fbf6..2e70dee 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -203,15 +203,12 @@ void POP3wrapper::logout() | |||
203 | m_pop3 = NULL; | 203 | m_pop3 = NULL; |
204 | } | 204 | } |
205 | 205 | ||
206 | 206 | ||
207 | QList<Folder>* POP3wrapper::listFolders() | 207 | QList<Folder>* POP3wrapper::listFolders() |
208 | { | 208 | { |
209 | /* TODO: integrate MH directories | ||
210 | but not before version 0.1 ;) | ||
211 | */ | ||
212 | QList<Folder> * folders = new QList<Folder>(); | 209 | QList<Folder> * folders = new QList<Folder>(); |
213 | folders->setAutoDelete( false ); | 210 | folders->setAutoDelete( false ); |
214 | Folder*inb=new Folder("INBOX","/"); | 211 | Folder*inb=new Folder("INBOX","/"); |
215 | folders->append(inb); | 212 | folders->append(inb); |
216 | return folders; | 213 | return folders; |
217 | } | 214 | } |
@@ -219,13 +216,39 @@ QList<Folder>* POP3wrapper::listFolders() | |||
219 | void POP3wrapper::deleteMail(const RecMail&mail) | 216 | void POP3wrapper::deleteMail(const RecMail&mail) |
220 | { | 217 | { |
221 | login(); | 218 | login(); |
222 | if (!m_pop3) return; | 219 | if (!m_pop3) return; |
223 | int err = mailpop3_dele(m_pop3,mail.getNumber()); | 220 | int err = mailpop3_dele(m_pop3,mail.getNumber()); |
224 | if (err != MAILPOP3_NO_ERROR) { | 221 | if (err != MAILPOP3_NO_ERROR) { |
225 | qDebug("error deleting mail"); | 222 | Global::statusMessage(tr("error deleting mail")); |
226 | } | 223 | } |
227 | } | 224 | } |
228 | 225 | ||
229 | void POP3wrapper::answeredMail(const RecMail&) | 226 | void POP3wrapper::answeredMail(const RecMail&) |
230 | { | 227 | { |
231 | } | 228 | } |
229 | |||
230 | int POP3wrapper::deleteAllMail(const Folder*) | ||
231 | { | ||
232 | login(); | ||
233 | if (!m_pop3) return 0; | ||
234 | carray * messages = 0; | ||
235 | |||
236 | /* if connected this info is cached! */ | ||
237 | int err = 0; | ||
238 | mailpop3_list( m_pop3, &messages ); | ||
239 | |||
240 | int res = 1; | ||
241 | for (unsigned int i = 0; messages!=0 && i < carray_count(messages);++i) { | ||
242 | mailpop3_msg_info *info; | ||
243 | err = mailpop3_get_msg_info(m_pop3,i+1,&info); | ||
244 | if (info->msg_deleted) | ||
245 | continue; | ||
246 | err = mailpop3_dele(m_pop3,i+1); | ||
247 | if (err != MAILPOP3_NO_ERROR) { | ||
248 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | ||
249 | res = 0; | ||
250 | break; | ||
251 | } | ||
252 | } | ||
253 | return res; | ||
254 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index 7502720..2efffdd 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -16,12 +16,13 @@ public: | |||
16 | /* mailbox will be ignored */ | 16 | /* mailbox will be ignored */ |
17 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | 17 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); |
18 | virtual QList<Folder>* listFolders(); | 18 | virtual QList<Folder>* listFolders(); |
19 | 19 | ||
20 | virtual void deleteMail(const RecMail&mail); | 20 | virtual void deleteMail(const RecMail&mail); |
21 | virtual void answeredMail(const RecMail&mail); | 21 | virtual void answeredMail(const RecMail&mail); |
22 | virtual int deleteAllMail(const Folder*); | ||
22 | 23 | ||
23 | virtual RecBody fetchBody( const RecMail &mail ); | 24 | virtual RecBody fetchBody( const RecMail &mail ); |
24 | static void pop3_progress( size_t current, size_t maximum ); | 25 | static void pop3_progress( size_t current, size_t maximum ); |
25 | 26 | ||
26 | protected: | 27 | protected: |
27 | void login(); | 28 | void login(); |