1563 // Prepare a CImHeader object for the message, |
1563 // Prepare a CImHeader object for the message, |
1564 // update flags as appropriate on the message entry. |
1564 // update flags as appropriate on the message entry. |
1565 CImHeader *messageheader=CImHeader::NewLC(); |
1565 CImHeader *messageheader=CImHeader::NewLC(); |
1566 ProcessEnvelopeL(messageheader, aMessage, aBodyStructure->GetRfc822EnvelopeStructureL()); |
1566 ProcessEnvelopeL(messageheader, aMessage, aBodyStructure->GetRfc822EnvelopeStructureL()); |
1567 |
1567 |
|
1568 if(aBodyStructure->EmbeddedBodyStructureList().Count() == 0) |
|
1569 { |
|
1570 aMessage.iType=KUidMsvAttachmentEntry; |
|
1571 } |
|
1572 |
1568 // Create message |
1573 // Create message |
1569 User::LeaveIfError(iServerEntry.CreateEntryBulk(aMessage)); // bulk op completed at the end of ProcessBodyStructureL() |
1574 User::LeaveIfError(iServerEntry.CreateEntryBulk(aMessage)); // bulk op completed at the end of ProcessBodyStructureL() |
1570 SetEntryL(aMessage.Id()); |
1575 SetEntryL(aMessage.Id()); |
1571 |
1576 |
1572 // Store CImHeader and CImMimeHeader for the MESSAGE/RFC822 |
1577 // Store CImHeader and CImMimeHeader for the MESSAGE/RFC822 |
1581 #endif |
1586 #endif |
1582 // Process the bodystructure for this embedded message... |
1587 // Process the bodystructure for this embedded message... |
1583 TInt attachments=0; |
1588 TInt attachments=0; |
1584 TInt relatedAttachments; |
1589 TInt relatedAttachments; |
1585 TBool isMHTML=EFalse; |
1590 TBool isMHTML=EFalse; |
1586 |
1591 CImapBodyStructure* bodystructure = NULL; |
1587 CImapBodyStructure* bodystructure = aBodyStructure->EmbeddedBodyStructureList()[0]; |
1592 |
1588 BuildTreeL(aMessage.Id(), bodystructure, aPath, aMessage.Id(), attachments, isMHTML, relatedAttachments); |
1593 if(aBodyStructure->EmbeddedBodyStructureList().Count() > 0) |
|
1594 { |
|
1595 bodystructure = aBodyStructure->EmbeddedBodyStructureList()[0]; |
|
1596 } |
|
1597 if (bodystructure) |
|
1598 { |
|
1599 BuildTreeL(aMessage.Id(), bodystructure, aPath, aMessage.Id(), attachments, isMHTML, relatedAttachments); |
|
1600 } |
|
1601 |
1589 __LOG_FORMAT((iSession->LogId(), " Built embedded message id %x attachments %d MHTML %d", aMessage.Id(), attachments, isMHTML)); |
1602 __LOG_FORMAT((iSession->LogId(), " Built embedded message id %x attachments %d MHTML %d", aMessage.Id(), attachments, isMHTML)); |
1590 |
1603 |
1591 // Save attachment and MHTML flags |
1604 // Save attachment and MHTML flags |
1592 if (attachments>0 || isMHTML) |
1605 if (attachments>0 || isMHTML) |
1593 { |
1606 { |
1868 |
1881 |
1869 // Decode any QP encoding in header fields |
1882 // Decode any QP encoding in header fields |
1870 iHeaderConverter->DecodeAllHeaderFieldsL(*aHeader); |
1883 iHeaderConverter->DecodeAllHeaderFieldsL(*aHeader); |
1871 |
1884 |
1872 // Set from line in TMsvEntry |
1885 // Set from line in TMsvEntry |
1873 aEntry.iDetails.Set(aHeader->From()); |
1886 if(aHeader->From().Length() > 0) |
1874 |
1887 { |
1875 // Set subject in TMsvEntry |
1888 aEntry.iDetails.Set(aHeader->From()); |
1876 aEntry.iDescription.Set(aHeader->Subject()); |
1889 } |
|
1890 if(aHeader->Subject().Length() > 0) |
|
1891 { |
|
1892 // Set subject in TMsvEntry |
|
1893 aEntry.iDescription.Set(aHeader->Subject()); |
|
1894 } |
1877 |
1895 |
1878 __LOG_TEXT(iSession->LogId(), " Finished processing envelope information"); |
1896 __LOG_TEXT(iSession->LogId(), " Finished processing envelope information"); |
1879 } |
1897 } |
1880 |
1898 |
1881 |
1899 |