author | alwin <alwin> | 2003-12-23 01:58:59 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-23 01:58:59 (UTC) |
commit | 127c50cc446de489c702400ebc5fc4874f6311b2 (patch) (unidiff) | |
tree | 86ba684107eb2258e22b613c8c0dfa1a0c8a1bda /noncore/net/mail/mboxwrapper.cpp | |
parent | 04a7006c0392c02941e263d4d35edeeb2f98223d (diff) | |
download | opie-127c50cc446de489c702400ebc5fc4874f6311b2.zip opie-127c50cc446de489c702400ebc5fc4874f6311b2.tar.gz opie-127c50cc446de489c702400ebc5fc4874f6311b2.tar.bz2 |
UFFFFFFF
flushing send queue mostly finished.
Attention: To get it work you must apply the patches from the libetpan/
directory!
ToDo:
- when flush then select a smtp-account to use for when there are more
than one smtp accounts. (opiemail.cpp) This moment I just use the first one.
- the special funs in mboxwrapper (deleting range of mail, storing a message
to a folder) should go to all mailbox wrappers, means into the global interface
of them.
- cleanup/review the code of the smtp-wrapper.
Diffstat (limited to 'noncore/net/mail/mboxwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/mboxwrapper.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/noncore/net/mail/mboxwrapper.cpp b/noncore/net/mail/mboxwrapper.cpp index 8117cef..293ae1b 100644 --- a/noncore/net/mail/mboxwrapper.cpp +++ b/noncore/net/mail/mboxwrapper.cpp | |||
@@ -219 +219,67 @@ void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folde | |||
219 | } | 219 | } |
220 | |||
221 | void MBOXwrapper::fetchRawBody(const RecMail&mail,char**target,size_t*length) | ||
222 | { | ||
223 | RecBody body; | ||
224 | mailstorage*storage = mailstorage_new(NULL); | ||
225 | QString p = MBOXPath+"/"; | ||
226 | p+=mail.getMbox(); | ||
227 | mailmessage * msg; | ||
228 | char*data=0; | ||
229 | size_t size; | ||
230 | |||
231 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | ||
232 | mailfolder*folder; | ||
233 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | ||
234 | r = mailfolder_connect(folder); | ||
235 | if (r != MAIL_NO_ERROR) { | ||
236 | qDebug("Error initializing mbox"); | ||
237 | mailfolder_free(folder); | ||
238 | mailstorage_free(storage); | ||
239 | return; | ||
240 | } | ||
241 | r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); | ||
242 | if (r != MAIL_NO_ERROR) { | ||
243 | qDebug("Error fetching mail %i",mail.getNumber()); | ||
244 | mailfolder_free(folder); | ||
245 | mailstorage_free(storage); | ||
246 | return; | ||
247 | } | ||
248 | r = mailmessage_fetch(msg,&data,&size); | ||
249 | if (r != MAIL_NO_ERROR) { | ||
250 | qDebug("Error fetching mail %i",mail.getNumber()); | ||
251 | mailfolder_free(folder); | ||
252 | mailstorage_free(storage); | ||
253 | mailmessage_free(msg); | ||
254 | return; | ||
255 | } | ||
256 | *target = data; | ||
257 | *length = size; | ||
258 | mailfolder_free(folder); | ||
259 | mailstorage_free(storage); | ||
260 | mailmessage_free(msg); | ||
261 | } | ||
262 | |||
263 | void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) | ||
264 | { | ||
265 | QString p = MBOXPath+"/"; | ||
266 | p+=mailbox; | ||
267 | mailmbox_folder*f = 0; | ||
268 | int r = mailmbox_init(p.latin1(),0,1,0,&f); | ||
269 | if (r != MAIL_NO_ERROR) { | ||
270 | qDebug("Error init folder"); | ||
271 | return; | ||
272 | } | ||
273 | for (unsigned int i=0; i < target.count();++i) { | ||
274 | r = mailmbox_delete_msg(f,target.at(i)->getNumber()); | ||
275 | if (r!=MAILMBOX_NO_ERROR) { | ||
276 | qDebug("error delete mail"); | ||
277 | } | ||
278 | } | ||
279 | r = mailmbox_expunge(f); | ||
280 | if (r != MAILMBOX_NO_ERROR) { | ||
281 | qDebug("error expunge mailbox"); | ||
282 | } | ||
283 | mailmbox_done(f); | ||
284 | } | ||
285 | |||