--- 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 @@
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
//
+// <qmail> 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 @@
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
//
+// <qmail> 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 @@
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
-//
+// <qmail> 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<TImSmtpProgress> 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 );
+// <qmail> 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;
+// <qmail>
+ 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;
+// <qmail>
}
}
+ }
+
+// <qmail>
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+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;
}
+// </qmail>
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
@@ -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;
}
+// <qmail>
+// ---------------------------------------------------------------------------
+// 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;
+ }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// <qmail> return type
+TIpsOpType CIpsPlgSmtpOperation::IpsOpType() const
+ {
+ FUNC_LOG;
+ return EIpsOpTypeSmtp;
+ }
+// </qmail>
+
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
//
@@ -324,14 +370,14 @@
// is it safe to change flag from suspended to waiting?
if ( sendState == KMsvSendStateSuspended )
{
+ // <qmail> 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
+ // </qmail>
}
// 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 );
- }
+// <qmail>
+ //if( !IpsSetUtils::IsValidEmailAddressL( fullName ) )
+ // {
+ // User::Leave( KErrBadName );
+ // }
+// </qmail>
}
}
-
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
//
@@ -455,66 +502,8 @@
{
iEventHandler = aEventHandler;
}
-
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-//
-TBool CIpsPlgSmtpOperation::QueryUserPassL()
- {
- if ( iEventHandler )
- {
- CIpsPlgEventHandler* eventHandler = static_cast<CIpsPlgEventHandler*>(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();
- }
- }
+// <qmail> TBool CIpsPlgSmtpOperation::QueryUserPassL() removed
+// <qmail> void CIpsPlgSmtpOperation::CredientialsSetL( TInt aEvent )
// End of File