ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp
changeset 23 2dc6caa42ec3
parent 18 578830873419
child 30 759dc5235cdb
equal deleted inserted replaced
20:ecc8def7944a 23:2dc6caa42ec3
    23 _LIT( KMimeTypeTextPlain, "text/plain" );
    23 _LIT( KMimeTypeTextPlain, "text/plain" );
    24 _LIT( KMimeTypeTextHtml, "text/html" );
    24 _LIT( KMimeTypeTextHtml, "text/html" );
    25 _LIT( KMimeTypeTextRtf, "text/rtf" );
    25 _LIT( KMimeTypeTextRtf, "text/rtf" );
    26 _LIT( KSlash, "/" );
    26 _LIT( KSlash, "/" );
    27 
    27 
    28 // <cmail>
       
    29 _LIT( KCharSemicolon, ";" );
    28 _LIT( KCharSemicolon, ";" );
    30 _LIT( KCharEquals, "=" );
    29 _LIT( KCharEquals, "=" );
    31 _LIT( KCharsetTag, "CHARSET" );
    30 _LIT( KCharsetTag, "CHARSET" );
    32 // </cmail>
    31 _LIT( KMessageExtension, ".eml" );
    33 
    32 
    34 // Supported multipart content types
    33 // Supported multipart content types
    35 _LIT( KMimeTypeMultipartRelated, "multipart/related" );
    34 _LIT( KMimeTypeMultipartRelated, "multipart/related" );
    36 _LIT( KMimeTypeMultipartMixed, "multipart/mixed" );
    35 _LIT( KMimeTypeMultipartMixed, "multipart/mixed" );
    37 _LIT( KMimeTypeMultipartAlternative, "multipart/alternative" );
    36 _LIT( KMimeTypeMultipartAlternative, "multipart/alternative" );
    43 _LIT( KMimeTypeMultipartParallel, "multipart/parallel" );
    42 _LIT( KMimeTypeMultipartParallel, "multipart/parallel" );
    44 
    43 
    45 const TInt KCharEscape       = 0x5C;
    44 const TInt KCharEscape       = 0x5C;
    46 const TInt KCharNonPrintable = 0x1F;
    45 const TInt KCharNonPrintable = 0x1F;
    47 const TInt KCharAt           = 0x40;
    46 const TInt KCharAt           = 0x40;
    48 // <cmail>
       
    49 const TInt KMaxContentTypeLength = 200;
    47 const TInt KMaxContentTypeLength = 200;
    50 // </cmail>
    48 const TInt KEmbeddedMsgExtensionLength  = 4;
    51 
    49 
    52 // ======== CONSTRUCTORS & DESTRUCTOR ========
    50 // ======== CONSTRUCTORS & DESTRUCTOR ========
    53 
    51 
    54 // ---------------------------------------------------------------------------
    52 // ---------------------------------------------------------------------------
    55 // CIpsPlgMsgMapper::NewL()
    53 // CIpsPlgMsgMapper::NewL()
   122     TFSMailMsgId msgId( iPlugin.PluginId(), aEntry.Entry().Id() );
   120     TFSMailMsgId msgId( iPlugin.PluginId(), aEntry.Entry().Id() );
   123     CFSMailMessage* fsMsg = CFSMailMessage::NewLC( msgId );
   121     CFSMailMessage* fsMsg = CFSMailMessage::NewLC( msgId );
   124 
   122 
   125     fsMsg->SetFolderId(
   123     fsMsg->SetFolderId(
   126         TFSMailMsgId( iPlugin.PluginId(), aEntry.Entry().Parent() ) );
   124         TFSMailMsgId( iPlugin.PluginId(), aEntry.Entry().Parent() ) );
   127 
   125     // ERLN-7YUEX3
       
   126     fsMsg->SetMailBoxId(TFSMailMsgId( iPlugin.PluginId(), aEntry.Entry().iServiceId ));
       
   127     // End ERLN-7YUEX3
       
   128     
   128     CMsvStore* store( NULL );
   129     CMsvStore* store( NULL );
   129 
   130 
   130     if ( aEntry.HasStoreL() )
   131     if ( aEntry.HasStoreL() )
   131         {
   132         {
   132         store = aEntry.ReadStoreL();
   133         store = aEntry.ReadStoreL();
   170     result->SetMailBoxId( aMailboxId );
   171     result->SetMailBoxId( aMailboxId );
   171     result->SetFolderId(
   172     result->SetFolderId(
   172         TFSMailMsgId( iPlugin.PluginId(), aEntry.Parent() ) );
   173         TFSMailMsgId( iPlugin.PluginId(), aEntry.Parent() ) );
   173 
   174 
   174     SetFlags( aEntry, *result );
   175     SetFlags( aEntry, *result );
   175     SetFetchState( aEntry, aEntry.Id(), EFalse ,*result );
   176     SetFetchStateL( aEntry, aEntry.Id(), EFalse, *result );
   176 
   177 
   177     switch( aDetails )
   178     switch( aDetails )
   178         {
   179         {
   179         case EFSMsgDataDate:
   180         case EFSMsgDataDate:
   180             SetDateL( aEntry, *result );
   181             SetDateL( aEntry, *result );
   188         case EFSMsgDataEnvelope:
   189         case EFSMsgDataEnvelope:
   189         case EFSMsgDataStructure:
   190         case EFSMsgDataStructure:
   190             {
   191             {
   191             CMsvStore* store( NULL );
   192             CMsvStore* store( NULL );
   192             CMsvEntry* cEntry = iSession.GetEntryL( aEntry.Id() );
   193             CMsvEntry* cEntry = iSession.GetEntryL( aEntry.Id() );
   193             CleanupStack::PushL( cEntry );
   194 
   194 
   195             if ( cEntry )
   195             if ( cEntry && cEntry->HasStoreL() )
   196             	{
   196                 {
   197                 CleanupStack::PushL( cEntry );
   197                 store = cEntry->ReadStoreL();
   198             	if ( cEntry->HasStoreL() )
   198                 CleanupStack::PushL( store );
   199 					{
   199                 }
   200 					store = cEntry->ReadStoreL();
   200 
   201 					CleanupStack::PushL( store );
   201             SetEnvelopeL( cEntry, store, *result );
   202 					}
   202 
   203 
   203             // Apparently, this should be done only with
   204 				SetEnvelopeL( cEntry, store, *result );
   204             // EFSMsgDataStructure, but EFSMsgDataEnvelope is currently
   205 	
   205             // used by assuming that it reads also the content-type of
   206 				// Apparently, this should be done only with
   206             // the message
   207 				// EFSMsgDataStructure, but EFSMsgDataEnvelope is currently
   207             SetStructureL( cEntry, *result );
   208 				// used by assuming that it reads also the content-type of
   208 
   209 				// the message
   209             if ( store )
   210 				SetStructureL( cEntry, *result );
   210                 {
   211 	
   211                 CleanupStack::PopAndDestroy( store );
   212 				if ( store )
   212                 }
   213 					{
   213             CleanupStack::PopAndDestroy( cEntry );
   214 					CleanupStack::PopAndDestroy( store );
       
   215 					}
       
   216 				CleanupStack::PopAndDestroy( cEntry );
       
   217             	}
   214             break;
   218             break;
   215             }
   219             }
   216         case EFSMsgDataIdOnly:
   220         case EFSMsgDataIdOnly:
   217         default:
   221         default:
   218             break;
   222             break;
   269                 result = ConvertFolderEntry2MessagePartL( tEntry,
   273                 result = ConvertFolderEntry2MessagePartL( tEntry,
   270                     aMailBoxId, aMessageId );
   274                     aMailBoxId, aMessageId );
   271                 break;
   275                 break;
   272                 }
   276                 }
   273             case KUidMsvAttachmentEntryValue:
   277             case KUidMsvAttachmentEntryValue:
       
   278             case KUidMsvMessageEntryValue:
   274                 {
   279                 {
   275                 result = ConvertAttachmentEntry2MessagePartL( tEntry,
   280                 result = ConvertAttachmentEntry2MessagePartL( tEntry,
   276                     aMailBoxId, aMessageId );
   281                     aMailBoxId, aMessageId );
   277                 break;
       
   278                 }
       
   279             case KUidMsvMessageEntryValue:
       
   280                 {
       
   281                 break;
   282                 break;
   282                 }
   283                 }
   283             case KUidMsvEmailTextEntryValue:
   284             case KUidMsvEmailTextEntryValue:
   284             case KUidMsvEmailHtmlEntryValue:
   285             case KUidMsvEmailHtmlEntryValue:
   285             case KUidMsvEmailExternalBodyEntryValue:
   286             case KUidMsvEmailExternalBodyEntryValue:
   303     {
   304     {
   304     FUNC_LOG;
   305     FUNC_LOG;
   305     TInt msgFlags = aMessage.GetFlags();
   306     TInt msgFlags = aMessage.GetFlags();
   306     TBool modified ( EFalse );
   307     TBool modified ( EFalse );
   307     TBool unread( aEmlEntry.Unread() );
   308     TBool unread( aEmlEntry.Unread() );
   308     
   309 
       
   310 // <qmail>
   309     if ( !LogicalXor( unread, msgFlags & EFSMsgFlag_Read ) ||
   311     if ( !LogicalXor( unread, msgFlags & EFSMsgFlag_Read ) ||
   310          !LogicalXor( unread, msgFlags & EFSMsgFlag_Read_Locally ))
   312          !LogicalXor( unread, msgFlags & EFSMsgFlag_Read_Locally ))
       
   313 // </qmail>
   311         {
   314         {
   312         aEmlEntry.SetUnread( !unread );
   315         aEmlEntry.SetUnread( !unread );
   313         modified = ETrue;
   316         modified = ETrue;
   314         }
   317         }
   315 
   318 
   406     TMsvEmailEntry tEntry( cEntry->Entry() );
   409     TMsvEmailEntry tEntry( cEntry->Entry() );
   407     TBool isModified = ChangeTEntryFlagsL( tEntry, aMessage );
   410     TBool isModified = ChangeTEntryFlagsL( tEntry, aMessage );
   408 
   411 
   409     if ( isModified )
   412     if ( isModified )
   410         {
   413         {
       
   414 // <qmail> Function called sync in Qmail
   411         cEntry->ChangeL( tEntry );
   415         cEntry->ChangeL( tEntry );
       
   416 // </qmail>
   412         }
   417         }
   413 
   418 
   414     CleanupStack::PopAndDestroy( cEntry );
   419     CleanupStack::PopAndDestroy( cEntry );
   415     }
   420     }
   416 
   421 
   622     const TMsvEmailEntry& aEntry,
   627     const TMsvEmailEntry& aEntry,
   623     CFSMailMessage& aMsg )
   628     CFSMailMessage& aMsg )
   624     {
   629     {
   625     FUNC_LOG;
   630     FUNC_LOG;
   626 
   631 
       
   632     TBool forwardedMeetingRequest = EFalse;
       
   633     
   627     // EFSMsgFlag_Read
   634     // EFSMsgFlag_Read
   628     // EFSMsgFlag_Read_Locally
   635     // EFSMsgFlag_Read_Locally
   629     if ( aEntry.Unread() )
   636     if ( aEntry.Unread() )
   630         {
   637         {
   631             aMsg.ResetFlag( EFSMsgFlag_Read );
   638             aMsg.ResetFlag( EFSMsgFlag_Read );
   684             if ( aEntry.ICalendar() )
   691             if ( aEntry.ICalendar() )
   685                 {
   692                 {
   686                 // <cmail> implementation changed due to cs warning
   693                 // <cmail> implementation changed due to cs warning
   687                 TInt attCount = 0;
   694                 TInt attCount = 0;
   688                 TRAPD ( err, attCount = GetAttachmentCountL( aEntry ) );
   695                 TRAPD ( err, attCount = GetAttachmentCountL( aEntry ) );
   689                 if ( err == KErrNone && attCount < 2 )
   696                 if ( err == KErrNone && attCount == 1 )
   690                 	{
   697                 	{
   691                     // Only text/calendar part included as attachment
   698                 	CMsvEntry* cEntry = NULL;
   692                     aMsg.ResetFlag( EFSMsgFlag_Attachments );
   699                 	TRAPD ( err2, cEntry = iSession.GetEntryL( aEntry.Id() ) );
   693                     //Set Attachment flag for CMsvEntry (needed for sorting)
   700                 	if ( err2 == KErrNone && cEntry->Count() == 1 )
   694                     TRAP_IGNORE( SetAttachmentFlagL( aEntry, EFalse ) );
   701                 		{
       
   702                 		TMsvEmailEntry tEntry = (*cEntry)[0];
       
   703                 		TImEmailFolderType ft = tEntry.MessageFolderType();
       
   704                 		if ( tEntry.iType == KUidMsvFolderEntry && ft == EFolderTypeMixed  )
       
   705                 			{
       
   706                            	// Message with calendar object. But based on content type
       
   707                 			// (multipart/mixed) we know that this is meeting request
       
   708                 			// forwarded as email, so it must be seen as normal email.
       
   709                    			forwardedMeetingRequest = ETrue;
       
   710                    			aMsg.ResetFlag( EFSMsgFlag_CalendarMsg );
       
   711                    			aMsg.SetFlag( EFSMsgFlag_Attachments );
       
   712                         	}
       
   713 						else
       
   714 							{
       
   715 							// Only text/calendar part included as attachment
       
   716 							aMsg.ResetFlag( EFSMsgFlag_Attachments );
       
   717 							//Set Attachment flag for CMsvEntry (needed for sorting)
       
   718 							TRAP_IGNORE( SetAttachmentFlagL( aEntry, EFalse ) );
       
   719 							}
       
   720                 		}
       
   721                 	delete cEntry;
       
   722                 	cEntry = NULL;
   695                 	}
   723                 	}
   696                 // </cmail>
   724                 // </cmail>
   697                 }
   725                 }
   698             }
   726             }
   699         else
   727         else
   706     // to evaluate the value, the CMsvStore of the message should be
   734     // to evaluate the value, the CMsvStore of the message should be
   707     // accessed which is relatively slow (compared to the access of
   735     // accessed which is relatively slow (compared to the access of
   708     // the index entry)
   736     // the index entry)
   709 
   737 
   710     // EFSMsgFlag_CalendarMsg
   738     // EFSMsgFlag_CalendarMsg
   711     if ( aEntry.ICalendar() )
   739     if ( aEntry.ICalendar() && !forwardedMeetingRequest ) // <cmail>
   712         {
   740         {
   713         aMsg.SetFlag( EFSMsgFlag_CalendarMsg );
   741         aMsg.SetFlag( EFSMsgFlag_CalendarMsg );
   714         }
   742         }
   715     else if( !( aMsg.GetFlags() & EFSMsgFlag_CalendarMsg ) )
   743     else if( !( aMsg.GetFlags() & EFSMsgFlag_CalendarMsg ) )
   716         {
   744         {
   747         }
   775         }
   748     }
   776     }
   749 
   777 
   750 // ---------------------------------------------------------------------------
   778 // ---------------------------------------------------------------------------
   751 // ---------------------------------------------------------------------------
   779 // ---------------------------------------------------------------------------
   752 void CIpsPlgMsgMapper::SetFetchState(
   780 void CIpsPlgMsgMapper::SetFetchStateL(
   753     const TMsvEmailEntry& aEntry,
   781     const TMsvEmailEntry& aEntry,
   754     TMsvId aMsgMainId,
   782     TMsvId aMsgMainId,
   755     TBool aIsAtta,
   783     TBool aIsAtta,
   756     CFSMailMessagePart& aMessage )
   784     CFSMailMessagePart& aMessage )
   757     {
   785     {
   758     FUNC_LOG;
   786     FUNC_LOG;
   759     if ( aEntry.iMtm.iUid == KSenduiMtmPop3UidValue
   787     if ( aEntry.iMtm.iUid == KSenduiMtmPop3UidValue && 
   760             && aEntry.Id() != aMsgMainId )
   788             aEntry.Id() != aMsgMainId &&
       
   789             !aIsAtta )
   761         {
   790         {
   762         TInt error = KErrNone;
   791         TInt error = KErrNone;
   763         TMsvEmailEntry emlEntry;
   792         TMsvEmailEntry emlEntry;
   764         TMsvId dummy;
   793         TMsvId dummy;
   765 
   794 
   766         error = iSession.GetEntry( aMsgMainId , dummy, emlEntry );
   795         error = iSession.GetEntry( aMsgMainId , dummy, emlEntry );
   767 
   796 
   768         if ( error == KErrNone )
   797         if ( error == KErrNone )
   769             {
   798             {
   770             SetFetchStateImap( emlEntry, aMsgMainId, aIsAtta ,aMessage );
   799             DoSetFetchStateL( emlEntry, aMsgMainId, aIsAtta, aMessage );
   771             }
   800             }
   772         else
   801         else
   773             {
   802             {
   774             aMessage.SetMessagePartsStatus( EFSEmailStructureUnknown );
   803             aMessage.SetMessagePartsStatus( EFSEmailStructureUnknown );
   775             }
   804             }
   776         }
   805         }
   777     else
   806     else
   778         {
   807         {
   779         SetFetchStateImap( aEntry, aMsgMainId, aIsAtta, aMessage );
   808         DoSetFetchStateL( aEntry, aMsgMainId, aIsAtta, aMessage );
   780         }
   809         }
   781     }
   810     }
   782 
   811 
   783 // ---------------------------------------------------------------------------
   812 // ---------------------------------------------------------------------------
   784 // ---------------------------------------------------------------------------
   813 // ---------------------------------------------------------------------------
   785 void CIpsPlgMsgMapper::SetFetchStateImap(
   814 void CIpsPlgMsgMapper::DoSetFetchStateL(
   786     const TMsvEmailEntry& aEntry,
   815     const TMsvEmailEntry& aEntry,
   787     TMsvId aMsgMainId,
   816     TMsvId aMsgMainId,
   788     TBool aIsAtta,
   817     TBool aIsAtta,
   789     CFSMailMessagePart& aMessage )
   818     CFSMailMessagePart& aMessage )
   790     {
   819     {
   791     FUNC_LOG;
   820     FUNC_LOG;
   792     if ( aEntry.PartialDownloaded() )
   821     if ( aEntry.PartialDownloaded() )
   793         {
   822         {
   794         aMessage.SetMessagePartsStatus( EFSPartial );
   823         aMessage.SetMessagePartsStatus( EFSPartial );
   795         }
   824         }
   796     else if ( aEntry.Complete() || (aEntry.BodyTextComplete() && !aIsAtta) )
   825     else if ( aEntry.BodyTextComplete() && !aIsAtta )
   797         {
   826         {
   798         aMessage.SetMessagePartsStatus( EFSFull );
   827         aMessage.SetMessagePartsStatus( EFSFull );
       
   828         }
       
   829     else if ( aEntry.Complete() && !aIsAtta )
       
   830         {
       
   831         aMessage.SetMessagePartsStatus( EFSFull );
       
   832         }
       
   833     else if ( aEntry.Complete() && aIsAtta )
       
   834         {
       
   835         CMsvEntry* cEntry = iSession.GetEntryL( aEntry.Id() );
       
   836 
       
   837         CleanupStack::PushL( cEntry );
       
   838 
       
   839         TBool hasStore = cEntry->HasStoreL();
       
   840 
       
   841         if ( hasStore )
       
   842             {
       
   843             CMsvStore* store = cEntry->EditStoreL();
       
   844     
       
   845             CleanupStack::PushL( store );
       
   846 
       
   847             MMsvAttachmentManager& attMgr = store->AttachmentManagerL();
       
   848         
       
   849             if ( attMgr.AttachmentCount() )
       
   850                 {
       
   851                 aMessage.SetMessagePartsStatus( EFSFull );
       
   852                 }
       
   853             else
       
   854                 {
       
   855                 aMessage.SetMessagePartsStatus( EFSNone );
       
   856                 }
       
   857             
       
   858             CleanupStack::PopAndDestroy( store );
       
   859             }
       
   860 
       
   861         CleanupStack::PopAndDestroy( cEntry );
   799         }
   862         }
   800     else if ( aEntry.Id() != aMsgMainId )
   863     else if ( aEntry.Id() != aMsgMainId )
   801         {
   864         {
   802         // fetch state of some message part, then we sure know
   865         // fetch state of some message part, then we sure know
   803         // structure, but its not complete nor partial so state must be
   866         // structure, but its not complete nor partial so state must be
  1187             result->SetFetchedContentSize( 0 );
  1250             result->SetFetchedContentSize( 0 );
  1188             }
  1251             }
  1189 
  1252 
  1190         CleanupStack::Pop( result );
  1253         CleanupStack::Pop( result );
  1191         }
  1254         }
  1192     SetFetchState( aEntry, aMessageId.Id(), EFalse, *result );
  1255     if(result) // coverity error fix: result might be null
  1193 // <cmail>
  1256         {
       
  1257         SetFetchStateL( aEntry, aMessageId.Id(), EFalse, *result );
       
  1258         }
       
  1259 
  1194     CleanupStack::PopAndDestroy( buf );
  1260     CleanupStack::PopAndDestroy( buf );
  1195 // </cmail>
       
  1196     return result;
  1261     return result;
  1197     }
  1262     }
  1198 
  1263 
  1199 // ---------------------------------------------------------------------------
  1264 // ---------------------------------------------------------------------------
  1200 // ---------------------------------------------------------------------------
  1265 // ---------------------------------------------------------------------------
  1206     FUNC_LOG;
  1271     FUNC_LOG;
  1207     CFSMailMessagePart* result( NULL );
  1272     CFSMailMessagePart* result( NULL );
  1208     HBufC* buffer;
  1273     HBufC* buffer;
  1209     CMsvEntry* cEntry;
  1274     CMsvEntry* cEntry;
  1210 
  1275 
  1211     __ASSERT_DEBUG( ( aEntry.iType == KUidMsvAttachmentEntry ),
  1276     __ASSERT_DEBUG( ( aEntry.iType == KUidMsvAttachmentEntry || 
       
  1277     	aEntry.iType == KUidMsvMessageEntry ),
  1212         User::Panic( KIpsPlgPanicCategory, EIpsPlgInvalidEntry ) );
  1278         User::Panic( KIpsPlgPanicCategory, EIpsPlgInvalidEntry ) );
  1213 
  1279 
  1214     cEntry = iSession.GetEntryL( aEntry.Id() );
  1280     cEntry = iSession.GetEntryL( aEntry.Id() );
  1215     CleanupStack::PushL( cEntry );
  1281     CleanupStack::PushL( cEntry );
  1216 
  1282 
  1226             {
  1292             {
  1227             CImMimeHeader* mimeHeader = CImMimeHeader::NewLC();
  1293             CImMimeHeader* mimeHeader = CImMimeHeader::NewLC();
  1228             mimeHeader->RestoreL( *store );
  1294             mimeHeader->RestoreL( *store );
  1229 
  1295 
  1230             // Content-type
  1296             // Content-type
  1231             SetContentTypeL( *mimeHeader, *result );
  1297             if ( aEntry.iType.iUid == KUidMsvMessageEntryValue )
       
  1298                 {
       
  1299                 result->SetContentType( KMimeTypeMultipartRfc822 );
       
  1300                 }
       
  1301             else
       
  1302                 {
       
  1303                 SetContentTypeL( *mimeHeader, *result );
       
  1304                 }
  1232 
  1305 
  1233             // Content-description
  1306             // Content-description
  1234             buffer = HBufC::NewLC(
  1307             buffer = HBufC::NewLC(
  1235                 mimeHeader->ContentDescription().Length ( ) );
  1308                 mimeHeader->ContentDescription().Length ( ) );
  1236             buffer->Des().Copy ( mimeHeader->ContentDescription ( ) );
  1309             buffer->Des().Copy ( mimeHeader->ContentDescription ( ) );
  1271             // Content-class: not supported by Symbian (non-standard field)
  1344             // Content-class: not supported by Symbian (non-standard field)
  1272 
  1345 
  1273             CleanupStack::PopAndDestroy( mimeHeader );
  1346             CleanupStack::PopAndDestroy( mimeHeader );
  1274             }
  1347             }
  1275         // Name
  1348         // Name
  1276         result->SetAttachmentNameL( aEntry.iDetails );
  1349         if ( aEntry.iType.iUid == KUidMsvMessageEntryValue )
       
  1350             {
       
  1351             HBufC* att = HBufC::NewLC( aEntry.iDescription.Length() + KEmbeddedMsgExtensionLength );
       
  1352             att->Des().Copy( aEntry.iDescription );
       
  1353             att->Des().Append( KMessageExtension );
       
  1354             result->SetAttachmentNameL( att->Des() );
       
  1355             CleanupStack::PopAndDestroy( att );
       
  1356             }
       
  1357         else
       
  1358             {
       
  1359             result->SetAttachmentNameL( aEntry.iDetails );
       
  1360             }
  1277 
  1361 
  1278         // Size
  1362         // Size
  1279         result->SetContentSize( aEntry.iSize );
  1363         result->SetContentSize( aEntry.iSize );
  1280 
  1364 
  1281         if ( aEntry.Complete() )
  1365         if ( aEntry.Complete() )
  1286             {
  1370             {
  1287             result->SetFetchedContentSize( 0 );
  1371             result->SetFetchedContentSize( 0 );
  1288             }
  1372             }
  1289         result->SetMailBoxId( aMailBoxId );
  1373         result->SetMailBoxId( aMailBoxId );
  1290         CleanupStack::PopAndDestroy(store);
  1374         CleanupStack::PopAndDestroy(store);
       
  1375         
       
  1376         SetFetchStateL( aEntry, aMessageId.Id(), ETrue, *result );
  1291         CleanupStack::Pop( result );
  1377         CleanupStack::Pop( result );
  1292         }
  1378         }
  1293     SetFetchState( aEntry, aMessageId.Id(), ETrue ,*result );
       
  1294     CleanupStack::PopAndDestroy( cEntry );
  1379     CleanupStack::PopAndDestroy( cEntry );
  1295 
  1380 
  1296     return result;
  1381     return result;
  1297     }
  1382     }
  1298 
  1383 
  1432 	CMsvEntry* cEntry = iSession.GetEntryL( aEntry.Id() );
  1517 	CMsvEntry* cEntry = iSession.GetEntryL( aEntry.Id() );
  1433 	CleanupStack::PushL( cEntry );
  1518 	CleanupStack::PushL( cEntry );
  1434 	// Only text/calendar part included as attachment
  1519 	// Only text/calendar part included as attachment
  1435 	TMsvEmailEntry entryToBeChanged( aEntry );
  1520 	TMsvEmailEntry entryToBeChanged( aEntry );
  1436 	entryToBeChanged.SetAttachment( aHasAttachment );
  1521 	entryToBeChanged.SetAttachment( aHasAttachment );
       
  1522 
       
  1523 // <qmail> Function called sync in Qmail
  1437 	cEntry->ChangeL( entryToBeChanged );
  1524 	cEntry->ChangeL( entryToBeChanged );
  1438 	
       
  1439 	CleanupStack::PopAndDestroy( cEntry );
  1525 	CleanupStack::PopAndDestroy( cEntry );
       
  1526 // </qmail>
  1440 	}
  1527 	}
  1441 // </cmail>
  1528 // </cmail>
  1442 
  1529 
  1443 // <cmail>
  1530 // <cmail>
  1444 // ---------------------------------------------------------------------------
  1531 // ---------------------------------------------------------------------------