author | alwin <alwin> | 2004-01-02 02:46:27 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-02 02:46:27 (UTC) |
commit | 5fbf2a6b9cda98ab16fa1f0e1ac848a9bb523a72 (patch) (unidiff) | |
tree | 3056d87b4ef4f5684f357b3aa45dd654f3b49e14 /noncore/net/mail/genericwrapper.cpp | |
parent | 8bd5873a04bc8c506694d00be4111549d969fd2a (diff) | |
download | opie-5fbf2a6b9cda98ab16fa1f0e1ac848a9bb523a72.zip opie-5fbf2a6b9cda98ab16fa1f0e1ac848a9bb523a72.tar.gz opie-5fbf2a6b9cda98ab16fa1f0e1ac848a9bb523a72.tar.bz2 |
mail-parts will get a path id for hierarchic structure of the content
while displaying
enclosed rfc mails (like forwards) will be marked as a body-part.
Diffstat (limited to 'noncore/net/mail/genericwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/genericwrapper.cpp | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/noncore/net/mail/genericwrapper.cpp b/noncore/net/mail/genericwrapper.cpp index bef6ae5..5de9299 100644 --- a/noncore/net/mail/genericwrapper.cpp +++ b/noncore/net/mail/genericwrapper.cpp | |||
@@ -124,5 +124,5 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rec) | 126 | void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) |
127 | { | 127 | { |
128 | if (current_rec >= 10) { | 128 | if (current_rec >= 10) { |
@@ -139,8 +139,16 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
139 | RecPart part; | 139 | RecPart part; |
140 | 140 | ||
141 | //current_count; | ||
142 | |||
141 | switch (mime->mm_type) { | 143 | switch (mime->mm_type) { |
142 | case MAILMIME_SINGLE: | 144 | case MAILMIME_SINGLE: |
145 | { | ||
146 | QValueList<int>countlist = recList; | ||
147 | countlist.append(current_count); | ||
143 | r = mailmessage_fetch_section(message,mime,&data,&len); | 148 | r = mailmessage_fetch_section(message,mime,&data,&len); |
144 | part.setSize(len); | 149 | part.setSize(len); |
150 | part.setPositionlist(countlist); | ||
151 | b = gen_attachment_id(); | ||
152 | part.setIdentifier(b); | ||
145 | fillSingleBody(part,message,mime); | 153 | fillSingleBody(part,message,mime); |
146 | if (part.Type()=="text" && target.Bodytext().isNull()) { | 154 | if (part.Type()=="text" && target.Bodytext().isNull()) { |
@@ -154,18 +162,38 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
154 | target.setDescription(part); | 162 | target.setDescription(part); |
155 | } else { | 163 | } else { |
156 | b = gen_attachment_id(); | ||
157 | part.setIdentifier(b); | ||
158 | bodyCache[b]=new encodedString(data,len); | 164 | bodyCache[b]=new encodedString(data,len); |
159 | target.addPart(part); | 165 | target.addPart(part); |
160 | } | 166 | } |
167 | } | ||
161 | break; | 168 | break; |
162 | case MAILMIME_MULTIPLE: | 169 | case MAILMIME_MULTIPLE: |
170 | { | ||
171 | unsigned int ccount = current_count; | ||
163 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { | 172 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { |
164 | traverseBody(target,message, (mailmime*)clist_content(cur),current_rec+1); | 173 | traverseBody(target,message, (mailmime*)clist_content(cur),recList,current_rec+1,ccount); |
174 | ++ccount; | ||
175 | } | ||
165 | } | 176 | } |
166 | break; | 177 | break; |
167 | case MAILMIME_MESSAGE: | 178 | case MAILMIME_MESSAGE: |
179 | { | ||
180 | QValueList<int>countlist = recList; | ||
181 | countlist.append(current_count); | ||
182 | /* the own header is always at recursion 0 - we don't need that */ | ||
183 | if (current_rec > 0) { | ||
184 | part.setPositionlist(countlist); | ||
185 | r = mailmessage_fetch_section(message,mime,&data,&len); | ||
186 | part.setSize(len); | ||
187 | part.setPositionlist(countlist); | ||
188 | b = gen_attachment_id(); | ||
189 | part.setIdentifier(b); | ||
190 | part.setType("message"); | ||
191 | part.setSubtype("rfc822"); | ||
192 | bodyCache[b]=new encodedString(data,len); | ||
193 | target.addPart(part); | ||
194 | } | ||
168 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { | 195 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { |
169 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,current_rec+1); | 196 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); |
197 | } | ||
170 | } | 198 | } |
171 | break; | 199 | break; |
@@ -182,5 +210,6 @@ RecBody Genericwrapper::parseMail( mailmessage * msg ) | |||
182 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 210 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); |
183 | err = mailmessage_get_bodystructure(msg,&mime); | 211 | err = mailmessage_get_bodystructure(msg,&mime); |
184 | traverseBody(body,msg,mime); | 212 | QValueList<int>recList; |
213 | traverseBody(body,msg,mime,recList); | ||
185 | return body; | 214 | return body; |
186 | } | 215 | } |