Diffstat (limited to 'noncore/net/mail/libmailwrapper/mboxwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 68 |
1 files changed, 2 insertions, 66 deletions
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 162a0c9..0aa33dd 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -34,79 +34,15 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
34 | mailfolder_free(folder); | 34 | mailfolder_free(folder); |
35 | mailstorage_free(storage); | 35 | mailstorage_free(storage); |
36 | return; | 36 | return; |
37 | } | 37 | } |
38 | mailmessage_list * env_list = 0; | ||
39 | r = mailsession_get_messages_list(folder->fld_session,&env_list); | ||
40 | if (r != MAIL_NO_ERROR) { | ||
41 | qDebug("Error message list"); | ||
42 | mailfolder_free(folder); | ||
43 | mailstorage_free(storage); | ||
44 | return; | ||
45 | } | ||
46 | r = mailsession_get_envelopes_list(folder->fld_session, env_list); | ||
47 | if (r != MAIL_NO_ERROR) { | ||
48 | qDebug("Error filling message list"); | ||
49 | if (env_list) { | ||
50 | mailmessage_list_free(env_list); | ||
51 | } | ||
52 | mailfolder_free(folder); | ||
53 | mailstorage_free(storage); | ||
54 | return; | ||
55 | } | ||
56 | mailimf_references * refs; | ||
57 | 38 | ||
58 | uint32_t i = 0; | 39 | parseList(target,folder->fld_session,mailbox); |
59 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | ||
60 | mailmessage * msg; | ||
61 | QBitArray mFlags(7); | ||
62 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | ||
63 | if (msg->msg_fields == NULL) { | ||
64 | qDebug("could not fetch envelope of message %i", i); | ||
65 | continue; | ||
66 | } | ||
67 | RecMail * mail = new RecMail(); | ||
68 | mail->setWrapper(this); | ||
69 | mail_flags * flag_result = 0; | ||
70 | r = mailmessage_get_flags(msg,&flag_result); | ||
71 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | ||
72 | mFlags.setBit(FLAG_SEEN); | ||
73 | } | ||
74 | mailimf_single_fields single_fields; | ||
75 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | ||
76 | mail->setMsgsize(msg->msg_size); | ||
77 | mail->setFlags(mFlags); | ||
78 | mail->setMbox(mailbox); | ||
79 | mail->setNumber(i+1); | ||
80 | if (single_fields.fld_subject) | ||
81 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | ||
82 | if (single_fields.fld_from) | ||
83 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | ||
84 | if (single_fields.fld_to) | ||
85 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | ||
86 | if (single_fields.fld_cc) | ||
87 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | ||
88 | if (single_fields.fld_bcc) | ||
89 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | ||
90 | if (single_fields.fld_orig_date) | ||
91 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | ||
92 | if (single_fields.fld_message_id->mid_value) | ||
93 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | ||
94 | refs = single_fields.fld_references; | ||
95 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | ||
96 | char * text = (char*)refs->mid_list->first->data; | ||
97 | mail->setReplyto(QString(text)); | ||
98 | } | ||
99 | 40 | ||
100 | target.append(mail); | ||
101 | } | ||
102 | if (env_list) { | ||
103 | mailmessage_list_free(env_list); | ||
104 | } | ||
105 | mailfolder_disconnect(folder); | 41 | mailfolder_disconnect(folder); |
106 | mailfolder_free(folder); | 42 | mailfolder_free(folder); |
107 | mailstorage_free(storage); | 43 | mailstorage_free(storage); |
108 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(i)); | 44 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); |
109 | } | 45 | } |
110 | 46 | ||
111 | QList<Folder>* MBOXwrapper::listFolders() | 47 | QList<Folder>* MBOXwrapper::listFolders() |
112 | { | 48 | { |