void CMsgImOutboxSend::ConstructL(TMsvId aService) { iTotalMessages = iEntrySelection.Count(); iCurrentMessageNo = -1; iProgress.SetServiceId(aService); //Load service info iServerEntry context.. User::LeaveIfError(iServerEntry.SetEntry(aService)); __ASSERT_DEBUG(iServerEntry.Entry().iType==KUidMsvServiceEntry,gPanic(EImsmNoServiceInfo)); // Assert is ServiceEntry.. iSettings = CSmtpSettings::NewL(iServerEntry); iBccRcptArray = new (ELeave) CDesCArrayFlat(KBccArraySegment); // Assert descriptors != empty __ASSERT_DEBUG (iSettings->ServerAddress().Length() >0 , gPanic(EImsmEmptyPostOffice)); __ASSERT_DEBUG (iSettings->EmailAddress().Length() >0 , gPanic(EImsmEmptyEmailAddress)); #if (defined SYMBIAN_USER_PROMPT_SERVICE) iWaiter = CSmtpUpsResponseWaiter::NewL(); #endif if (iSettings->BearerMobility()) { iMobilityManager = CImMobilityManager::NewL(KUidSmtpServerMtm, aService, *this); } CActiveScheduler::Add(this); }
void CImOperationQueueList::RestoreQueuedListL(CImQueuedList &aList) // // Append contents of current entry (pointed to by iServiceEntry) // to aList. // { __ASSERT_DEBUG( iServiceEntry->Entry().iMtm == KUidMsgTypeIMAP4, gPanic(EOffOpBadMtmTypeUid)); __ASSERT_DEBUG( iServiceEntry->Entry().iType == KUidMsvFolderEntry || iServiceEntry->Entry().iType == KUidMsvServiceEntry, gPanic(EOffOpEntryShouldBeFolder)); TInt err=KErrNone; CMsvStore* store=NULL; // Leaves with KErrNotFound if no store exists. TRAP(err,store=iServiceEntry->ReadStoreL()); if (err) return; CleanupStack::PushL(store); aList.SetFolder(iServiceEntry->Entry().Id()); aList.ResetLineCounter(); CImOffLineArrayStore internaliser(aList); internaliser.RestoreL(*store); CleanupStack::PopAndDestroy();//store }
/** The CMsvSendExe::OperationComplete method Called by a CMsvSendExeActive when it completes If all operations in iOperations are complete, then CMsvSendExe completes itself @return @internalAll @param aActive The operation that has just completed @param aError */ void CMsvSendExe::OperationComplete(const CMsvSendExeActive& aActive, TInt aError) { SCHSENDLOG(FLog(iFileName, _L("\tOperation Complete (Mtm=%d CommandId=%d Err=%d)"), aActive.Mtm().iUid, aActive.Package().iCommandId, aError)); if (aError != KErrNone) RescheduleOnError(aActive, aError); #ifdef _DEBUG iOperationsComplete++; #endif __ASSERT_DEBUG(!aActive.IsActive(), gPanic(EOperationCompletedTooSoon)); TInt count = iOperations.Count(); while (count--) { if (iOperations[count]->IsActive()) { __ASSERT_DEBUG(iOperationsComplete < iOperations.Count(), gPanic(ETooManyOperationsCompleted)); return; } } TRequestStatus* status = &iStatus; User::RequestComplete(status, KErrNone); }
void CSmtpClientMtm::InvokeSyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TDes8& aParameter) /** Invokes a synchronous SMTP-specific operation. @param aFunctionId Specifies which operation to perform. The only valid ID is KSMTPMTMIsConnected. @param aSelection A selection of messages for the operation. @param aParameter Not used */ { __ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ESmtcMTMNoCMsvEntrySet)); TInt error = KErrNone; switch (aFunctionId) { case KSMTPMTMIsConnected: { TPckgBuf<TImSmtpProgress> progress; Session().TransferCommandL(aSelection, KSMTPMTMIsConnected, aParameter, progress); aParameter.Copy(progress); return; } default: error=KErrNotSupported; __ASSERT_DEBUG(EFalse,gPanic(ESmtcUnknownSyncFunction)); } User::LeaveIfError(error); }
void CTextMtmClient::LoadMessageL() // Restore entry data // Operation inverse to StoreL // { __ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ETxtcNoCMsvEntrySet)); // get read-only message store CMsvStore* store = iMsvEntry->ReadStoreL(); CleanupStack::PushL(store); switch (iMsvEntry->Entry().iType.iUid) { case KUidMsvServiceEntryValue: iSettings->LoadSettingsL(iMsvEntry->Entry().Id(), iTxtSettings); break; case KUidMsvMessageEntryValue: RestoreBodyL(*store); break; default: __ASSERT_DEBUG(EFalse, gPanic(ETxtcEntryTypeNotSupported)); break; } CleanupStack::PopAndDestroy(); // store }
void CTextMtmClient::SaveMessageL() // Store entry data // If it is a service entry, store the current settings. Otherwise it has to be // a message. // { __ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ETxtcNoCMsvEntrySet)); // get an editable message store CMsvStore* store = iMsvEntry->EditStoreL(); CleanupStack::PushL(store); switch (iMsvEntry->Entry().iType.iUid) { case KUidMsvServiceEntryValue: iSettings->SaveSettingsL(iMsvEntry->Entry().Id(), iTxtSettings); break; case KUidMsvMessageEntryValue: StoreBodyL(*store); break; default: __ASSERT_DEBUG(EFalse, gPanic(ETxtcEntryTypeNotSupported)); break; } store->CommitL(); CleanupStack::PopAndDestroy(); // store }
void CMsvScheduleSend::GetOffPeakL(TTime aFromTime, TTime& aStartTime, TTimeIntervalMinutes& aValidityPeriod) const { __ASSERT_DEBUG(iOffPeakTimes->Count() > 0, gPanic(EOffPeakTimesEmpty)); TMsvOffPeakTime opTime; TTime offPeakStart; User::LeaveIfError(iOffPeakTimes->GetNextOffPeakTime(aFromTime, opTime, offPeakStart)); aValidityPeriod = opTime.ValidityPeriod(); if (offPeakStart < aFromTime) { //aFromTime is within an off peak time aStartTime = aFromTime; TTimeIntervalMinutes mins; aStartTime.MinutesFrom(offPeakStart, mins); TInt minsInt = mins.Int(); __ASSERT_DEBUG(minsInt >= 0, gPanic(EInvalidValidityPeriod)); aValidityPeriod = opTime.ValidityPeriod(); aValidityPeriod = (TTimeIntervalMinutes) (aValidityPeriod.Int() - minsInt); } else { aStartTime = offPeakStart; } //To Do: Remove next line after testing __ASSERT_DEBUG(aValidityPeriod.Int() > 0, gPanic(EInvalidValidityPeriod)); }
/** Schedules messages on the task scheduler. Messages that are successfully scheduled have their sending state set to KMsvSendStateScheduled. @param aSelection Array of message IDs that need to be scheduled. This array cannot be empty. All the messages identified in the selection must belong to the same MTM; be scheduled for the same time; have the same setting for their OffPeak() flag; have the scheduled time stored in the iDate member of their corresponding TMsvEntry. @param aPackage Scheduling options @leave Any error code but KErrLocked and KErrNotFound The method overloading CMsvScheduledEntry::GetMessageL() left with an error, i.e. the scheduling info of one of the messages from the selection could not be retrieved from the message server. @leave Any error code Unable to reset the previous scheduling info for a message. @panic ScheduleSend-DLL 0 The array of message IDs is empty. Debug build only. @panic ScheduleSend-DLL 1 At least one of the selected messages is scheduled for a different time as the others. Debug build only. @panic ScheduleSend-DLL 2 At least one of the selected messages does not belong to the same MTM. Debug build only. @panic ScheduleSend-DLL 3 At least one of the selected messages does not have the same off-peak settings as the others. Debug build only. */ EXPORT_C void CMsvScheduleSend::ScheduleL(const CMsvEntrySelection& aSelection, const TMsvSchedulePackage& aPackage) { __ASSERT_DEBUG(aSelection.Count() > 0, gPanic(EMessageSelectionEmpty)); iPackage = aPackage; GetMessagesL(aSelection); //Leaves with KErrNotFound if there //are no messages returned in schEntries TInt entryCount = iSchEntries->Count(); SCHSENDLOG(FLog(_L8("Asked to schedule %d msgs"), entryCount)); if (entryCount) { TTime startTime; #if defined(_DEBUG) CMsvScheduledEntry* firstEntry = (*iSchEntries)[0]; #endif while (entryCount--) { CMsvScheduledEntry* message = iSchEntries->At(entryCount); __ASSERT_DEBUG(firstEntry->ScheduleDate() == message->ScheduleDate(), gPanic(EMessagesNotSameTime)); startTime = message->ScheduleDate(); // Reset previous scheduling info DeleteScheduleForEntryL(*message); ResetScheduleInfoForEntryL(*message, EFalse); } //Schedule the messages DoScheduleL(*iSchEntries, KMsvSendStateScheduled, startTime, EFalse); } }
CMsvOperation* CTextMtmClient::ForwardL(TMsvId aForwardEntryId, TMsvPartList aPartList, TRequestStatus& aCompletionStatus) // Create forwarded message // Destination folder is aForwardEntryL // { __ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ETxtcNoCMsvEntrySet)); __ASSERT_DEBUG(iMsvEntry->Entry().iType.iUid == KUidMsvMessageEntryValue, gPanic(ETxtcEntryTypeNotSupported)); __ASSERT_DEBUG(iMsvEntry->Entry().iServiceId == KMsvLocalServiceIndexEntryId, gPanic(ETxtcInvalidServiceId)); // Create the forwarded index entry TMsvEntry forwardEntry; forwardEntry.iMtm = KUidMsgTypeText; forwardEntry.iServiceId = Entry().Entry().iServiceId; forwardEntry.iType = KUidMsvMessageEntry; forwardEntry.iDetails.Set(iMsvEntry->Entry().iDetails); forwardEntry.iSize = iMsvEntry->Entry().iSize; if(aPartList&KMsvMessagePartDate) forwardEntry.iDate.HomeTime(); if(aPartList&KMsvMessagePartDescription) forwardEntry.iDescription.Set(iMsvEntry->Entry().iDescription); // Get CMsvEntry for destination (parent) CMsvEntry* cEntry = CMsvEntry::NewL(Session(), aForwardEntryId, TMsvSelectionOrdering()); CleanupStack::PushL(cEntry); // Synchronously create new child CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC(); CMsvOperation* opert = cEntry->CreateL(forwardEntry, wait->iStatus); CleanupStack::PushL(opert); wait->Start(); User::LeaveIfError(opert->iStatus.Int()); // Check result TPckgBuf<TMsvLocalOperationProgress> progressPack; progressPack.Copy(opert->ProgressL()); TMsvLocalOperationProgress progress = progressPack(); User::LeaveIfError(progress.iError); CleanupStack::PopAndDestroy(2); // opert, wait // Get CMsvEntry for new entry TMsvId forwardId=progress.iId; cEntry->SetEntryL(forwardId); // Populate new forwarded message with Body text if(aPartList&KMsvMessagePartBody) { CMsvStore* store=cEntry->EditStoreL(); CleanupStack::PushL(store); StoreBodyL(*store); // Current context is original message store->CommitL(); CleanupStack::PopAndDestroy(); // store } CleanupStack::PopAndDestroy(); // cEntry // Request was performed synchronously, so return a completed operation object return CMsvCompletedOperation::NewL(Session(), KUidMsgTypeText, progressPack, KMsvNullIndexEntryId, aCompletionStatus); }
void CSmtpClientMtm::SaveMessageL() /** Commits cached changes to the current message context to the storage controlled by the Message Server. */ { __ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ESmtcMTMNoCMsvEntrySet)); __ASSERT_DEBUG(iMsvEntry->Entry().iType.iUid==KUidMsvMessageEntryValue, gPanic(ESmtcMTMNotAMessageEntry)); StoreEmailMessageL(); }
EXPORT_C void CSmtpClientMtm::AddEntryAsAttachmentL(TMsvId aAttachmentId, TRequestStatus& aStatus) { __ASSERT_DEBUG(iMsvEntry->Entry().iType.iUid==KUidMsvMessageEntryValue, gPanic(ESmtcMTMNotAMessageEntry)); if( iAttachmentWaiter == NULL ) { iAttachmentWaiter = CImAttachmentWaiter::NewL(); } if (iEmailMessage == NULL) { iEmailMessage = CImEmailMessage::NewL(*iMsvEntry); } else if (iEmailMessage->EmailEntryId() != iMsvEntry->EntryId()) { delete iEmailMessage; iEmailMessage = NULL; iEmailMessage = CImEmailMessage::NewL(*iMsvEntry); } CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvMessageEntry); CleanupStack::PushL(attachmentInfo); iEmailMessage->AttachmentManager().AddEntryAsAttachmentL(aAttachmentId, attachmentInfo, iAttachmentWaiter->iStatus); CleanupStack::Pop(attachmentInfo);// ownership passed to attachment manager iAttachmentWaiter->StartWaitingL(aStatus, iEmailMessage, EFalse); }
void CImOperationQueueList::StoreQueuedListL(CImQueuedList &aList) // // Store contents of aList back in current entry (pointed to by iServiceEntry) // to aList. // { __ASSERT_DEBUG( iServiceEntry->Entry().iMtm == KUidMsgTypeIMAP4, gPanic(EOffOpBadMtmTypeUid)); __ASSERT_DEBUG( iServiceEntry->Entry().iType == KUidMsvFolderEntry || iServiceEntry->Entry().iType == KUidMsvServiceEntry, gPanic(EOffOpEntryShouldBeFolder)); CMsvStore* store = iServiceEntry->EditStoreL(); CleanupStack::PushL(store); CImOffLineArrayStore externaliser(aList); externaliser.StoreL(*store); store->CommitL(); CleanupStack::PopAndDestroy();//store }
TMsvPartList CSmtpClientMtm::ValidateMessage(TMsvPartList aPartList) /** Validates the current message context. The addresses for the message are checked to be well-formed email addresses. @param aPartList Indicates the message parts for which validation is requested @return If valid, KErrNone If invalid, identifies the invalid part(s). The error value is the bitmask of the TMsvPartList IDs for each invalid part */ { __ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ESmtcMTMNoCMsvEntrySet)); TMsvPartList failed(0); if (aPartList & KMsvMessagePartRecipient) { if (iAddresseeList->Count() == 0) failed |= KMsvMessagePartRecipient; else { // check the recipient list for valid 'addresses' for (TInt ii=0; ii < iAddresseeList->Count(); ++ii) { if (((*iAddresseeList)[ii].Length() == 0) || !ValidateAddress((*iAddresseeList)[ii])) { failed |= KMsvMessagePartRecipient; break; } } } } return failed; }
/** A bearer switch has been requested and we should try to switch over to it. The action parameter indicates what should happen to the current operation. @param aAction What should happen to the current operation. @param aIsSeamless Is this a seamless switchover. */ void CMsgImOutboxSend::PrepareForNewCarrier(TImMobilityAction aAction, TBool /*aIsSeamless*/) { switch (aAction) { case KAcceptImmediately: { // Just kill the current operation, and then signal that we are // ready to migrate CarrierLost(); SignalMigrate(); break; } case KAcceptStopCurrent: { PrepareForNewCarrierAfterOperation(EMobilityOperationStoppingCurrent); break; } case KAcceptCompleteCurrent: { PrepareForNewCarrierAfterOperation(EMobilityOperationCompletingCurrent); break; } default: { __ASSERT_DEBUG(EFalse, gPanic(EImsmUnexpectedMobilityAction)); break; } } }
/** Notification that the new carrier is active and available for connecting sockets. @param aNewAp - info about the new carrier @param aIsSeamless - indicates if a migration will be seamless */ void CImMobilityManager::NewCarrierActive(TAccessPointInfo aNewAp, TBool aIsSeamless) { __LOG_FORMAT((KDefaultLog, "<%d> NewCarrierActive(state:%d new:%d isSless:%d)", iAccountId, iState, aNewAp.AccessPoint(), aIsSeamless)); switch (iState) { case EMobilityWaitForMigrate: { iState = EMobilityConnectingToNewCarrier; iMtm.NewCarrierActive(aNewAp, aIsSeamless); break; } case EMobilityUninitialised: case EMobilityIdle: case EMobilityWaitForUpgradePolicy: case EMobilityWaitForDowngradePolicy: case EMobilityWaitForOldSocketClose: case EMobilityConnectingToNewCarrier: case EMobilityWaitForUpgradePolicyAndOldSocketClose: case EMobilityWaitForOldSocketCloseCarrierRejected: default: { // unexpected in this state __ASSERT_DEBUG(EFalse, gPanic(EPanicInvalidMobilityState)); } } }
/** Notification from the server MTM that it has been unable to re-established connection with the remote server using the new carrier. */ EXPORT_C void CImMobilityManager::NewCarrierRejected() { __LOG_FORMAT((KDefaultLog, "<%d> NewCarrierRejected(state:%d)", iAccountId, iState)); switch (iState) { case EMobilityIdle: // this results from the initial carrier being rejected. case EMobilityConnectingToNewCarrier: { iState = EMobilityIdle; //#ifdef __MOBILITY_TEST_FRAMEWORK // TBool handled = CImMobilityTestFramework::Response(*this, KMobilityTestResponseNewCarrierRejected); // if (!handled) //#endif //__MOBILITY_TEST_FRAMEWORK iCommsMobilityApi->NewCarrierRejected(); // tell the policy provider about it. CImMobilityPolicyProvider::GetRef().MigrationComplete(iAccountId, KImMigrateCouldNotReconnect, iNewAp); break; } case EMobilityUninitialised: case EMobilityWaitForUpgradePolicy: case EMobilityWaitForDowngradePolicy: case EMobilityWaitForUpgradePolicyAndOldSocketClose: case EMobilityWaitForOldSocketCloseCarrierRejected: case EMobilityWaitForOldSocketClose: case EMobilityWaitForMigrate: default: { // unexpected in this state __ASSERT_DEBUG(EFalse, gPanic(EPanicInvalidMobilityState)); } } }
void CMsgImOutboxSend::CleanUpOnDestructL() { if(!iSetDisconnected) { DisconnectUnsentMessagesL(); } if (iStatus.Int() != KErrNone) { if ((iCurrentMessageNo != -1) && (iCurrentMessageNo<iTotalMessages)) { TInt err=iServerEntry.SetEntry(iEntrySelection.At(iCurrentMessageNo)); if(err == KErrNotFound) { User::Leave(KErrNotFound); } __ASSERT_DEBUG(err == KErrNone, gPanic(EImsmServerError)); TMsvEntry entry = iServerEntry.Entry(); RestoreBccRecipientsToHeaderL(); // Set date info and completion data..update the iServerEntry with this data.. TInt errorCode = (TSmtpSessionError)iStatus.Int(); entry.iDate.UniversalTime(); if(errorCode!=KErrCancel) { entry.SetFailed(errorCode != KErrNone); entry.SetSendingState(errorCode==KErrNone? KMsvSendStateSent: KMsvSendStateWaiting); //set it to send agian. if (errorCode) entry.iError=CalculateError(errorCode); } else { entry.SetFailed(EFalse); entry.SetSendingState(KMsvSendStateSuspended); entry.iError=KErrNone; } entry.SetConnected(EFalse); #ifdef _DEBUG err = #endif iServerEntry.ChangeEntry(entry); __ASSERT_DEBUG(err == KErrNone, gPanic(EImsmServerError)); } } }
void CMsvScheduleSend::DoReScheduleL(CMsvScheduledEntries& aSchEntries) { const TInt entryCount = aSchEntries.Count(); __ASSERT_DEBUG(entryCount > 0, gPanic(EMessageSelectionEmpty)); // Sort aSchEntries by CMsvScheduledEntry::iEntry.iDate and if they are // pending conditions or not. SortByDateAndPendingConditionsL(aSchEntries); //New selection of messages that will be used to store messages //that are to be sent at the same time. CMsvScheduledEntries* sel = new (ELeave) CMsvScheduledEntries(KMsvSchsendArrayGrowth); CleanupStack::PushL(sel); sel->SetReserveL(entryCount); // so following AppendL()s won't leave CMsvScheduledEntry* curMessage = aSchEntries[0]; TTime lastTime = curMessage->ScheduleDate(); TBool lastPending = curMessage->PendingConditions(); sel->AppendL(curMessage); // Delete old schedule DeleteScheduleForEntryL(*curMessage); for( TInt curMsg = 1; curMsg < entryCount; ++curMsg ) // must forward traverse the array { curMessage = aSchEntries[curMsg]; TTime thisTime = curMessage->ScheduleDate(); TBool thisPending = curMessage->PendingConditions(); // Delete old schedule DeleteScheduleForEntryL(*curMessage); if( thisTime == lastTime && lastPending == thisPending ) { sel->AppendL(curMessage); } else { // Schedule the messages in the selection DoScheduleL(*sel, KMsvSendStateResend, lastTime, lastPending); sel->Reset(); // not ResetandDestroy because the messages are still in schEntries sel->AppendL(curMessage); lastTime = thisTime; lastPending = thisPending; } } if( sel->Count() ) { // Schedule the remaining messages DoScheduleL(*sel, KMsvSendStateResend, lastTime, lastPending); } sel->Reset(); // not ResetandDestroy because the messages are still in schEntries CleanupStack::PopAndDestroy(sel); }
TBool CImSmtpSession::GetCurrentTextLine() { TInt result=iSocket->GetCurrentTextLine(iSmtpBuffer); __ASSERT_DEBUG(result==ECRLFTerminated,gPanic(EImsmBadSmtpBuffer)); if(result==ECRLFTerminated) return ETrue; else return EFalse; }
TInt TQueuedOperationKey::Compare(TInt aLeft,TInt aRight) const { if (aLeft == aRight) return 0; if (iList[ aLeft ].FolderId() != iList[ aRight ].FolderId()) return iList[ aLeft ].FolderId() - iList[ aRight ].FolderId(); // Sort in descending order, so last lines will be deleted first TInt diff = iList[ aRight ].OperationIndex() - iList[ aLeft ].OperationIndex(); __ASSERT_DEBUG(diff != 0, gPanic(EOffOpTwoSameLinesNotAllowed)); return diff; }
EXPORT_C void CSmtpClientMtm::RestoreSettingsL() /** Loads into the object's cache the service settings from the Central Repository for the current entry. */ { __ASSERT_DEBUG(iMsvEntry->Entry().iType.iUid==KUidMsvServiceEntryValue, gPanic(ESmtcMTMNotAServiceEntry)); CEmailAccounts* account = CEmailAccounts::NewLC(); TSmtpAccount id; account->GetSmtpAccountL(iMsvEntry->Entry().Id(), id); account->LoadSmtpSettingsL(id, *iImSmtpSettings); CleanupStack::PopAndDestroy(account); }
TMsvPartList CTextMtmClient::Find(const TDesC& aTextToFind, TMsvPartList aPartList) // Find text in entry { __ASSERT_DEBUG(iMsvEntry!=NULL, gPanic(ETxtcNoCMsvEntrySet)); TBool found=EFalse; if (aPartList & KMsvMessagePartBody) { CRichText *body = &Body(); if (body != NULL) { TInt textSize = body->DocumentLength(); // Get searchable text if (textSize>0) // Symbian OS doesn't handle allocing zero byte arrays too { TText *bodyText = new TText[textSize]; if (bodyText != NULL) { // search the rich text TPtr p(bodyText,textSize,textSize); body->Extract(p); if (p.FindF( aTextToFind ) >= 0) { found = ETrue; } } delete bodyText; } } } if (aPartList & KMsvMessagePartOriginator) { if (iMsvEntry->Entry().iDetails.FindF( aTextToFind ) >= 0) { found=ETrue; } } if (aPartList & KMsvMessagePartDescription) { if (iMsvEntry->Entry().iDescription.FindF( aTextToFind ) >= 0) { found=ETrue; } } // Never searched - KMsvMessagePartAttachments, KMsvMessagePartRecipient // and KMsvMessagePartDate return found; }
void CSmtpClientMtm::LoadMessageL() /** Loads the cache with the message data for the current context. */ { __ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ESmtcMTMNoCMsvEntrySet)); switch (iMsvEntry->Entry().iType.iUid) { case KUidMsvServiceEntryValue: RestoreSettingsL(); break; case KUidMsvMessageEntryValue: RestoreEmailMessageL(); break; }; }
// --------------------------------------------------------- // CMmsSession::FetchMessageL // --------------------------------------------------------- // EXPORT_C void CMmsSession::FetchMessageL( const TDesC& aUri, CBufFlat& aMessageBuffer, TInt32 aExpectedReceiveSize, MMmsCodecDataSupplier& aDataSupplier, MMmsCodecDataSink& aDataSink, TRequestStatus& aStatus ) { LOG( _L("CMmsSession: FetchMessageL ") ); __ASSERT_DEBUG( iSessionStatus == ESessionIdle, gPanic(EMmsAlreadyBusy) ); TInt method = HTTP::EGET; iDataSupplier = &aDataSupplier; iDataSink = &aDataSink; iRequestStatus = &aStatus; // Check if we are connected or not. if ( !iConnected ) { aStatus = KRequestPending; User::RequestComplete( iRequestStatus, KMmsErrorSessionNotOpen ); } else { // Start the fetching procedures if ( !iTransaction ) { iTransaction = CMmsTransaction::NewL(); } iTransaction->ExecuteL( iHTTPSession, *iTransferControl, aUri, method, aMessageBuffer, iTransactionTimeout, iMaxReceiveSize, aExpectedReceiveSize, *iDataSupplier, *iDataSink, iStatus ); aStatus = KRequestPending; iSessionStatus = ESessionFetching; SetActive(); } }
/** Determines whether the message should be sent and if so the time interval (in seconds) that must elapse before aMessage should be sent. The time interval is determined by the error action supplied. In the case of an error action of ESendActionRetryConditionMet, the time interval indicates how long the message can be pending conditions to be met before the message is failed. The actual time period is defined in the iSettings object. This will be either iPendingConditionsTimeout, iShortInterval, iLongInterval or an element of iVariableIntervals. If the message should be sent then a value of ETrue is returned. A value of EFalse is returned if the message should not be sent. In this case the output argument aInterval is not valid. @param aMessage The message to be re-scheduled. @param aErrorAction The error action that determines the re-schedule behaviour. @param aInterval An output argument that holds the time interval to when the message should be re-sent or when the message should be failed. @return A value of ETrue if the message should be sent or EFalse if it should not */ TBool CMsvScheduleSend::GetNextRetry(CMsvScheduledEntry& aMessage, const TMsvSendErrorAction& aErrorAction, TTimeIntervalSeconds& aInterval) const { TBool retVal = (aErrorAction.iAction != ESendActionFail); aInterval = 0; if( retVal ) { if( aErrorAction.iAction == ESendActionRetryConditionMet ) { // Interval given by the agent actions timeout value. aInterval = iSettings->PendingConditionsTimeout().Int() * 60; } else if( aErrorAction.iAction == ESendActionRetryImmediately ) { aInterval = iSettings->ShortInterval(); } else { if( aErrorAction.iRetrySpacing == ESendRetrySpacingVariable ) { //Retrieve the variable spacing associated with the retry count const CArrayFixFlat<TTimeIntervalSeconds>& varIntervals = iSettings->VariableIntervals(); const TInt count = varIntervals.Count(); const TInt retry = aMessage.iData.Retries(); if( count == 0 ) { aInterval = iSettings->LongInterval(); } else if( retry < count ) { aInterval = varIntervals[retry]; } else { aInterval = varIntervals[count - 1]; } } else { // Got here then aScheduleAction.iRetrySpacing == EStatic. aInterval = iSettings->LongInterval(); } __ASSERT_DEBUG(aInterval.Int() > 0, gPanic(ERetryIntervalMustByPositive)); } } return retVal; }
/* From knowledge of the last profile used, and the profiles available, select a next profile to try, create the helper class otherwise return false */ TBool CImSmtpSession::SelectNextSMTPAuthProfileL() { CSmtpAuthMechanismHelper::TSmtpAuthProfileFlag nextProfile=NextSMTPAuthProfile(iCurrentAuthProfile); while (!(nextProfile&iSupportedAuthProfiles) && nextProfile!=CSmtpAuthMechanismHelper::ENoProfile) // while "nextProfile" is not supported // and there are profiles to try nextProfile=NextSMTPAuthProfile(nextProfile); // try the next one iCurrentAuthProfile=nextProfile; if (iCurrentAuthProfile==CSmtpAuthMechanismHelper::ENoProfile) // run out of profiles to try return EFalse; else { __ASSERT_DEBUG(!iSmtpAuthHelper, gPanic(EImsmSmtpAuthHelperAlreadyExists)); iSmtpAuthHelper=CreateSMTPAuthHelperL(iCurrentAuthProfile,iSettings); return ETrue; } }
/** Quit from the server @param aClientStatus Client status to be completed */ void CImSmtpSession::QuitL(TRequestStatus& aClientStatus) { __ASSERT_DEBUG(iSocketIsConnected, gPanic(EImsmSocketNotConnected2)); if (iSocketIsConnected) { iState = EClosingSmtp; DoStateL(); Queue(aClientStatus); } else { // Nothing to do so just complete the caller RequestComplete(aClientStatus, KErrNone); } }
/** Notification that an error has occured. This indicates that the RConnection in use is no longer valid, therefore the Server MTM will be immediately notified. Once this is done, this function MUST NOT perform any actions that use class data, as the Server MTM may delete its instance of CImMobilityManager. @param aError - error code */ void CImMobilityManager::Error(TInt aError) { // If we're closing down, we don't need to handle further notifications from Comms, // and we can safely return from here. if(iIsCancelled) { return; } __LOG_FORMAT((KDefaultLog, "<%d> Error (state:%d error:%d)", iAccountId, iState, aError)); switch (iState) { case EMobilityWaitForUpgradePolicy: case EMobilityWaitForDowngradePolicy: case EMobilityWaitForUpgradePolicyAndOldSocketClose: { // cancel the policy request. CImMobilityPolicyProvider::GetRef().Cancel(iAccountId); // fall through } case EMobilityIdle: { iState = EMobilityUninitialised; iMtm.MobilityError(aError); break; } case EMobilityWaitForOldSocketClose: case EMobilityWaitForMigrate: case EMobilityConnectingToNewCarrier: case EMobilityWaitForOldSocketCloseCarrierRejected: { iState = EMobilityUninitialised; // Tell the policy provider about it. (must happen before informing MTM) CImMobilityPolicyProvider::GetRef().MigrationComplete(iAccountId, KImMigrateMobilityError, iNewAp); // Inform the MTM. Do this last - this may delete the mobility manager iMtm.MobilityError(aError); break; } case EMobilityUninitialised: default: { // unexpected in this state __ASSERT_DEBUG(EFalse, gPanic(EPanicInvalidMobilityState)); } } }
/** The CMsvSendExe::CallMtmL method Attempts to send the messages in the operation selection @internalAll */ void CMsvSendExe::CallMtmL() { __ASSERT_DEBUG(iOperations.Count(), gPanic(ENoMessagesInSelection)); TInt count = iOperations.Count(); while (count--) { CMsvSendExeActive& active = *iOperations[count]; SCHSENDLOG(FLog(iFileName, _L("\tStarting operation for %d msgs (Mtm=%d CommandId=%d)"), active.MsgCount(), active.Mtm().iUid, active.Package().iCommandId)); active.StartL(); SCHSENDLOG(FLog(iFileName, _L("\tStarted (Mtm=%d CommandId=%d)"), active.Mtm().iUid, active.Package().iCommandId)); } iStatus = KRequestPending; SetActive(); }
/** Tells the scheduler that sending is complete. This function must be called when a message that had previously been scheduled is either sent or has failed. This function: 1. Deletes the TMsvEntryScheduleData associated with the message 2. Sets the Scheduled flag to EFalse 3. If required, calls ChangeEntry() on the message server entry Note: SendingCompleteL() does not change the sending state of each message, nor delete each message from the task scheduler. @param aEntry The message which was either successfully sent or which failed (all the attempts) to send. It is not a precondition that the message has already been scheduled on the task scheduler. @param aChangeEntry If aChangeEntry is ETrue then SendingCompleteL() will call CMsvServerEntry::ChangeEntry() to update the message on the message server. @panic ScheduleSend-DLL 24 The server entry is not set to the correct entry. Debug build only. */ EXPORT_C void CMsvScheduleSend::SendingCompleteL(TMsvEntry& aEntry, const TBool aChangeEntry) { __ASSERT_DEBUG(iServerEntry.Entry().Id() == aEntry.Id(), gPanic(EServerEntryNotSetToCorrectEntry)); CMsvScheduledEntry* schEntry = GetMessageL(aEntry.Id()); CleanupStack::PushL(schEntry); SendingCompleteL(*schEntry, EFalse); schEntry->Entry(aEntry); if (aChangeEntry) { User::LeaveIfError(iServerEntry.ChangeEntry(aEntry)); } CleanupStack::PopAndDestroy(); //schEntry }