Diffstat (limited to 'noncore/net/mail/mboxwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/mboxwrapper.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/noncore/net/mail/mboxwrapper.cpp b/noncore/net/mail/mboxwrapper.cpp index 7581715..8117cef 100644 --- a/noncore/net/mail/mboxwrapper.cpp +++ b/noncore/net/mail/mboxwrapper.cpp | |||
@@ -1,17 +1,17 @@ | |||
1 | #include "mboxwrapper.h" | 1 | #include "mboxwrapper.h" |
2 | #include "mailtypes.h" | 2 | #include "mailtypes.h" |
3 | #include "mailwrapper.h" | 3 | #include "mailwrapper.h" |
4 | #include "libetpan/libetpan.h" | 4 | #include <libetpan/libetpan.h> |
5 | #include "libetpan/mailstorage.h" | 5 | #include <libetpan/mailstorage.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | 7 | ||
8 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) | 8 | MBOXwrapper::MBOXwrapper(const QString & mbox_dir) |
9 | : Genericwrapper(),MBOXPath(mbox_dir) | 9 | : Genericwrapper(),MBOXPath(mbox_dir) |
10 | { | 10 | { |
11 | QDir dir(MBOXPath); | 11 | QDir dir(MBOXPath); |
12 | if (!dir.exists()) { | 12 | if (!dir.exists()) { |
13 | dir.mkdir(MBOXPath); | 13 | dir.mkdir(MBOXPath); |
14 | } | 14 | } |
15 | } | 15 | } |
16 | 16 | ||
17 | MBOXwrapper::~MBOXwrapper() | 17 | MBOXwrapper::~MBOXwrapper() |
@@ -58,25 +58,24 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
58 | mailmessage * msg; | 58 | mailmessage * msg; |
59 | QBitArray mFlags(7); | 59 | QBitArray mFlags(7); |
60 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 60 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
61 | if (msg->msg_fields == NULL) { | 61 | if (msg->msg_fields == NULL) { |
62 | qDebug("could not fetch envelope of message %i", i); | 62 | qDebug("could not fetch envelope of message %i", i); |
63 | continue; | 63 | continue; |
64 | } | 64 | } |
65 | RecMail * mail = new RecMail(); | 65 | RecMail * mail = new RecMail(); |
66 | mail->setWrapper(this); | 66 | mail->setWrapper(this); |
67 | mail_flags * flag_result = 0; | 67 | mail_flags * flag_result = 0; |
68 | r = mailmessage_get_flags(msg,&flag_result); | 68 | r = mailmessage_get_flags(msg,&flag_result); |
69 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | 69 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { |
70 | qDebug("flag fetching not implemented"); | ||
71 | mFlags.setBit(FLAG_SEEN); | 70 | mFlags.setBit(FLAG_SEEN); |
72 | } | 71 | } |
73 | mailimf_single_fields single_fields; | 72 | mailimf_single_fields single_fields; |
74 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | 73 | mailimf_single_fields_init(&single_fields, msg->msg_fields); |
75 | mail->setMsgsize(msg->msg_size); | 74 | mail->setMsgsize(msg->msg_size); |
76 | mail->setFlags(mFlags); | 75 | mail->setFlags(mFlags); |
77 | mail->setMbox(mailbox); | 76 | mail->setMbox(mailbox); |
78 | mail->setNumber(i+1); | 77 | mail->setNumber(i+1); |
79 | if (single_fields.fld_subject) | 78 | if (single_fields.fld_subject) |
80 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | 79 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); |
81 | if (single_fields.fld_from) | 80 | if (single_fields.fld_from) |
82 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 81 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
@@ -188,12 +187,33 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) | |||
188 | body = parseMail(msg); | 187 | body = parseMail(msg); |
189 | mailmessage_fetch_result_free(msg,data); | 188 | mailmessage_fetch_result_free(msg,data); |
190 | mailfolder_free(folder); | 189 | mailfolder_free(folder); |
191 | mailstorage_free(storage); | 190 | mailstorage_free(storage); |
192 | 191 | ||
193 | return body; | 192 | return body; |
194 | } | 193 | } |
195 | 194 | ||
196 | void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) | 195 | void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) |
197 | { | 196 | { |
198 | qDebug("MBOX %i von %i",current,maximum); | 197 | qDebug("MBOX %i von %i",current,maximum); |
199 | } | 198 | } |
199 | |||
200 | void MBOXwrapper::createFolder(const QString&) | ||
201 | { | ||
202 | } | ||
203 | |||
204 | void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | ||
205 | { | ||
206 | QString p = MBOXPath+"/"; | ||
207 | p+=folder; | ||
208 | mailmbox_folder*f = 0; | ||
209 | int r = mailmbox_init(p.latin1(),0,1,0,&f); | ||
210 | if (r != MAIL_NO_ERROR) { | ||
211 | qDebug("Error init folder"); | ||
212 | return; | ||
213 | } | ||
214 | r = mailmbox_append_message(f,msg,length); | ||
215 | if (r != MAIL_NO_ERROR) { | ||
216 | qDebug("Error writing message folder"); | ||
217 | } | ||
218 | mailmbox_done(f); | ||
219 | } | ||