email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp
branchRCL_3
changeset 20 94cccd85bd25
parent 0 72b543305e3a
child 26 ebe688cedc25
--- a/email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp	Tue May 25 12:38:02 2010 +0300
+++ b/email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp	Wed Jun 09 09:37:26 2010 +0300
@@ -1565,6 +1565,11 @@
 	CImHeader *messageheader=CImHeader::NewLC();
 	ProcessEnvelopeL(messageheader, aMessage, aBodyStructure->GetRfc822EnvelopeStructureL());
 
+	if(aBodyStructure->EmbeddedBodyStructureList().Count() == 0)
+	    {
+        aMessage.iType=KUidMsvAttachmentEntry;
+	    }
+	
 	// Create message
 	User::LeaveIfError(iServerEntry.CreateEntryBulk(aMessage)); // bulk op completed at the end of ProcessBodyStructureL()
 	SetEntryL(aMessage.Id());
@@ -1583,9 +1588,17 @@
 	TInt attachments=0;
 	TInt relatedAttachments;
 	TBool isMHTML=EFalse;
+	CImapBodyStructure* bodystructure = NULL;
 	
-	CImapBodyStructure* bodystructure = aBodyStructure->EmbeddedBodyStructureList()[0];
-	BuildTreeL(aMessage.Id(), bodystructure, aPath, aMessage.Id(), attachments, isMHTML, relatedAttachments);
+	if(aBodyStructure->EmbeddedBodyStructureList().Count() > 0)
+	    {
+	    bodystructure = aBodyStructure->EmbeddedBodyStructureList()[0];
+        }	
+	if (bodystructure)
+	    {
+        BuildTreeL(aMessage.Id(), bodystructure, aPath, aMessage.Id(), attachments, isMHTML, relatedAttachments);
+	    }
+	
 	__LOG_FORMAT((iSession->LogId(), "  Built embedded message id %x attachments %d MHTML %d", aMessage.Id(), attachments, isMHTML));
 
 	// Save attachment and MHTML flags
@@ -1870,10 +1883,15 @@
 	iHeaderConverter->DecodeAllHeaderFieldsL(*aHeader);
 
 	// Set from line in TMsvEntry
-	aEntry.iDetails.Set(aHeader->From());
-
-	// Set subject in TMsvEntry
-	aEntry.iDescription.Set(aHeader->Subject());
+	if(aHeader->From().Length() > 0)
+	    {
+        aEntry.iDetails.Set(aHeader->From());
+	    }
+	if(aHeader->Subject().Length() > 0)
+	    {
+	    // Set subject in TMsvEntry
+	    aEntry.iDescription.Set(aHeader->Subject());
+	    }
 
 	__LOG_TEXT(iSession->LogId(), "   Finished processing envelope information");
 	}