ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp
changeset 76 38bf5461e270
parent 62 a8c646b56683
equal deleted inserted replaced
74:6c59112cfd31 76:38bf5461e270
   305     FUNC_LOG;
   305     FUNC_LOG;
   306     TInt msgFlags = aMessage.GetFlags();
   306     TInt msgFlags = aMessage.GetFlags();
   307     TBool modified ( EFalse );
   307     TBool modified ( EFalse );
   308     TBool unread( aEmlEntry.Unread() );
   308     TBool unread( aEmlEntry.Unread() );
   309 
   309 
   310 // <qmail>
   310     if ( !LogicalXor( unread, msgFlags & EFSMsgFlag_Read ) ||
   311     if ( LogicalXor( unread, msgFlags & EFSMsgFlag_Read ) ||
   311          !LogicalXor( unread, msgFlags & EFSMsgFlag_Read_Locally ))
   312          LogicalXor( unread, msgFlags & EFSMsgFlag_Read_Locally ))
       
   313 // </qmail>
       
   314         {
   312         {
   315         aEmlEntry.SetUnread( !unread );
   313         aEmlEntry.SetUnread( !unread );
   316         modified = ETrue;
   314         modified = ETrue;
   317         }
   315         }
   318 
   316 
   347     // this flag here (but when attachments are added)
   345     // this flag here (but when attachments are added)
   348 
   346 
   349     // EFSMsgFlag_Multiple: no counterpart in Symbian message
   347     // EFSMsgFlag_Multiple: no counterpart in Symbian message
   350 
   348 
   351     // EFSMsgFlag_CalendarMsg
   349     // EFSMsgFlag_CalendarMsg
   352     if( ( aEmlEntry.iMtm == KSenduiMtmSmtpUid ) && ( msgFlags & EFSMsgFlag_CalendarMsg ) )
   350     if( ( aEmlEntry.iMtm == KUidMsgTypeSMTP ) && ( msgFlags & EFSMsgFlag_CalendarMsg ) )
   353         {
   351         {
   354         if( !aEmlEntry.ICalendar() )
   352         if( !aEmlEntry.ICalendar() )
   355             {
   353             {
   356             aEmlEntry.SetICalendar( ETrue );
   354             aEmlEntry.SetICalendar( ETrue );
   357             modified = ETrue;
   355             modified = ETrue;
   373     //this applies to POP too. Just ignore the misleading naming
   371     //this applies to POP too. Just ignore the misleading naming
   374     // moved to fix EANA-7HUD2G, pop doesn't support permanent flags
   372     // moved to fix EANA-7HUD2G, pop doesn't support permanent flags
   375     // EFSMsgFlag_Answered
   373     // EFSMsgFlag_Answered
   376 
   374 
   377     // IMAP flags
   375     // IMAP flags
   378     if ( aEmlEntry.iMtm == KSenduiMtmImap4Uid )
   376     if ( aEmlEntry.iMtm == KUidMsgTypeIMAP4 )
   379         {
   377         {
   380             // EFSMsgFlag_FollowUp
   378             // EFSMsgFlag_FollowUp
   381         if ( LogicalXor( aEmlEntry.FlaggedIMAP4Flag(),
   379         if ( LogicalXor( aEmlEntry.FlaggedIMAP4Flag(),
   382                          ( msgFlags & EFSMsgFlag_FollowUp ) ) )
   380                          ( msgFlags & EFSMsgFlag_FollowUp ) ) )
   383             {
   381             {
   544 
   542 
   545         for( TInt i=0; i<toRecs.Count(); i++ )
   543         for( TInt i=0; i<toRecs.Count(); i++ )
   546             {
   544             {
   547             addr = CFSMailAddress::NewLC();
   545             addr = CFSMailAddress::NewLC();
   548             ConvertAddressL( toRecs[i], *addr );
   546             ConvertAddressL( toRecs[i], *addr );
       
   547             CleanupStack::Pop( addr );
   549             aMsg.AppendToRecipient( addr );
   548             aMsg.AppendToRecipient( addr );
   550             CleanupStack::Pop( addr );
       
   551             }
   549             }
   552 
   550 
   553         const CDesCArray& ccRecs = header->CcRecipients();
   551         const CDesCArray& ccRecs = header->CcRecipients();
   554 
   552 
   555         for( TInt i=0; i<ccRecs.Count(); i++ )
   553         for( TInt i=0; i<ccRecs.Count(); i++ )
   556             {
   554             {
   557             addr = CFSMailAddress::NewLC();
   555             addr = CFSMailAddress::NewLC();
   558             ConvertAddressL( ccRecs[i], *addr );
   556             ConvertAddressL( ccRecs[i], *addr );
       
   557             CleanupStack::Pop( addr );
   559             aMsg.AppendCCRecipient( addr );
   558             aMsg.AppendCCRecipient( addr );
   560             CleanupStack::Pop( addr );
       
   561             }
   559             }
   562 
   560 
   563         const CDesCArray& bccRecs = header->BccRecipients();
   561         const CDesCArray& bccRecs = header->BccRecipients();
   564 
   562 
   565         for( TInt i=0; i< bccRecs.Count(); i++ )
   563         for( TInt i=0; i< bccRecs.Count(); i++ )
   566             {
   564             {
   567             addr = CFSMailAddress::NewLC();
   565             addr = CFSMailAddress::NewLC();
   568             ConvertAddressL( bccRecs[i], *addr );
   566             ConvertAddressL( bccRecs[i], *addr );
       
   567             CleanupStack::Pop( addr );
   569             aMsg.AppendBCCRecipient( addr );
   568             aMsg.AppendBCCRecipient( addr );
   570             CleanupStack::Pop( addr );
       
   571             }
   569             }
   572 
   570 
   573         CleanupStack::PopAndDestroy( header );
   571         CleanupStack::PopAndDestroy( header );
   574         }
   572         }
   575     else
   573     else
   672     // EFSMsgFlag_FollowUp: supported only with IMAP4 messages (see below)
   670     // EFSMsgFlag_FollowUp: supported only with IMAP4 messages (see below)
   673     aMsg.ResetFlag( EFSMsgFlag_FollowUp );
   671     aMsg.ResetFlag( EFSMsgFlag_FollowUp );
   674 
   672 
   675 // <cmail>
   673 // <cmail>
   676     //only for incomplete POP3 messages
   674     //only for incomplete POP3 messages
   677     if ( aEntry.iMtm.iUid == KSenduiMtmPop3UidValue &&
   675     if ( aEntry.iMtm == KUidMsgTypePOP3 &&
   678             ( !aEntry.Complete() || aEntry.PartialDownloaded () ) )
   676             ( !aEntry.Complete() || aEntry.PartialDownloaded () ) )
   679         {
   677         {
   680         TRAP_IGNORE( AttaCheckForIncompleteMsgL( aEntry, aMsg ) );
   678         TRAP_IGNORE( AttaCheckForIncompleteMsgL( aEntry, aMsg ) );
   681         }
   679         }
   682 // </cmail>
   680 // </cmail>
   757     // EFSMsgFlag_HasMsgSender: currently not used anywhere. Could be
   755     // EFSMsgFlag_HasMsgSender: currently not used anywhere. Could be
   758     // probably be supported by checking the contents of TmsvEntry::iDetails
   756     // probably be supported by checking the contents of TmsvEntry::iDetails
   759     // but this should be tested
   757     // but this should be tested
   760 
   758 
   761     // Additional logic for IMAP4 messages
   759     // Additional logic for IMAP4 messages
   762     if ( aEntry.iMtm == KSenduiMtmImap4Uid )
   760     if ( aEntry.iMtm == KUidMsgTypeIMAP4 )
   763         {
   761         {
   764         if ( aEntry.FlaggedIMAP4Flag() )
   762         if ( aEntry.FlaggedIMAP4Flag() )
   765             {
   763             {
   766             aMsg.SetFlag( EFSMsgFlag_FollowUp );
   764             aMsg.SetFlag( EFSMsgFlag_FollowUp );
   767             }
   765             }
   780     TMsvId aMsgMainId,
   778     TMsvId aMsgMainId,
   781     TBool aIsAtta,
   779     TBool aIsAtta,
   782     CFSMailMessagePart& aMessage )
   780     CFSMailMessagePart& aMessage )
   783     {
   781     {
   784     FUNC_LOG;
   782     FUNC_LOG;
   785     if ( aEntry.iMtm.iUid == KSenduiMtmPop3UidValue && 
   783     if ( aEntry.iMtm == KUidMsgTypePOP3 && 
   786             aEntry.Id() != aMsgMainId &&
   784             aEntry.Id() != aMsgMainId &&
   787             !aIsAtta )
   785             !aIsAtta )
   788         {
   786         {
   789         TInt error = KErrNone;
   787         TInt error = KErrNone;
   790         TMsvEmailEntry emlEntry;
   788         TMsvEmailEntry emlEntry;
  1220                     result->SetFetchedContentSize( contentSize - 1 );
  1218                     result->SetFetchedContentSize( contentSize - 1 );
  1221                     }
  1219                     }
  1222 
  1220 
  1223                 CleanupStack::PopAndDestroy( cEntry );
  1221                 CleanupStack::PopAndDestroy( cEntry );
  1224                 }
  1222                 }
  1225             else if ( aEntry.iMtm == KSenduiMtmPop3Uid &&
  1223             else if ( aEntry.iMtm == KUidMsgTypePOP3 &&
  1226                     iSession.GetEntry( aEntry.Parent(), dummy, parent )
  1224                     iSession.GetEntry( aEntry.Parent(), dummy, parent )
  1227                     == KErrNone && parent.PartialDownloaded() )
  1225                     == KErrNone && parent.PartialDownloaded() )
  1228                 {
  1226                 {
  1229                 // we cant know remote size of pop body part, but
  1227                 // we cant know remote size of pop body part, but
  1230                 // we know it is not completely fetched at this point
  1228                 // we know it is not completely fetched at this point