-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 0ac842d..6fcc701 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -143,46 +143,48 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m | |||
143 | } | 143 | } |
144 | if (!message || !mime) { | 144 | if (!message || !mime) { |
145 | return; | 145 | return; |
146 | } | 146 | } |
147 | int r; | 147 | int r; |
148 | char*data = 0; | 148 | char*data = 0; |
149 | size_t len; | 149 | size_t len; |
150 | clistiter * cur = 0; | 150 | clistiter * cur = 0; |
151 | QString b; | ||
152 | RecPartP part = new RecPart(); | 151 | RecPartP part = new RecPart(); |
153 | 152 | ||
154 | switch (mime->mm_type) { | 153 | switch (mime->mm_type) { |
155 | case MAILMIME_SINGLE: | 154 | case MAILMIME_SINGLE: |
156 | { | 155 | { |
157 | QValueList<int>countlist = recList; | 156 | QValueList<int>countlist = recList; |
158 | countlist.append(current_count); | 157 | countlist.append(current_count); |
159 | r = mailmessage_fetch_section(message,mime,&data,&len); | 158 | r = mailmessage_fetch_section(message,mime,&data,&len); |
160 | part->setSize(len); | 159 | part->setSize(len); |
161 | part->setPositionlist(countlist); | 160 | part->setPositionlist(countlist); |
162 | b = gen_attachment_id(); | ||
163 | part->setIdentifier(b); | ||
164 | fillSingleBody(part,message,mime); | 161 | fillSingleBody(part,message,mime); |
162 | if (part->Identifier().isEmpty()) { | ||
163 | part->setIdentifier(gen_attachment_id()); | ||
164 | } | ||
165 | |||
165 | if (part->Type()=="text" && target->Bodytext().isNull()) { | 166 | if (part->Type()=="text" && target->Bodytext().isNull()) { |
166 | encodedString*rs = new encodedString(); | 167 | encodedString*rs = new encodedString(); |
167 | rs->setContent(data,len); | 168 | rs->setContent(data,len); |
168 | encodedString*res = decode_String(rs,part->Encoding()); | 169 | encodedString*res = decode_String(rs,part->Encoding()); |
169 | if (countlist.count()>2) { | 170 | if (countlist.count()>2) { |
170 | bodyCache[b]=rs; | 171 | bodyCache[part->Identifier()]=rs; |
171 | target->addPart(part); | 172 | target->addPart(part); |
172 | } else { | 173 | } else { |
173 | delete rs; | 174 | delete rs; |
174 | } | 175 | } |
176 | QString b; | ||
175 | b = QString(res->Content()); | 177 | b = QString(res->Content()); |
176 | delete res; | 178 | delete res; |
177 | target->setBodytext(b); | 179 | target->setBodytext(b); |
178 | target->setDescription(part); | 180 | target->setDescription(part); |
179 | } else { | 181 | } else { |
180 | bodyCache[b]=new encodedString(data,len); | 182 | bodyCache[part->Identifier()]=new encodedString(data,len); |
181 | target->addPart(part); | 183 | target->addPart(part); |
182 | } | 184 | } |
183 | } | 185 | } |
184 | break; | 186 | break; |
185 | case MAILMIME_MULTIPLE: | 187 | case MAILMIME_MULTIPLE: |
186 | { | 188 | { |
187 | unsigned int ccount = 1; | 189 | unsigned int ccount = 1; |
188 | mailmime*cbody=0; | 190 | mailmime*cbody=0; |
@@ -209,21 +211,20 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m | |||
209 | QValueList<int>countlist = recList; | 211 | QValueList<int>countlist = recList; |
210 | countlist.append(current_count); | 212 | countlist.append(current_count); |
211 | /* the own header is always at recursion 0 - we don't need that */ | 213 | /* the own header is always at recursion 0 - we don't need that */ |
212 | if (current_rec > 0) { | 214 | if (current_rec > 0) { |
213 | part->setPositionlist(countlist); | 215 | part->setPositionlist(countlist); |
214 | r = mailmessage_fetch_section(message,mime,&data,&len); | 216 | r = mailmessage_fetch_section(message,mime,&data,&len); |
215 | part->setSize(len); | 217 | part->setSize(len); |
216 | part->setPositionlist(countlist); | 218 | part->setPositionlist(countlist); |
217 | b = gen_attachment_id(); | 219 | part->setIdentifier(gen_attachment_id()); |
218 | part->setIdentifier(b); | ||
219 | part->setType("message"); | 220 | part->setType("message"); |
220 | part->setSubtype("rfc822"); | 221 | part->setSubtype("rfc822"); |
221 | bodyCache[b]=new encodedString(data,len); | 222 | bodyCache[part->Identifier()]=new encodedString(data,len); |
222 | target->addPart(part); | 223 | target->addPart(part); |
223 | } | 224 | } |
224 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { | 225 | if (mime->mm_data.mm_message.mm_msg_mime != NULL) { |
225 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); | 226 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); |
226 | } | 227 | } |
227 | } | 228 | } |
228 | break; | 229 | break; |
229 | } | 230 | } |