email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp
branchRCL_3
changeset 77 da6ac9d688df
parent 60 7fdbb852d323
--- a/email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp	Wed Sep 15 12:08:45 2010 +0300
+++ b/email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp	Wed Oct 13 14:27:34 2010 +0300
@@ -501,7 +501,7 @@
 	fetchInfo->SetRelativePathL(aMimeHeader.RelativePath()); 
 	fetchInfo->SetIsText(aIsText);
 	fetchInfo->SetContentTransferEncoding(aMimeHeader.ContentTransferEncoding());
-
+	fetchInfo->iEmbed = iEmbed;
 	if (aIsText)
 		{
 		fetchInfo->SetCharsetId(aMimeHeader.MimeCharset());
@@ -1129,7 +1129,7 @@
 								  const TMsvId aThisMessage, 
 								  TInt& aAttachments, 
 								  TBool& aIsMHTML, 
-								  TInt& aRelatedAttachments)
+								  TInt& aRelatedAttachments, TBool aIsEmbed)
 	{
 	__LOG_FORMAT((iSession->LogId(), "CImapOpFetchBody::BuildTreeL(message=%x, parent=%x", aThisMessage, aParent));
 
@@ -1138,10 +1138,18 @@
 		{
 		// Build the content entry for the message part
 		HBufC8* newpath=HBufC8::NewLC(aPath.Length()+4);
+		if(aIsEmbed && aBodyStructure->BodyStructureType() == CImapBodyStructure::ETypeText)
+            {
 		*newpath=aPath;
+		    iEmbed = ETrue;
+            }
+		else
+            {
+		    *newpath=aPath;
 		if (aPath.Length())
 			newpath->Des().Append(KIMAP_REL_PATH_SEPARATOR);
 		newpath->Des().AppendNum(1);
+            }
 		BuildContentEntryL(aParent, aBodyStructure, newpath->Des(), aThisMessage, aAttachments, aIsMHTML, aRelatedAttachments);
 		CleanupStack::PopAndDestroy(newpath);
 		}
@@ -1596,7 +1604,7 @@
         }	
 	if (bodystructure)
 	    {
-        BuildTreeL(aMessage.Id(), bodystructure, aPath, aMessage.Id(), attachments, isMHTML, relatedAttachments);
+        BuildTreeL(aMessage.Id(), bodystructure, aPath, aMessage.Id(), attachments, isMHTML, relatedAttachments, ETrue);
 	    }
 	
 	__LOG_FORMAT((iSession->LogId(), "  Built embedded message id %x attachments %d MHTML %d", aMessage.Id(), attachments, isMHTML));