-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 @@ -145,42 +145,44 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m return; } int r; char*data = 0; size_t len; clistiter * cur = 0; - QString b; RecPartP part = new RecPart(); switch (mime->mm_type) { case MAILMIME_SINGLE: { QValueList<int>countlist = recList; countlist.append(current_count); r = mailmessage_fetch_section(message,mime,&data,&len); part->setSize(len); part->setPositionlist(countlist); - b = gen_attachment_id(); - part->setIdentifier(b); fillSingleBody(part,message,mime); + if (part->Identifier().isEmpty()) { + part->setIdentifier(gen_attachment_id()); + } + if (part->Type()=="text" && target->Bodytext().isNull()) { encodedString*rs = new encodedString(); rs->setContent(data,len); encodedString*res = decode_String(rs,part->Encoding()); if (countlist.count()>2) { - bodyCache[b]=rs; + bodyCache[part->Identifier()]=rs; target->addPart(part); } else { delete rs; } + QString b; b = QString(res->Content()); delete res; target->setBodytext(b); target->setDescription(part); } else { - bodyCache[b]=new encodedString(data,len); + bodyCache[part->Identifier()]=new encodedString(data,len); target->addPart(part); } } break; case MAILMIME_MULTIPLE: { @@ -211,17 +213,16 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m /* the own header is always at recursion 0 - we don't need that */ if (current_rec > 0) { part->setPositionlist(countlist); r = mailmessage_fetch_section(message,mime,&data,&len); part->setSize(len); part->setPositionlist(countlist); - b = gen_attachment_id(); - part->setIdentifier(b); + part->setIdentifier(gen_attachment_id()); part->setType("message"); part->setSubtype("rfc822"); - bodyCache[b]=new encodedString(data,len); + bodyCache[part->Identifier()]=new encodedString(data,len); target->addPart(part); } if (mime->mm_data.mm_message.mm_msg_mime != NULL) { traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); } } |