email/imap4mtm/imapservermtm/src/cimap4servermtm.cpp
changeset 72 6f657153cbc5
parent 0 72b543305e3a
child 57 ebe688cedc25
child 76 60a8a215b0ec
equal deleted inserted replaced
70:a15d9966050f 72:6f657153cbc5
   499 		Queue(aStatus);
   499 		Queue(aStatus);
   500 		User::RequestComplete(iRequest, KErrNone);
   500 		User::RequestComplete(iRequest, KErrNone);
   501 		}
   501 		}
   502 	CleanupStack::PopAndDestroy(2);
   502 	CleanupStack::PopAndDestroy(2);
   503 	}
   503 	}
       
   504 
       
   505 
       
   506 /**
       
   507 ChangeEntriesL update the message read/Unread status in  Local and remote, 
       
   508 using the IMAP COPY command.
       
   509 
       
   510 @param aSelection The selection of message TMsvIds that are changed.
       
   511 @param aMark The selection marked as read  or unread.If 1 is Unread 0 for read.
       
   512 @param aStatus The request status to be completed when the operation has finished.
       
   513 */
       
   514 
       
   515 TInt CImap4ServerMtm::ChangeEntriesL( const CMsvEntrySelection& aSelection, TInt aMark, TRequestStatus& aStatus ) 
       
   516     {
       
   517     __LOG_TEXT(KDefaultLog, "CImap4ServerMtm::ChangeEntriesL()");
       
   518    
       
   519     TMsvEntry* aNewEntry1 = new (ELeave) TMsvEntry;
       
   520     CleanupStack::PushL(aNewEntry1);
       
   521     
       
   522     TBool flagChanged;
       
   523     
       
   524     if(aMark ==  0) 
       
   525         flagChanged = EFalse; //Selection to update as Read.
       
   526     else
       
   527         flagChanged = ETrue; ////Selection to update as UnRead.
       
   528     
       
   529     TInt count  = aSelection.Count();
       
   530     while(count--)
       
   531         { 
       
   532         iServerEntry->GetEntryFromId(aSelection[count],aNewEntry1);
       
   533         TMsvEmailEntry entry(*aNewEntry1);
       
   534         if(flagChanged)
       
   535              {
       
   536             entry.SetSeenIMAP4Flag(EFalse);
       
   537              }
       
   538          else
       
   539              {
       
   540              entry.SetSeenIMAP4Flag(ETrue);  
       
   541              }
       
   542         //Local Updation.
       
   543         User::LeaveIfError(iServerEntry->SetEntry(entry.Id()));
       
   544         User::LeaveIfError(iServerEntry->ChangeEntry(entry));
       
   545         }
       
   546      //if not offline
       
   547      if (iImapProtocolController->Connected())
       
   548         {
       
   549         //to update read/unread flags at remote server
       
   550         iImapProtocolController->UpdateEntriesFlagL(iStatus,aSelection,flagChanged);    
       
   551         iState= EMtmStateUpdateFlag;
       
   552         Queue(aStatus);
       
   553         SetActive(); 
       
   554         }
       
   555     else
       
   556         {
       
   557         Queue(aStatus);
       
   558         User::RequestComplete(iRequest, KErrNone);
       
   559         }
       
   560     CleanupStack::PopAndDestroy(1); //aNewEntry1
       
   561 	return KErrNone;
       
   562     }
   504 
   563 
   505 
   564 
   506 /**
   565 /**
   507 Performs the IMAP specific MTM commands.
   566 Performs the IMAP specific MTM commands.
   508 
   567