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