# HG changeset patch # User hgs # Date 1284485096 -19800 # Node ID d8ac8e5e472118458cd6aee6871ca5d8369454a9 # Parent eceabb8c7a12b08f3cb7b20069f0015b8c26eb08 201037_03 diff -r eceabb8c7a12 -r d8ac8e5e4721 email/imap4mtm/imapprotocolcontroller/bwins/impapprotocolcontrollerU.DEF --- a/email/imap4mtm/imapprotocolcontroller/bwins/impapprotocolcontrollerU.DEF Tue Sep 14 12:19:12 2010 +0530 +++ b/email/imap4mtm/imapprotocolcontroller/bwins/impapprotocolcontrollerU.DEF Tue Sep 14 22:54:56 2010 +0530 @@ -32,4 +32,5 @@ ?WaitForBackground@CImapProtocolController@@QAEXAAVTRequestStatus@@@Z @ 31 NONAME ; void CImapProtocolController::WaitForBackground(class TRequestStatus &) ?GetAccessPointIdForConnection@CImapProtocolController@@QBEHAAK@Z @ 32 NONAME ; int CImapProtocolController::GetAccessPointIdForConnection(unsigned long &) const ?UpdateFlagL@CImapProtocolController@@QAEXAAVTRequestStatus@@@Z @ 33 NONAME ; void CImapProtocolController::UpdateFlagL(class TRequestStatus &) + ?UpdateEntriesFlagL@CImapProtocolController@@QAEXAAVTRequestStatus@@ABVCMsvEntrySelection@@H@Z @ 34 NONAME ; void CImapProtocolController::UpdateEntriesFlagL(class TRequestStatus &, class CMsvEntrySelection const &, int) diff -r eceabb8c7a12 -r d8ac8e5e4721 email/imap4mtm/imapprotocolcontroller/eabi/impapprotocolcontrollerU.DEF --- a/email/imap4mtm/imapprotocolcontroller/eabi/impapprotocolcontrollerU.DEF Tue Sep 14 12:19:12 2010 +0530 +++ b/email/imap4mtm/imapprotocolcontroller/eabi/impapprotocolcontrollerU.DEF Tue Sep 14 22:54:56 2010 +0530 @@ -77,4 +77,5 @@ _ZTVN4Meta13TMetaVarLen16I6RBuf16EE @ 76 NONAME ABSENT _ZNK23CImapProtocolController29GetAccessPointIdForConnectionERm @ 77 NONAME _ZN23CImapProtocolController11UpdateFlagLER14TRequestStatus @ 78 NONAME + _ZN23CImapProtocolController18UpdateEntriesFlagLER14TRequestStatusRK18CMsvEntrySelectioni @ 79 NONAME diff -r eceabb8c7a12 -r d8ac8e5e4721 email/imap4mtm/imapprotocolcontroller/inc/cimapprotocolcontroller.h --- a/email/imap4mtm/imapprotocolcontroller/inc/cimapprotocolcontroller.h Tue Sep 14 12:19:12 2010 +0530 +++ b/email/imap4mtm/imapprotocolcontroller/inc/cimapprotocolcontroller.h Tue Sep 14 22:54:56 2010 +0530 @@ -115,6 +115,7 @@ IMPORT_C TImap4CompoundProgress Progress(); IMPORT_C void CancelAndCleanup(); IMPORT_C void UpdateFlagL(TRequestStatus& aStatus); + IMPORT_C void UpdateEntriesFlagL(TRequestStatus& aStatus,const CMsvEntrySelection& aSourceSel, TBool aFlagChanged); // mobility API from MImMobileServer void PrepareForNewCarrier(TImMobilityAction aAction, TBool aIsSeamless); diff -r eceabb8c7a12 -r d8ac8e5e4721 email/imap4mtm/imapprotocolcontroller/inc/cimapupdateflagoperation.h --- a/email/imap4mtm/imapprotocolcontroller/inc/cimapupdateflagoperation.h Tue Sep 14 12:19:12 2010 +0530 +++ b/email/imap4mtm/imapprotocolcontroller/inc/cimapupdateflagoperation.h Tue Sep 14 22:54:56 2010 +0530 @@ -43,6 +43,12 @@ CMsvServerEntry& aServerEntry, CImapSettings& aImapSettings ); + static CImapUpdateFlagOperation* NewL(CImapSyncManager& aSyncManager, + CMsvServerEntry& aServerEntry, + CImapSettings& aImapSettings, + const CMsvEntrySelection& aSourceSel, + TBool aFlagChanged + ); virtual void StartOperation(TRequestStatus& aStatus, CImapSession& aSession); //////////// virtual void StartOperation(TRequestStatus& aStatus);// @@ -56,6 +62,7 @@ CImapSettings& aImapSettings ); void ConstructL(); + void ConstructL(const CMsvEntrySelection& aSourceSel,TBool aFlagChanged); TBool DoRunLoopL(); void DoCancel(); @@ -67,6 +74,13 @@ RArray iMessageUids; RArrayMessageFlagInfo iFlagInfoResponseArray; + + CMsvEntrySelection* iSourceSel; + TBool iMarkFlag; + TBool iEntrySelection; + TInt iProgressMsgsToDo; + TInt iProgressMsgsDone; + }; #endif // __CIMAPUPDATEFLAGOPERATION_H__ diff -r eceabb8c7a12 -r d8ac8e5e4721 email/imap4mtm/imapprotocolcontroller/src/cimapprotocolcontroller.cpp --- a/email/imap4mtm/imapprotocolcontroller/src/cimapprotocolcontroller.cpp Tue Sep 14 12:19:12 2010 +0530 +++ b/email/imap4mtm/imapprotocolcontroller/src/cimapprotocolcontroller.cpp Tue Sep 14 22:54:56 2010 +0530 @@ -3510,17 +3510,49 @@ __LOG_TEXT(KDefaultLog, "CImapProtocolController::UpdateFlagL()"); __ASSERT_DEBUG(iImapCompound==NULL, TImapServerPanic::ImapPanic(TImapServerPanic::ECreateCompoundIsNotNull)); ResetProgress(); - if (!CompleteIfBackgroundOpInProgress(aStatus)) - { - iImapCompound = CImapUpdateFlagOperation::NewL(*iImapSyncManager, - iEntry, - *iImapSettings - ); - iRequestedOp = EUpdateFlag; - StartPrimaryOperation(); - Queue(aStatus); - SetActive(); - } - } - + if (!CompleteIfBackgroundOpInProgress(aStatus)) + { + + iImapCompound = CImapUpdateFlagOperation::NewL(*iImapSyncManager, + iEntry, + *iImapSettings + ); + + iRequestedOp = EUpdateFlag; + StartPrimaryOperation(); + Queue(aStatus); + SetActive(); + } + + } + + + +/** +Updates the selection of messages read/unread status from the remote server. +@param aStatus +*/ +EXPORT_C void CImapProtocolController::UpdateEntriesFlagL( TRequestStatus& aStatus,const CMsvEntrySelection& aSourceSel ,TBool aFlagChanged) + + { + __LOG_TEXT(KDefaultLog, "CImapProtocolController::UpdateEntriesFlagL()"); + __ASSERT_DEBUG(iImapCompound==NULL, TImapServerPanic::ImapPanic(TImapServerPanic::ECreateCompoundIsNotNull)); + ResetProgress(); + + if (!CompleteIfBackgroundOpInProgress(aStatus)) + { + + iImapCompound = CImapUpdateFlagOperation::NewL(*iImapSyncManager, + iEntry, + *iImapSettings, + aSourceSel, + aFlagChanged); + iRequestedOp = EUpdateFlag; + StartPrimaryOperation(); + Queue(aStatus); + SetActive(); + } + + } + diff -r eceabb8c7a12 -r d8ac8e5e4721 email/imap4mtm/imapprotocolcontroller/src/cimapupdateflagoperation.cpp --- a/email/imap4mtm/imapprotocolcontroller/src/cimapupdateflagoperation.cpp Tue Sep 14 12:19:12 2010 +0530 +++ b/email/imap4mtm/imapprotocolcontroller/src/cimapupdateflagoperation.cpp Tue Sep 14 22:54:56 2010 +0530 @@ -39,8 +39,7 @@ CImapUpdateFlagOperation::~CImapUpdateFlagOperation() { - - + delete iSourceSel; iMessageUids.Reset(); iFlagInfoResponseArray.Reset(); } @@ -66,6 +65,40 @@ CActiveScheduler::Add(this); } +// NewL for Selection +CImapUpdateFlagOperation* CImapUpdateFlagOperation::NewL(CImapSyncManager& aSyncManager, + CMsvServerEntry& aServerEntry, + CImapSettings& aImapSettings, + const CMsvEntrySelection& aSourceSel , TBool aFlagChanged) + + { + + CImapUpdateFlagOperation* self = new (ELeave) CImapUpdateFlagOperation(aSyncManager, + aServerEntry, + aImapSettings); + CleanupStack::PushL(self); + self->ConstructL(aSourceSel,aFlagChanged); + CleanupStack::Pop(self); + return self; + } +//// ConstructL for Selection +void CImapUpdateFlagOperation::ConstructL(const CMsvEntrySelection& aSourceSel, TBool aFlagChanged) + { + + iSourceSel=new (ELeave) CMsvEntrySelection; + CheckSelectionL(aSourceSel, iSourceSel, ETrue, EFalse, EFalse, ETrue); + + // Initialise the progress counters + iProgressMsgsToDo=iSourceSel->Count(); + iProgressMsgsDone=0; + iMarkFlag = aFlagChanged; + iEntrySelection = ETrue; + // Add to the active scheduler + CActiveScheduler::Add(this); + } + + + void CImapUpdateFlagOperation::StartOperation(TRequestStatus& aStatus, CImapSession& aSession) //void CImapUpdateFlagOperation::StartOperation(TRequestStatus& aStatus) { @@ -87,39 +120,80 @@ SetCurrentStep(); switch (iCurrentStep) { + case EUpdateFlag: + { + HBufC8* uidSeq = NULL; + if(!iEntrySelection) //Entry iMarkFlag is Flase + { + TMsvEmailEntry entry = iServerEntry.Entry(); + TUint id = entry.UID(); + iMessageUids.AppendL(id); + if(entry.Unread()) + { + entry.SetSeenIMAP4Flag(EFalse); + } + else + { + entry.SetSeenIMAP4Flag(ETrue); + } + + + User::LeaveIfError(iServerEntry.ChangeEntry(entry)); + + uidSeq = CImapSession::CreateSequenceSetLC(iMessageUids); + + // finished with the UID array. Clear it. + iMessageUids.Reset(); + if(entry.SeenIMAP4Flag()) + { + // issue the store command + iSession->StoreL(iStatus, uidSeq->Des(), KImapAddFlags, KImapFlagSeen, ETrue, iFlagInfoResponseArray); + + } + else + { + // issue the store command + iSession->StoreL(iStatus, uidSeq->Des(), KStoreFlagsClearCommand, KImapFlagSeen, ETrue, iFlagInfoResponseArray); + } + } + else //Selection iMarkFlag is Trure + { + TMsvEntry *aNewEntry1; + + TInt count = iSourceSel->Count(); + while (count--) + { + iServerEntry.GetEntryFromId(iSourceSel->At(count), aNewEntry1); + TMsvEmailEntry entry(*aNewEntry1); + iMessageUids.AppendL(entry.UID()); + + if(iMarkFlag) // True means Unread + { + entry.SetSeenIMAP4Flag(EFalse); + } + else + { + entry.SetSeenIMAP4Flag(ETrue); + } + SetEntryL((*iSourceSel)[count]); + User::LeaveIfError(iServerEntry.ChangeEntry(entry)); + }// end of while + + uidSeq = CImapSession::CreateSequenceSetLC(iMessageUids); - case EUpdateFlag: - { - TMsvEmailEntry entry = iServerEntry.Entry(); - TUint id = entry.UID(); - iMessageUids.AppendL(id); - if(entry.Unread()) - { - entry.SetSeenIMAP4Flag(EFalse); - } - else - { - entry.SetSeenIMAP4Flag(ETrue); - } - - - User::LeaveIfError(iServerEntry.ChangeEntry(entry)); - - HBufC8* uidSeq = CImapSession::CreateSequenceSetLC(iMessageUids); - - // finished with the UID array. Clear it. - iMessageUids.Reset(); - if(entry.SeenIMAP4Flag()) - { - // issue the store command - iSession->StoreL(iStatus, uidSeq->Des(), KImapAddFlags, KImapFlagSeen, ETrue, iFlagInfoResponseArray); - - } - else - { - // issue the store command - iSession->StoreL(iStatus, uidSeq->Des(), KStoreFlagsClearCommand, KImapFlagSeen, ETrue, iFlagInfoResponseArray); - } + // finished with the UID array. Clear it. + iMessageUids.Reset(); + if(!iMarkFlag) //read + { + // issue the store command + iSession->StoreL(iStatus, uidSeq->Des(), KImapAddFlags, KImapFlagSeen, ETrue, iFlagInfoResponseArray); + } + else //Unread + { + // issue the store command + iSession->StoreL(iStatus, uidSeq->Des(), KStoreFlagsClearCommand, KImapFlagSeen, ETrue, iFlagInfoResponseArray); + } + } //End of else (Selection) iProgressState = TImap4GenericProgress::EBusy; CleanupStack::PopAndDestroy(uidSeq); diff -r eceabb8c7a12 -r d8ac8e5e4721 email/imap4mtm/imapservermtm/inc/cimap4servermtm.h --- a/email/imap4mtm/imapservermtm/inc/cimap4servermtm.h Tue Sep 14 12:19:12 2010 +0530 +++ b/email/imap4mtm/imapservermtm/inc/cimap4servermtm.h Tue Sep 14 22:54:56 2010 +0530 @@ -119,7 +119,7 @@ TRequestStatus& aStatus ); TBool CommandExpected(); const TDesC8& Progress(); - + TInt ChangeEntriesL(const CMsvEntrySelection& aSelection, TInt aMark, TRequestStatus& aStatus); protected: IMPORT_C TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1); diff -r eceabb8c7a12 -r d8ac8e5e4721 email/imap4mtm/imapservermtm/src/cimap4servermtm.cpp --- a/email/imap4mtm/imapservermtm/src/cimap4servermtm.cpp Tue Sep 14 12:19:12 2010 +0530 +++ b/email/imap4mtm/imapservermtm/src/cimap4servermtm.cpp Tue Sep 14 22:54:56 2010 +0530 @@ -504,6 +504,65 @@ /** +ChangeEntriesL update the message read/Unread status in Local and remote, +using the IMAP COPY command. + +@param aSelection The selection of message TMsvIds that are changed. +@param aMark The selection marked as read or unread.If 1 is Unread 0 for read. +@param aStatus The request status to be completed when the operation has finished. +*/ + +TInt CImap4ServerMtm::ChangeEntriesL( const CMsvEntrySelection& aSelection, TInt aMark, TRequestStatus& aStatus ) + { + __LOG_TEXT(KDefaultLog, "CImap4ServerMtm::ChangeEntriesL()"); + + TMsvEntry* aNewEntry1 = new (ELeave) TMsvEntry; + CleanupStack::PushL(aNewEntry1); + + TBool flagChanged; + + if(aMark == 0) + flagChanged = EFalse; //Selection to update as Read. + else + flagChanged = ETrue; ////Selection to update as UnRead. + + TInt count = aSelection.Count(); + while(count--) + { + iServerEntry->GetEntryFromId(aSelection[count],aNewEntry1); + TMsvEmailEntry entry(*aNewEntry1); + if(flagChanged) + { + entry.SetSeenIMAP4Flag(EFalse); + } + else + { + entry.SetSeenIMAP4Flag(ETrue); + } + //Local Updation. + User::LeaveIfError(iServerEntry->SetEntry(entry.Id())); + User::LeaveIfError(iServerEntry->ChangeEntry(entry)); + } + //if not offline + if (iImapProtocolController->Connected()) + { + //to update read/unread flags at remote server + iImapProtocolController->UpdateEntriesFlagL(iStatus,aSelection,flagChanged); + iState= EMtmStateUpdateFlag; + Queue(aStatus); + SetActive(); + } + else + { + Queue(aStatus); + User::RequestComplete(iRequest, KErrNone); + } + CleanupStack::PopAndDestroy(1); //aNewEntry1 + return KErrNone; + } + + +/** Performs the IMAP specific MTM commands. @param aSelection A selection of messages. The use is dependant upon diff -r eceabb8c7a12 -r d8ac8e5e4721 email/imap4mtm/imapsession/inc/cimapatomparser.h --- a/email/imap4mtm/imapsession/inc/cimapatomparser.h Tue Sep 14 12:19:12 2010 +0530 +++ b/email/imap4mtm/imapsession/inc/cimapatomparser.h Tue Sep 14 22:54:56 2010 +0530 @@ -137,6 +137,7 @@ Log id of owning session */ TInt iLogId; + TInt iAttachmentLength; }; #endif // __CIMAPATOMPARSER_H__ diff -r eceabb8c7a12 -r d8ac8e5e4721 email/imap4mtm/imapsession/src/cimapatomparser.cpp --- a/email/imap4mtm/imapsession/src/cimapatomparser.cpp Tue Sep 14 12:19:12 2010 +0530 +++ b/email/imap4mtm/imapsession/src/cimapatomparser.cpp Tue Sep 14 22:54:56 2010 +0530 @@ -125,6 +125,7 @@ // Add to the parsed buffer void CImapAtomParser::BufferAppendL(const TChar aChar) { + ++iAttachmentLength; // Check for internal programming error __ASSERT_DEBUG(iBuffer != NULL, TImapServerPanic::ImapPanic(TImapServerPanic::EAtomParserBufferIsNull)); @@ -337,6 +338,13 @@ // Note that the CRLF will already have been stripped out by CImapSession // so we are treating a CR on its own as whitespace { + // if white space is there in the attched file's name,it will add to the buffer. + if( iAttachmentLength < iLiteralLength) + { + BufferAppendL(octet); + break; + } + AddAtomL(); // Either go back to looking for an atom, or a LF @@ -445,6 +453,7 @@ // Skipping... if (--iLiteralSkip==0) { + iAttachmentLength = 0; // Is literal 0 bytes long? if (iLiteralLength==0) { diff -r eceabb8c7a12 -r d8ac8e5e4721 layers.sysdef.xml --- a/layers.sysdef.xml Tue Sep 14 12:19:12 2010 +0530 +++ b/layers.sysdef.xml Tue Sep 14 22:54:56 2010 +0530 @@ -13,8 +13,18 @@ bldFile="&layer_real_source_path;" name="messaging" proFile="messaging.pro" - qmakeArgs="-r" /> + qmakeArgs="-r" /> + + + + + + + + + + diff -r eceabb8c7a12 -r d8ac8e5e4721 mobilemessaging/smsmtm/clientmtm/inc/tmsvsmsentry.h --- a/mobilemessaging/smsmtm/clientmtm/inc/tmsvsmsentry.h Tue Sep 14 12:19:12 2010 +0530 +++ b/mobilemessaging/smsmtm/clientmtm/inc/tmsvsmsentry.h Tue Sep 14 22:54:56 2010 +0530 @@ -23,6 +23,7 @@ #define __TMSVSMSENTRY_H__ #include +#include /** A specialisation of the message server index class for SMS message entries. diff -r eceabb8c7a12 -r d8ac8e5e4721 mobilemessaging/smsmtm/servermtm/group/SMSS.rss --- a/mobilemessaging/smsmtm/servermtm/group/SMSS.rss Tue Sep 14 12:19:12 2010 +0530 +++ b/mobilemessaging/smsmtm/servermtm/group/SMSS.rss Tue Sep 14 22:54:56 2010 +0530 @@ -64,7 +64,12 @@ //SMS Errors SEND_ERROR { error = -4814; }, // KErrGsmSMSOperationNotAllowed - SEND_ERROR { error = -5252; } // KPKIErrKeyStoreEmpty + SEND_ERROR { error = -5252; }, // KPKIErrKeyStoreEmpty + SEND_ERROR { error = -4533; }, // KErrGsmSMSShortMessageTransferRejected + SEND_ERROR { error = -4540; }, // KErrGsmSMSUnidentifiedSubscriber + SEND_ERROR { error = -4542; }, // KErrGsmSMSUnknownSubscriber + SEND_ERROR { error = -4550; }, // KErrGsmSMSNetworkOutOfOrder + SEND_ERROR { error = -4608; } // KErrGsmSMSInvalidMandatoryInformation }; }, SEND_ERROR_ACTION diff -r eceabb8c7a12 -r d8ac8e5e4721 package_definition.xml --- a/package_definition.xml Tue Sep 14 12:19:12 2010 +0530 +++ b/package_definition.xml Tue Sep 14 22:54:56 2010 +0530 @@ -60,7 +60,7 @@ - + @@ -72,10 +72,10 @@ - + - + @@ -116,10 +116,10 @@ - + - + @@ -157,10 +157,10 @@ - + - +