diff -r dcf0eedfc1a3 -r d189ee25cf9d ipsservices/ipssosplugin/src/ipsplgsmtpoperation.cpp --- a/ipsservices/ipssosplugin/src/ipsplgsmtpoperation.cpp Thu Aug 19 09:38:05 2010 +0300 +++ b/ipsservices/ipssosplugin/src/ipsplgsmtpoperation.cpp Tue Aug 31 15:04:17 2010 +0300 @@ -27,15 +27,19 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // +// aPriority, aUsePublishSubscribe parameters removed, aOperationObserver, aRequestId added EXPORT_C CIpsPlgSmtpOperation* CIpsPlgSmtpOperation::NewL( CMsvSession& aMsvSession, - TInt aPriority, TRequestStatus& - aObserverRequestStatus, - TBool /*aUsePublishSubscribe*/ ) + TRequestStatus& aObserverRequestStatus, + MFSMailRequestObserver* aOperationObserver, + TInt aRequestId ) { FUNC_LOG; CIpsPlgSmtpOperation* self = CIpsPlgSmtpOperation::NewLC( - aMsvSession, aPriority, aObserverRequestStatus, ETrue ); + aMsvSession, + aObserverRequestStatus, + aOperationObserver, + aRequestId ); CleanupStack::Pop( self ); return self; } @@ -43,15 +47,19 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // +// aPriority, aUsePublishSubscribe parameters removed, aOperationObserver, aRequestId added EXPORT_C CIpsPlgSmtpOperation* CIpsPlgSmtpOperation::NewLC( CMsvSession& aMsvSession, - TInt aPriority, TRequestStatus& aObserverRequestStatus, - TBool /*aUsePublishSubscribe*/ ) + MFSMailRequestObserver* aOperationObserver, + TInt aRequestId ) { FUNC_LOG; CIpsPlgSmtpOperation* self = new( ELeave ) CIpsPlgSmtpOperation( - aMsvSession, aPriority, aObserverRequestStatus ); + aMsvSession, + aObserverRequestStatus, + aOperationObserver, + aRequestId ); CleanupStack::PushL( self ); self->ConstructL(); return self; @@ -59,17 +67,19 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- -// +// aPriority parameter removed, aOperationObserver, aRequestId added CIpsPlgSmtpOperation::CIpsPlgSmtpOperation( CMsvSession& aMsvSession, - TInt aPriority, - TRequestStatus& aObserverRequestStatus ) : - CMsvOperation( aMsvSession, aPriority, aObserverRequestStatus ), + TRequestStatus& aObserverRequestStatus, + MFSMailRequestObserver* aFSOperationObserver, + TInt aFSRequestId ) : + CIpsPlgBaseOperation( aMsvSession, aObserverRequestStatus, aFSRequestId, TFSMailMsgId() ), iSmtpMtm( NULL ), iOperation( NULL ), iSelection( NULL ), iMtmRegistry( NULL ), iState( EIdle ), + iFSOperationObserver( aFSOperationObserver ), iEventHandler( NULL ) { FUNC_LOG; @@ -149,49 +159,49 @@ TPckg param(prog); param.Copy( iOperation->FinalProgress() ); - if ( prog.Error() == KSmtpLoginRefused ) - { - // Login details are wrong. Trying to ask for password - if ( !QueryUserPassL() ) - { - CompleteObserver( prog.Error() ); - } - } - else if ( prog.Error() == KSmtpUnknownErr ) - { - // try to handle empty password problem - CEmailAccounts* accounts = CEmailAccounts::NewLC(); - CImSmtpSettings* smtpSettings = new(ELeave) CImSmtpSettings(); - CleanupStack::PushL( smtpSettings ); - TSmtpAccount smtpAccount; - accounts->GetSmtpAccountL( iSmtpService, smtpAccount ); - accounts->LoadSmtpSettingsL( smtpAccount, *smtpSettings ); +// Removed login error handling - if ( smtpSettings->Password().Length() == 0 ) - { - if ( !QueryUserPassL() ) - { - CompleteObserver( prog.Error() ); - } - } - CleanupStack::PopAndDestroy( 2, accounts ); - } - else - { - CompleteObserver( prog.Error() ); - } - break; - } - case EQueryingDetails: - { - delete iOperation; - iOperation = NULL; - // querying pass finished - try to resend mail - CallSendL(); - break; +// + if ( iFSOperationObserver ) + { + iFSProgress.iProgressStatus = + TFSProgress::EFSStatus_RequestComplete; + iFSProgress.iError = prog.Error(); + + TRAP_IGNORE( iFSOperationObserver->RequestResponseL( + iFSProgress, iFSRequestId ) ); + } + TRequestStatus* status = &iObserverRequestStatus; + User::RequestComplete( status, prog.Error() ); + break; +// } } + } + +// +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CIpsPlgSmtpOperation::RunError( TInt aError ) + { + FUNC_LOG; + + if ( iFSOperationObserver ) + { + iFSProgress.iProgressStatus = TFSProgress::EFSStatus_RequestComplete; + iFSProgress.iError = aError; + + TRAP_IGNORE( iFSOperationObserver->RequestResponseL( + iFSProgress, iFSRequestId ) ); + } + + TRequestStatus* status = &iObserverRequestStatus; + User::RequestComplete( status, aError ); + + return KErrNone; } +// // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- @@ -205,6 +215,9 @@ iOperation->Cancel(); } + // It is not relevant to inform FS observer. Cancelling is initiated + // either by the observer or the engine destructor when the application + // exits. CompleteObserver( KErrCancel ); } @@ -222,6 +235,39 @@ return KNullDesC8; } +// +// --------------------------------------------------------------------------- +// CIpsPlgSmtpOperation::GetErrorProgressL +// --------------------------------------------------------------------------- +// +const TDesC8& CIpsPlgSmtpOperation::GetErrorProgressL( TInt /*aError*/ ) + { + FUNC_LOG; + + return KNullDesC8; // error progress info not supported + } + +// --------------------------------------------------------------------------- +// CIpsPlgSmtpOperation::GetFSProgressL +// --------------------------------------------------------------------------- +// +TFSProgress CIpsPlgSmtpOperation::GetFSProgressL() const + { + FUNC_LOG; + + return iFSProgress; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// return type +TIpsOpType CIpsPlgSmtpOperation::IpsOpType() const + { + FUNC_LOG; + return EIpsOpTypeSmtp; + } +// + // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // @@ -324,14 +370,14 @@ // is it safe to change flag from suspended to waiting? if ( sendState == KMsvSendStateSuspended ) { + // remove activeschedulerwait CMsvEntry* cEntry = CMsvEntry::NewL( iMsvSession, entry.Id(), TMsvSelectionOrdering() ); CleanupStack::PushL( cEntry ); - CIpsPlgOperationWait* wait = CIpsPlgOperationWait::NewLC( ); entry.SetSendingState( KMsvSendStateWaiting ); - cEntry->ChangeL( entry, wait->iStatus ); - wait->Start(); - CleanupStack::PopAndDestroy(2, cEntry ); // wait, cEntry + cEntry->ChangeL( entry ); + CleanupStack::PopAndDestroy( cEntry ); // cEntry + // } // add to send list iSelection->AppendL( entry.Id() ); @@ -441,13 +487,14 @@ fullName.Set( aRecipients[i].Mid( start, ( end - start ) ) ); } // make basic sanity checks for email address - if( !IpsSetUtils::IsValidEmailAddressL( fullName ) ) - { - User::Leave( KErrBadName ); - } +// + //if( !IpsSetUtils::IsValidEmailAddressL( fullName ) ) + // { + // User::Leave( KErrBadName ); + // } +// } } - // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // @@ -455,66 +502,8 @@ { iEventHandler = aEventHandler; } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -TBool CIpsPlgSmtpOperation::QueryUserPassL() - { - if ( iEventHandler ) - { - CIpsPlgEventHandler* eventHandler = static_cast(iEventHandler); - TMsvEntry entry; - TMsvId service; - User::LeaveIfError( iMsvSession.GetEntry( iSmtpService, service, entry ) ); - - // ask for credentials for smtp account and wait for callback - if ( eventHandler->QueryUsrPassL( entry.iRelatedId, this, EFalse ) ) - { - iState = EQueryingDetails; - } - else - { - // another operation is waiting for password - iState = EQueryingDetailsBusy; - } - - return ETrue; - } - - return EFalse; - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -void CIpsPlgSmtpOperation::CredientialsSetL( TInt aEvent ) - { - FUNC_LOG; - - if ( iState == EQueryingDetails ) - { - // response for our operation`s query - if ( aEvent == EIPSSosCredientialsCancelled ) - { - // user canceled operation - CompleteObserver( KErrCancel ); - } - - // password has been set, continue with operation - SetActive(); - CompleteThis(); - } - else if ( iState == EQueryingDetailsBusy ) - { - // response for other operation`s query - // we could try to ask for password now, - // but decision was made to cancel operation - CompleteObserver( KErrCancel ); - SetActive(); - CompleteThis(); - } - } +// TBool CIpsPlgSmtpOperation::QueryUserPassL() removed +// void CIpsPlgSmtpOperation::CredientialsSetL( TInt aEvent ) // End of File