email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp
changeset 52 12db4185673b
parent 34 84197e66a4bd
equal deleted inserted replaced
44:36f374c67aa8 52:12db4185673b
  1572 	// Prepare a CImHeader object for the message,
  1572 	// Prepare a CImHeader object for the message,
  1573 	// update flags as appropriate on the message entry.
  1573 	// update flags as appropriate on the message entry.
  1574 	CImHeader *messageheader=CImHeader::NewLC();
  1574 	CImHeader *messageheader=CImHeader::NewLC();
  1575 	ProcessEnvelopeL(messageheader, aMessage, aBodyStructure->GetRfc822EnvelopeStructureL());
  1575 	ProcessEnvelopeL(messageheader, aMessage, aBodyStructure->GetRfc822EnvelopeStructureL());
  1576 
  1576 
       
  1577 	if(aBodyStructure->EmbeddedBodyStructureList().Count() == 0)
       
  1578 	    {
       
  1579         aMessage.iType=KUidMsvAttachmentEntry;
       
  1580 	    }
       
  1581 	
  1577 	// Create message
  1582 	// Create message
  1578 	User::LeaveIfError(iServerEntry.CreateEntryBulk(aMessage)); // bulk op completed at the end of ProcessBodyStructureL()
  1583 	User::LeaveIfError(iServerEntry.CreateEntryBulk(aMessage)); // bulk op completed at the end of ProcessBodyStructureL()
  1579 	SetEntryL(aMessage.Id());
  1584 	SetEntryL(aMessage.Id());
  1580 
  1585 
  1581 	// Store CImHeader and CImMimeHeader for the MESSAGE/RFC822
  1586 	// Store CImHeader and CImMimeHeader for the MESSAGE/RFC822
  1590 #endif
  1595 #endif
  1591 	// Process the bodystructure for this embedded message...
  1596 	// Process the bodystructure for this embedded message...
  1592 	TInt attachments=0;
  1597 	TInt attachments=0;
  1593 	TInt relatedAttachments;
  1598 	TInt relatedAttachments;
  1594 	TBool isMHTML=EFalse;
  1599 	TBool isMHTML=EFalse;
  1595 	
  1600 	CImapBodyStructure* bodystructure = NULL;
  1596 	CImapBodyStructure* bodystructure = aBodyStructure->EmbeddedBodyStructureList()[0];
  1601 	
  1597 	BuildTreeL(aMessage.Id(), bodystructure, aPath, aMessage.Id(), attachments, isMHTML, relatedAttachments);
  1602 	if(aBodyStructure->EmbeddedBodyStructureList().Count() > 0)
       
  1603 	    {
       
  1604 	    bodystructure = aBodyStructure->EmbeddedBodyStructureList()[0];
       
  1605         }	
       
  1606 	if (bodystructure)
       
  1607 	    {
       
  1608         BuildTreeL(aMessage.Id(), bodystructure, aPath, aMessage.Id(), attachments, isMHTML, relatedAttachments);
       
  1609 	    }
       
  1610 	
  1598 	__LOG_FORMAT((iSession->LogId(), "  Built embedded message id %x attachments %d MHTML %d", aMessage.Id(), attachments, isMHTML));
  1611 	__LOG_FORMAT((iSession->LogId(), "  Built embedded message id %x attachments %d MHTML %d", aMessage.Id(), attachments, isMHTML));
  1599 
  1612 
  1600 	// Save attachment and MHTML flags
  1613 	// Save attachment and MHTML flags
  1601 	if (attachments>0 || isMHTML)
  1614 	if (attachments>0 || isMHTML)
  1602 		{
  1615 		{
  1877 
  1890 
  1878 	// Decode any QP encoding in header fields
  1891 	// Decode any QP encoding in header fields
  1879 	iHeaderConverter->DecodeAllHeaderFieldsL(*aHeader);
  1892 	iHeaderConverter->DecodeAllHeaderFieldsL(*aHeader);
  1880 
  1893 
  1881 	// Set from line in TMsvEntry
  1894 	// Set from line in TMsvEntry
  1882 	aEntry.iDetails.Set(aHeader->From());
  1895 	if(aHeader->From().Length() > 0)
  1883 
  1896 	    {
       
  1897         aEntry.iDetails.Set(aHeader->From());
       
  1898 	    }
       
  1899 	if(aHeader->Subject().Length() > 0)
       
  1900 	    {
  1884 	// Set subject in TMsvEntry
  1901 	// Set subject in TMsvEntry
  1885 	aEntry.iDescription.Set(aHeader->Subject());
  1902 	    aEntry.iDescription.Set(aHeader->Subject());
       
  1903 	    }
  1886 
  1904 
  1887 	__LOG_TEXT(iSession->LogId(), "   Finished processing envelope information");
  1905 	__LOG_TEXT(iSession->LogId(), "   Finished processing envelope information");
  1888 	}
  1906 	}
  1889 
  1907 
  1890 
  1908