--- a/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp Mon May 03 12:23:15 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp Fri May 14 15:41:10 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -11,17 +11,21 @@
*
* Contributors:
*
-* Description: This file implements classes CIpsPlgSosBasePlugin, Plugin.
+* Description: This file implements classes CIpsPlgSosBasePlugin, Plugin.
*
*/
-
-
#include "emailtrace.h"
#include "ipsplgheaders.h"
+
+// <qmail> FreestyleEmailUiConstants include removed
+
+// <qmail>
#include "ipsplgsosbaseplugin.hrh"
#include "ipsplgmailstoreroperation.h"
#include "ipsplgmessagepartstoreroperation.h"
+#include "BasePlugin.h"
+//</qmail>
// <cmail> S60 UID update
#define FREESTYLE_EMAIL_UI_SID 0x200255BA
@@ -40,16 +44,16 @@
#ifdef __WINS__
_LIT( KEmulatorIMEI, "123456789012345" );
#endif // __WINS__
-
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-//
+// <qmail> iSettingsApi removed
CIpsPlgSosBasePlugin::CIpsPlgSosBasePlugin( const TUint aFSPluginId ) :
iFSPluginId( aFSPluginId ),
iSession( NULL ),
iMsgMapper( NULL ),
iOperations( KOpGranularity ),
- iActivitytimers( KOpGranularity ),
+ iActivitytimers( KOpGranularity ),
iSmtpService( NULL ),
iCachedEntry( NULL ),
iCachedEmailMessage( NULL ),
@@ -65,7 +69,7 @@
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-//
+// <qmail> iSettingsApi, iWait removed
CIpsPlgSosBasePlugin::~CIpsPlgSosBasePlugin()
{
FUNC_LOG;
@@ -88,19 +92,20 @@
delete iSession;
delete iBrandingId;
}
-
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::BaseConstructL()
{
FUNC_LOG;
iEventHandler = CIpsPlgEventHandler::NewL( *this );
- iSession = CMsvSession::OpenAsyncL( *iEventHandler );
+ iSession = CMsvSession::OpenAsyncL( *iEventHandler );
iMsgMapper = CIpsPlgMsgMapper::NewL( *iSession, *this );
iSmtpService = CIpsPlgSmtpService::NewL( *iSession, *this );
iMruList = CIpsPlgMruList::NewL( );
iSearch = CIpsPlgSearch::NewL( *iSession, *this );
- iSyncStateHandler = CIpsPlgSyncStateHandler::NewL(
+ // <qmail> iSettingsApi removed
+ iSyncStateHandler = CIpsPlgSyncStateHandler::NewL(
*iSession, *this, iOperations );
iEventHandler->RegisterPropertyObserverL( iSyncStateHandler );
@@ -115,30 +120,30 @@
}
#ifndef RD_101_EMAIL
- RAlwaysOnlineClientSession aosession;
+ RAlwaysOnlineClientSession aosession;
TInt err = aosession.Connect();
if ( err == KErrNone )
{
TBuf8<1> dummyBuf;
- TRAP( err, aosession.RelayCommandL(
- EServerAPIEmailDisableAOEmailPlugin,
+ TRAP( err, aosession.RelayCommandL(
+ EServerAPIEmailDisableAOEmailPlugin,
dummyBuf ) );
}
aosession.Close();
#endif
- }
+ }
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::CompleteConstructL()
{
FUNC_LOG;
iSessionOk = ETrue;
- iEventHandler->CompleteConstructL( iSession );
+ iEventHandler->CompleteConstructL( iSession );
}
-
+
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::SessionTerminated()
{
FUNC_LOG;
@@ -147,12 +152,12 @@
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::OpCompleted(
- CIpsPlgSingleOpWatcher& aOpWatcher,
+void CIpsPlgSosBasePlugin::OpCompleted(
+ CIpsPlgSingleOpWatcher& aOpWatcher,
TInt aCompletionCode )
{
FUNC_LOG;
- // Get valid operation count in each, some operations could have been
+ // Get valid operation count in each, some operations could have been
// deleted in array
TInt opId = aOpWatcher.Operation().Id();
for ( TInt i = iOperations.Count()-1; i >= 0; i-- )
@@ -163,12 +168,14 @@
{
DeleteAndRemoveOperation( i, aCompletionCode );
}
+
+// <qmail> iWait removed
}
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
- TFSMailBoxStatus CIpsPlgSosBasePlugin::GetMailBoxStatus(
+// ----------------------------------------------------------------------------
+ TFSMailBoxStatus CIpsPlgSosBasePlugin::GetMailBoxStatus(
const TFSMailMsgId& aMailBoxId )
{
FUNC_LOG;
@@ -178,7 +185,7 @@
if( iSessionOk )
{
iSession->GetEntry( aMailBoxId.Id(), service, tEntry );
-
+
if ( tEntry.Connected() )
{
status = EFSMailBoxOnline;
@@ -187,7 +194,7 @@
{
status = EFSMailBoxOnline;
}
- else
+ else
{
status = EFSMailBoxOffline;
}
@@ -202,7 +209,7 @@
// ----------------------------------------------------------------------------
// CIpsPlgSosBasePlugin::SpecifiedSendingMailbox
// Returns 'null' ID, because the method is not relevant with IPS protocols
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
TFSMailMsgId CIpsPlgSosBasePlugin::SpecifiedSendingMailbox()
{
FUNC_LOG;
@@ -210,21 +217,21 @@
}
// ----------------------------------------------------------------------------
- // ----------------------------------------------------------------------------
+ // ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::ListMailBoxesL( RArray<TFSMailMsgId>& aMailboxes )
{
FUNC_LOG;
-
+
if( !iSessionOk )
{
User::Leave( KErrNotReady );
}
CMsvEntry* cEntry = iSession->GetEntryL( KMsvRootIndexEntryId );
CleanupStack::PushL( cEntry );
-
+
CMsvEntrySelection* childEntries = cEntry->ChildrenWithMtmL( MtmId() );
CleanupStack::PushL( childEntries );
-
+
TInt count( childEntries->Count() );
for ( TInt i(0); i < count; i++)
{
@@ -232,9 +239,9 @@
TMsvEntry tEntry;
TMsvId serviceId;
TDriveUnit driveUnit = EDriveC;
-
+
iSession->GetEntry( childEntries->At(i), serviceId, tEntry );
-
+
if( iIMEI.Compare( tEntry.iDescription ) == 0 )
{
mailboxId.SetPluginId( TUid::Uid( PluginId() ) );
@@ -257,11 +264,11 @@
}
CleanupStack::PopAndDestroy( 2, cEntry ); // childEntries
}
-
+
+// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-CFSMailBox* CIpsPlgSosBasePlugin::GetMailBoxByUidL(
- const TFSMailMsgId& aMailBoxId)
+CFSMailBox* CIpsPlgSosBasePlugin::GetMailBoxByUidL(
+ const TFSMailMsgId& aMailBoxId)
{
FUNC_LOG;
CFSMailBox* result( NULL );
@@ -269,20 +276,21 @@
TMsvId serviceId;
TInt status;
HBufC* address( NULL );
-
+
if( !iSessionOk )
{
User::Leave( KErrNotReady );
}
status = iSession->GetEntry( aMailBoxId.Id(), serviceId, tEntry );
-
+
if ( status == KErrNone )
- {
+ {
result = CFSMailBox::NewL( aMailBoxId );
CleanupStack::PushL( result ); // << result
result->SetName( tEntry.iDetails );
result->SetSettingsUid( TUid::Uid( IPS_SET_ECOM_IMPLEMENTATION_UID ) );
-
+
+// <qmail>
CEmailAccounts* acc = CEmailAccounts::NewLC();
TSmtpAccount smtpAcc;
acc->GetSmtpAccountL( tEntry.iRelatedId , smtpAcc );
@@ -291,6 +299,7 @@
acc->LoadSmtpSettingsL( smtpAcc, *smtpSet );
address = smtpSet->EmailAddress().AllocL();
CleanupStack::PopAndDestroy( 2, acc );
+// </qmail>
CleanupStack::PushL( address ); // << address
CFSMailAddress* fsAddress = CFSMailAddress::NewLC(); // << fsAddress
@@ -300,12 +309,12 @@
CleanupStack::PopAndDestroy( address ); // >>> address
CleanupStack::Pop( result ); // >> result
}
-
+
return result;
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::DeleteMailBoxByUidL(
const TFSMailMsgId& aMailBoxId,
MFSMailRequestObserver& aOperationObserver,
@@ -319,6 +328,7 @@
User::Leave( KErrNotReady );
}
+// <qmail> RAlwaysOnlineClientSession - related code removed
// Prepare the parameters to be forwarded to AO-server
TPckg<TMsvId> param = aMailBoxId.Id();
@@ -327,26 +337,43 @@
iSyncStateHandler->NotifyMailboxRemove( aMailBoxId.Id() );
+// <qmail> CancelAllOnlineOperations function call removed
iSession->GetEntry( aMailBoxId.Id(), service, tEntry );
if ( tEntry.Connected() )
{
DisconnectL( aMailBoxId, aOperationObserver, aRequestId, ETrue );
+
+ // remove activity timer from array here but leave the actual delete
+ // to the disconnect operation. This is because the disconnect op
+ // sometimes tries to use the timer after it was deleted here.
+ TInt timerCount = iActivitytimers.Count();
+ for ( TInt j = 0; j < timerCount; j++ )
+ {
+ if ( iActivitytimers[j]->FSMailboxId() == aMailBoxId )
+ {
+ iActivitytimers.Remove( j );
+ timerCount--;
+ j--;
+ }
+ }
}
else
{
+// <qmail> iSettingsApi removed
TFSProgress progress = { TFSProgress::EFSStatus_Waiting, 0, 0, KErrNone };
progress.iProgressStatus = TFSProgress::EFSStatus_RequestComplete;
progress.iError = KErrNone;
TInt requestId = aRequestId;
aOperationObserver.RequestResponseL( progress, requestId );
+
+ DeleteActivityTimer( aMailBoxId );
}
- DeleteActivityTimer( aMailBoxId );
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-TDesC& CIpsPlgSosBasePlugin::GetBrandingIdL( const TFSMailMsgId& aMailBoxId )
- {
+// ----------------------------------------------------------------------------
+TDesC& CIpsPlgSosBasePlugin::GetBrandingIdL( const TFSMailMsgId& aMailBoxId )
+ {
FUNC_LOG;
if( !iSessionOk )
{
@@ -355,14 +382,16 @@
CMsvEntry* mboxEntry = iSession->GetEntryL( aMailBoxId.Id() );
CleanupStack::PushL( mboxEntry );
+// <qmail> iSettingsApi removed, iBrandingId removed
CleanupStack::PopAndDestroy( mboxEntry );
-
+
return *iBrandingId;
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::MoveMessagesL(
+// Pop3 has no implementation for this virtual
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::MoveMessagesL(
const TFSMailMsgId& aMailBoxId,
const RArray<TFSMailMsgId>& aMessageIds,
const TFSMailMsgId& aSourceFolderId,
@@ -372,48 +401,79 @@
// Pop3 has no implementation for this virtual
if( aDestinationFolderId.Id() == KMsvDraftEntryId )
{
- MoveMessagesToDraftL(
- aMailBoxId,
- aMessageIds,
- aSourceFolderId,
- aDestinationFolderId );
+ MoveMessagesToDraftL(
+ aMailBoxId,
+ aMessageIds,
+ aSourceFolderId,
+ aDestinationFolderId );
}
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// asynchronic version from move messages function, pop3 plugin not implent
+// this virtual fucntion.
+// ----------------------------------------------------------------------------
+TInt CIpsPlgSosBasePlugin::MoveMessagesL(
+ const TFSMailMsgId& aMailBoxId,
+ const RArray<TFSMailMsgId>& aMessageIds,
+ const TFSMailMsgId& aSourceFolderId,
+ const TFSMailMsgId& aDestinationFolderId,
+ MFSMailRequestObserver& aOperationObserver,
+ TInt aRequestId )
+ {
+ FUNC_LOG;
+ TInt ret = KErrNotSupported;
+ if( aDestinationFolderId.Id() == KMsvDraftEntryId )
+ {
+ MoveMessagesToDraftL(
+ aMailBoxId,
+ aMessageIds,
+ aSourceFolderId,
+ aDestinationFolderId );
+ ret = KErrNone;
+ }
+ ret = KErrNotSupported;
+ TFSProgress progress = {
+ TFSProgress::EFSStatus_RequestComplete, 0, 0, ret };
+ aOperationObserver.RequestResponseL(
+ progress, aRequestId );
+ return ret;
+ }
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::MoveMessagesToDraftL(
- const TFSMailMsgId& /*aMailBoxId*/,
- const RArray<TFSMailMsgId>& aMessageIds,
- const TFSMailMsgId& aSourceFolderId,
+ const TFSMailMsgId& /*aMailBoxId*/,
+ const RArray<TFSMailMsgId>& aMessageIds,
+ const TFSMailMsgId& aSourceFolderId,
const TFSMailMsgId& aDestinationFolderId )
{
FUNC_LOG;
-
+
TInt count( aMessageIds.Count() );
if ( !count )
{
User::Leave( KErrArgument );
}
-
+
if( !iSessionOk )
{
User::Leave( KErrNotReady );
}
-
+
TMsvId msgService;
TMsvEntry tEntry;
-
+
CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
CleanupStack::PushL(sel);
CMsvEntry* msgEntry = iSession->GetEntryL( aMessageIds[0].Id() );
CleanupStack::PushL( msgEntry );
-
+
for( TInt i(0); i < count; i++ )
{
iSession->GetEntry( aMessageIds[i].Id(), msgService, tEntry );
-
+
if( aSourceFolderId.Id() == KMsvGlobalOutBoxIndexEntryIdValue )
{
if( tEntry.SendingState() != KMsvSendStateSending )
@@ -433,7 +493,7 @@
else
{
sel->AppendL( tEntry.Id() );
- }
+ }
}
if( sel->Count() )
{
@@ -443,25 +503,25 @@
CMsvEntry* cEntry = iSession->GetEntryL( aSourceFolderId.Id() );
CleanupStack::PushL( cEntry );
cEntry->MoveL(
- *sel,
+ *sel,
aDestinationFolderId.Id(),//KMsvDraftEntryIdValue
wait->iStatus );
-
- CleanupStack::PopAndDestroy( cEntry );
+
+ CleanupStack::PopAndDestroy( cEntry );
}
else
{
// Message is in editing state, we can't use parent as entry
- // because it's equal to destination.
+ // because it's equal to destination.
TMsvId parent = msgEntry->Entry().Parent();
msgEntry->SetEntryL( parent );
msgEntry->CopyL(
- *sel,
+ *sel,
aDestinationFolderId.Id(),//KMsvDraftEntryIdValue
wait->iStatus );
}
wait->Start();
- CleanupStack::PopAndDestroy( wait ); // wait
+ CleanupStack::PopAndDestroy( wait ); // wait
}
CleanupStack::PopAndDestroy( 2, sel ); // msgEntry, sel
}
@@ -476,9 +536,9 @@
const TFSMailMsgId& /*aDestinationFolderId*/ )
{
}
-
+
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
MDesCArray* CIpsPlgSosBasePlugin::GetMrusL(
const TFSMailMsgId& aMailBoxId)
{
@@ -486,14 +546,14 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::SetMrusL(
const TFSMailMsgId& aMailBoxId,
MDesCArray* aNewMruList )
{
iMruList->SetMruListL( aMailBoxId, aNewMruList );
}
-
+
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::GoOnlineL( const TFSMailMsgId& aMailBoxId )
@@ -504,20 +564,20 @@
RefreshNowL( aMailBoxId, *this, 0 );
}
}
-
+
// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::GoOfflineL( const TFSMailMsgId& aMailBoxId )
{
FUNC_LOG;
CancelAllOnlineOperations( aMailBoxId );
// use 0 for request id
- DisconnectL( aMailBoxId, *this, 0 );
+ DisconnectL( aMailBoxId, *this, 0 );
}
-
+
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-const TFSProgress CIpsPlgSosBasePlugin::GetLastSyncStatusL(
+// ----------------------------------------------------------------------------
+const TFSProgress CIpsPlgSosBasePlugin::GetLastSyncStatusL(
const TFSMailMsgId& aMailBoxId )
{
FUNC_LOG;
@@ -530,9 +590,9 @@
User::Leave( KErrNotReady );
}
iSession->GetEntry( aMailBoxId.Id(), service, tEntry );
-
+// <qmail>
TInt state(0);
-
+// </qmail>
switch( state )
{
case ESyncFinishedSuccessfully:
@@ -553,7 +613,7 @@
return progress;
}
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
TInt CIpsPlgSosBasePlugin::CancelSyncL( const TFSMailMsgId& aMailBoxId )
{
@@ -563,7 +623,7 @@
// found correct operation
for ( TInt i = iOperations.Count()-1; i >= 0; i-- )
{
- const CIpsPlgBaseOperation* baseOp =
+ const CIpsPlgBaseOperation* baseOp =
iOperations[i]->BaseOperation();
if ( baseOp && baseOp->FSMailboxId() == aMailBoxId &&
( baseOp->IpsOpType() == EIpsOpTypePop3SyncOp
@@ -590,7 +650,7 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
//
CFSMailFolder* CIpsPlgSosBasePlugin::GetFolderByUidL(
const TFSMailMsgId& aMailBoxId,
@@ -602,7 +662,7 @@
{
User::Leave( KErrNotReady );
}
-
+
CMsvEntry* folderEntry = iSession->GetEntryL( aFolderId.Id() );
CleanupStack::PushL( folderEntry ); // << folderEntry
@@ -611,7 +671,7 @@
result = CFSMailFolder::NewLC( aFolderId ); // << result
result->SetMailBoxId( aMailBoxId );
- CMsvEntrySelection* msgChilds = folderEntry->ChildrenWithTypeL(
+ CMsvEntrySelection* msgChilds = folderEntry->ChildrenWithTypeL(
KUidMsvMessageEntry );
CleanupStack::PushL( msgChilds );
TInt msgCount( msgChilds->Count() );
@@ -623,7 +683,7 @@
TMsvEmailEntry emlEntry;
TMsvId dummy;
TBool isRead = ETrue;
- if ( iSession->GetEntry(
+ if ( iSession->GetEntry(
msgChilds->At(i), dummy, emlEntry ) == KErrNone )
{
if ( ( PluginId() == KIpsPlgImap4PluginUid.iUid ||
@@ -633,18 +693,18 @@
isRead = EFalse;
}
}
- if ( !isRead && !emlEntry.LocallyDeleted() )
+ if ( !isRead && !emlEntry.LocallyDeleted() )
{
unreadCount++;
}
}
-
+
CleanupStack::PopAndDestroy( msgChilds );
result->SetUnreadCount( unreadCount );
result->SetFolderName( folderEntry->Entry().iDetails );
result->SetFolderType( GetFolderType( folderEntry, aFolderId ) );
TMsvEntry parentEntry;
- TInt status = iSession->GetEntry( folderEntry->Entry().Parent( ), serviceId,
+ TInt status = iSession->GetEntry( folderEntry->Entry().Parent( ), serviceId,
parentEntry );
TUint parent( 0 );
if( status == KErrNone )
@@ -658,12 +718,12 @@
parent = 0;
}
}
-
+
TFSMailMsgId parentId( PluginId(), parent );
result->SetParentFolderId( parentId );
-
+
// Set subfolder count here for ListFolderL
- CMsvEntrySelection* fldChildren =
+ CMsvEntrySelection* fldChildren =
folderEntry->ChildrenWithTypeL( KUidMsvFolderEntry );
CleanupStack::PushL( fldChildren ); // << children
result->SetSubFolderCount( fldChildren->Count() );
@@ -671,17 +731,17 @@
// Set blocklist for FW
BlockCopyMoveFromFoldersL( folderEntry, aFolderId, *result );
-
+
CleanupStack::Pop( result ); // >> result
}
CleanupStack::PopAndDestroy( folderEntry ); // >>> folderEntry
-
+
return result;
}
-
+
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-CFSMailFolder* CIpsPlgSosBasePlugin::CreateFolderL(
+// ----------------------------------------------------------------------------
+CFSMailFolder* CIpsPlgSosBasePlugin::CreateFolderL(
const TFSMailMsgId& /* aMailBoxId */,
const TFSMailMsgId& /* aFolderId */,
const TDesC& /* aFolderName */,
@@ -691,7 +751,7 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::DeleteFolderByUidL(
const TFSMailMsgId& /* aMailBoxId */,
const TFSMailMsgId& /* aFolderId */)
@@ -699,57 +759,57 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
MFSMailIterator* CIpsPlgSosBasePlugin::ListMessagesL(
const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& aFolderId,
const TFSMailDetails aDetails,
- const RArray<TFSMailSortCriteria>& aSorting )
+ const RArray<TFSMailSortCriteria>& aSorting )
{
FUNC_LOG;
- CIpsPlgMsgIterator* iterator = CIpsPlgMsgIterator::NewL(
+ CIpsPlgMsgIterator* iterator = CIpsPlgMsgIterator::NewL(
*this, *iSession, aMailBoxId, aFolderId, aDetails, aSorting );
-
+
return iterator;
}
-
+
+// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
//
-CFSMailMessage* CIpsPlgSosBasePlugin::GetMessageByUidL(
+CFSMailMessage* CIpsPlgSosBasePlugin::GetMessageByUidL(
const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& /* aFolderId */,
- const TFSMailMsgId& aMessageId,
- const TFSMailDetails aDetails)
+ const TFSMailMsgId& aMessageId,
+ const TFSMailDetails aDetails)
{
FUNC_LOG;
CFSMailMessage* result( NULL );
TMsvId serviceId;
TMsvEntry tEntry;
TInt status( KErrNone );
-
+
if( !iSessionOk )
{
User::Leave( KErrNotReady );
}
-
+
status = iSession->GetEntry( aMessageId.Id(), serviceId, tEntry);
-
+
const TMsvEmailEntry& emlEntry(tEntry);
// do not give deleted marked messages
- if ( status == KErrNone &&
+ if ( status == KErrNone &&
EDisconnectedDeleteOperation != emlEntry.DisconnectedOperation()
&& !emlEntry.DeletedIMAP4Flag() )
{
result = iMsgMapper->GetMailMessageL( aMailBoxId, tEntry, aDetails );
}
-
- return result;
+
+ return result;
}
-
+
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
- CFSMailMessage* CIpsPlgSosBasePlugin::CreateMessageToSendL(
+// ----------------------------------------------------------------------------
+ CFSMailMessage* CIpsPlgSosBasePlugin::CreateMessageToSendL(
const TFSMailMsgId& aMailBoxId )
{
FUNC_LOG;
@@ -769,21 +829,18 @@
TMsvPartList partList( KMsvMessagePartBody );
CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewLC(*this);
+
+ //<qmail> removed mboxEntry from parameters + changed iSmtpService to pointer
- TMsvEntry mboxEntry;
- TMsvId service;
- User::LeaveIfError(
- iSession->GetEntry( aMailBoxId.Id(), service, mboxEntry ) );
-
CIpsPlgCreateMessageOperation* op = CIpsPlgCreateMessageOperation::NewL(
- iSmtpService,
+ *iSmtpService,
*iSession,
watcher->iStatus,
- mboxEntry.iRelatedId,
partList,
aMailBoxId,
aOperationObserver,
aRequestId );
+ //</qmail>
watcher->SetOperation( op );
iOperations.AppendL( watcher );
@@ -793,14 +850,26 @@
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-CFSMailMessage* CIpsPlgSosBasePlugin::CreateForwardMessageL(
+CFSMailMessage* CIpsPlgSosBasePlugin::CreateForwardMessageL(
const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& aOriginalMessageId,
- const TDesC& /* aHeaderDescriptor */)
+ const TDesC& aHeaderDescriptor )
{
FUNC_LOG;
- CFSMailMessage* msg = iSmtpService->CreateForwardSmtpMessageL(
+ CFSMailMessage* msg = iSmtpService->CreateForwardSmtpMessageL(
aMailBoxId, aOriginalMessageId );
+
+ if ( aHeaderDescriptor != KNullDesC )
+ {
+ // Ignoring trap as it is better to provide something in case of the
+ // below fix method fails than nothing.
+ TRAP_IGNORE( FixReplyForwardHeaderL(
+ msg,
+ aMailBoxId,
+ aOriginalMessageId,
+ aHeaderDescriptor ) );
+ }
+
return msg;
}
@@ -839,8 +908,9 @@
CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewLC(*this);
+ //<qmail> changed iSmtpService to pointer
CIpsPlgCreateForwardMessageOperation* op = CIpsPlgCreateForwardMessageOperation::NewL(
- iSmtpService,
+ *iSmtpService,
*iSession,
watcher->iStatus,
partList,
@@ -848,6 +918,7 @@
orgMsg.Id(),
aOperationObserver,
aRequestId );
+ //</qmail>
watcher->SetOperation( op );
iOperations.AppendL( watcher );
@@ -861,11 +932,23 @@
const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& aOriginalMessageId,
const TBool aReplyToAll,
- const TDesC& /* aHeaderDescriptor */ )
+ const TDesC& aHeaderDescriptor )
{
FUNC_LOG;
- CFSMailMessage* msg = iSmtpService->CreateReplySmtpMessageL(
+ CFSMailMessage* msg = iSmtpService->CreateReplySmtpMessageL(
aMailBoxId, aOriginalMessageId, aReplyToAll );
+
+ if ( aHeaderDescriptor != KNullDesC )
+ {
+ // Ignoring trap as it is better to provide something in case of the
+ // below fix method fails than nothing.
+ TRAP_IGNORE( FixReplyForwardHeaderL(
+ msg,
+ aMailBoxId,
+ aOriginalMessageId,
+ aHeaderDescriptor ) );
+ }
+
return msg;
}
@@ -910,8 +993,9 @@
CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewLC(*this);
+ //<qmail> changed iSmtpService to pointer
CIpsPlgCreateReplyMessageOperation* op = CIpsPlgCreateReplyMessageOperation::NewL(
- iSmtpService,
+ *iSmtpService,
*iSession,
watcher->iStatus,
partList,
@@ -919,6 +1003,7 @@
orgMsg.Id(),
aOperationObserver,
aRequestId );
+ //</qmail>
watcher->SetOperation( op );
iOperations.AppendL( watcher );
@@ -954,6 +1039,8 @@
if ( incoming )
{
+ // <qmail> Cmail change to synchronous call (UpdateMessageFlagsL) ignored,
+ // <qmail> because it causes emulator & HW to freeze on 10.1
CIpsPlgSingleOpWatcher* opW = CIpsPlgSingleOpWatcher::NewLC( *this );
CMsvOperation* op = iMsgMapper->UpdateMessageFlagsAsyncL(
msgId.Id(), aMessage, opW->iStatus );
@@ -1008,31 +1095,31 @@
// ----------------------------------------------------------------------------
// CIpsPlgSosBasePlugin::GetMessagesL()
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
//
void CIpsPlgSosBasePlugin::GetMessagesL(
const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& aFolderId,
const RArray<TFSMailMsgId>& aMessageIds,
RPointerArray<CFSMailMessage>& aMessageList,
- const TFSMailDetails aDetails )
+ const TFSMailDetails aDetails )
{
FUNC_LOG;
TInt i;
CFSMailMessage* msg;
-
+
for (i = 0; i < aMessageIds.Count(); i++ )
{
- msg = GetMessageByUidL(
+ msg = GetMessageByUidL(
aMailBoxId, aFolderId, aMessageIds[i], aDetails );
CleanupStack::PushL( msg );
aMessageList.AppendL( msg );
CleanupStack::Pop( msg );
}
- }
+ }
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::ChildPartsL(
const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& /* aParentFolderId */,
@@ -1045,7 +1132,7 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
CFSMailMessagePart* CIpsPlgSosBasePlugin::NewChildPartL(
const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& /* aParentFolderId */,
@@ -1062,7 +1149,7 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
CFSMailMessagePart* CIpsPlgSosBasePlugin::NewChildPartFromFileL(
const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& /* aParentFolderId */,
@@ -1078,41 +1165,47 @@
RFile file;
TInt fileSize( 0 );
TBool parentToMultipartAlternative( EFalse );
-
+
// Read attachment size
User::LeaveIfError( file.Open( iSession->FileSession(), aFilePath, EFileShareReadersOnly ) );
-
+
//in rare case that file has disappeared while sending
//we just won't get the size for it
file.Size( fileSize );
- file.Close();
-
- // Initialize CMsvAttachment instance for the attachment creation
- CMsvAttachment* info = CMsvAttachment::NewL( CMsvAttachment::EMsvFile );
- CleanupStack::PushL( info );
+ file.Close();
- info->SetAttachmentNameL( aFilePath );
- info->SetSize( fileSize );
-
- // Create/acquire Symbian message entry objects
- GetMessageEntryL( aMessageId.Id(), cEntry, message );
-
+ // Take ownership of message entry objects since thanks to
+ // "clever" use of active scheduler waits we can re-enter
+ // this function leading to crashes if somebody clears the cache
+ // while this iteration still needs them
+ TakeMessageEntryLC( aMessageId.Id(), cEntry, message );
+
// Operation waiter needed to implement synchronous operation
// on the top of async API
CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewL();
CleanupStack::PushL( waiter );
+ // Initialize CMsvAttachment instance for the attachment creation
+ CMsvAttachment* info = CMsvAttachment::NewL( CMsvAttachment::EMsvFile );
+ CleanupStack::PushL( info );
+ info->SetAttachmentNameL( aFilePath );
+ info->SetSize( fileSize );
+
// Start attachment creation
- message->AttachmentManager().AddAttachmentL(
+ message->AttachmentManager().AddAttachmentL(
aFilePath, info, waiter->iStatus );
+ CleanupStack::Pop( info ); // attachment manager takes ownership
waiter->Start();
CleanupStack::PopAndDestroy( waiter );
- CleanupStack::Pop( info ); // attachment manager takes ownership
+
+ // Return message entry objects back to cache
+ CleanupStack::Pop( 2 ); // cEntry, message
+ ReturnMessageEntry( cEntry, message );
// Dig out the entry ID of the new attachment (unbelievable that
// there seems to be no better way to do this)
- message->GetAttachmentsListL( cEntry->Entry().Id( ),
+ message->GetAttachmentsListL( cEntry->Entry().Id( ),
CImEmailMessage::EAllAttachments, CImEmailMessage::EThisMessageOnly );
TKeyArrayFix key( 0, ECmpTInt32 );
CMsvEntrySelection* attachmentIds = message->Selection().CopyLC();
@@ -1123,10 +1216,10 @@
}
TMsvId newAttachmentId = (*attachmentIds)[ attachmentIds->Count()-1 ];
CleanupStack::PopAndDestroy( attachmentIds );
-
+
CMsvEntry* cAtta = iSession->GetEntryL( newAttachmentId );
CleanupStack::PushL( cAtta );
-
+
// Set filename to iDetails
TMsvEntry tEntry = cAtta->Entry();
tEntry.iDetails.Set( aFilePath );
@@ -1137,23 +1230,23 @@
CMsvStore* store = cAtta->EditStoreL();
CleanupStack::PushL( store );
CImMimeHeader* mimeHeader = CImMimeHeader::NewLC();
-
+
if( store->IsPresentL( KUidMsgFileMimeHeader ) )
{
mimeHeader->RestoreL( *store );
CDesC8Array& array = mimeHeader->ContentTypeParams();
array.AppendL( KMethod );
parentToMultipartAlternative = ETrue;
-
+
if( aContentType.Find( KMimeTextCalRequest ) != KErrNotFound )
- {
+ {
array.AppendL( KRequest );
}
else if( aContentType.Find( KMimeTextCalResponse ) != KErrNotFound )
{
array.AppendL( KResponse );
}
- else if( aContentType.Find( KMimeTextCalCancel ) != KErrNotFound )
+ else if( aContentType.Find( KMimeTextCalCancel ) != KErrNotFound )
{
array.AppendL( KCancel );
}
@@ -1164,32 +1257,32 @@
mimeHeader->StoreWithoutCommitL( *store );
store->CommitL();
}
-
+
CleanupStack::PopAndDestroy( 2, store );
}
if( parentToMultipartAlternative &&
aFilePath.Find( _L(".ics")) != KErrNotFound )
- {
+ {
TMsvEntry tAttaEntry = cAtta->Entry();
TMsvId id = tAttaEntry.Parent();
CMsvEntry* cParent = iSession->GetEntryL( id );
CleanupStack::PushL( cParent );
-
+
TMsvEmailEntry tEntry = cParent->Entry();
tEntry.SetMessageFolderType( EFolderTypeAlternative );
cParent->ChangeL( tEntry );
-
+
CleanupStack::PopAndDestroy( cParent );
}
CleanupStack::PopAndDestroy( cAtta );
-
- // Delete the message entries to get all the changes to disk and
+
+ // Delete the message entries to get all the changes to disk and
// possible store locks released
CleanCachedMessageEntries();
-
+
// Create the FS message part object
- result = iMsgMapper->GetMessagePartL( newAttachmentId, aMailBoxId,
+ result = iMsgMapper->GetMessagePartL( newAttachmentId, aMailBoxId,
aMessageId );
return result;
@@ -1242,7 +1335,7 @@
RFile& aFile )
{
FUNC_LOG;
-
+
// Initialize helper variables
CFSMailMessagePart* result ( NULL );
CMsvEntry* cEntry( NULL );
@@ -1250,33 +1343,41 @@
TInt fileSize( 0 );
TBuf<KMaxFileName> fileName;
- // Create/acquire Symbian message entry objects
- CleanCachedMessageEntries();
- GetMessageEntryL( aMessageId.Id(), cEntry, message );
+ // Take ownership of message entry objects since thanks to
+ // "clever" use of active scheduler waits we can re-enter
+ // this function leading to crashes if somebody clears the cache
+ // while this iteration still needs them
+ TakeMessageEntryLC( aMessageId.Id(), cEntry, message );
+
+ // Operation waiter needed to implement synchronous operation
+ // on the top of async API
+ CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewL();
+ CleanupStack::PushL( waiter );
// Initialize CMsvAttachment instance for the attachment creation
CMsvAttachment* info = CMsvAttachment::NewL( CMsvAttachment::EMsvFile );
CleanupStack::PushL( info );
-
+
// Read attachment size
User::LeaveIfError( aFile.Size( fileSize ) );
info->SetSize( fileSize );
-
+
// Read attachment filename
User::LeaveIfError( aFile.FullName( fileName ) );
info->SetAttachmentNameL( fileName );
+
+ message->AttachmentManager().AddAttachmentL( aFile, info, waiter->iStatus );
+ CleanupStack::Pop( info ); // attachment manager takes ownership
- // Operation waiter needed to implement synchronous operation
- // on the top of async API
- CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewL();
- CleanupStack::PushL( waiter );
- message->AttachmentManager().AddAttachmentL( aFile, info, waiter->iStatus );
waiter->Start();
CleanupStack::PopAndDestroy( waiter );
- CleanupStack::Pop( info ); // attachment manager takes ownership
+
+ // Return message entry objects back to cache
+ CleanupStack::Pop( 2 ); // cEntry, message
+ ReturnMessageEntry( cEntry, message );
// Dig out the entry ID of the new attachment
- message->GetAttachmentsListL( cEntry->Entry().Id( ),
+ message->GetAttachmentsListL( cEntry->Entry().Id( ),
CImEmailMessage::EAllAttachments, CImEmailMessage::EThisMessageOnly );
TKeyArrayFix key( 0, ECmpTInt32 );
CMsvEntrySelection* attachmentIds = message->Selection().CopyLC();
@@ -1287,7 +1388,7 @@
}
TMsvId newAttachmentId = (*attachmentIds)[ attachmentIds->Count()-1 ];
CleanupStack::PopAndDestroy( attachmentIds );
-
+
// Meeting request related handling
TBool parentToMultipartAlternative( EFalse );
CMsvEntry* cAtta = iSession->GetEntryL( newAttachmentId );
@@ -1297,29 +1398,29 @@
TMsvEntry tEntry = cAtta->Entry();
tEntry.iDetails.Set( fileName );
cAtta->ChangeL( tEntry );
-
+
if( cAtta->HasStoreL() )
{
CMsvStore* store = cAtta->EditStoreL();
CleanupStack::PushL( store );
CImMimeHeader* mimeHeader = CImMimeHeader::NewLC();
-
+
if( store->IsPresentL( KUidMsgFileMimeHeader ) )
{
mimeHeader->RestoreL( *store );
CDesC8Array& array = mimeHeader->ContentTypeParams();
array.AppendL( KMethod );
parentToMultipartAlternative = ETrue;
-
+
if( aContentType.Find( KMimeTextCalRequest ) != KErrNotFound )
- {
+ {
array.AppendL( KRequest );
}
else if( aContentType.Find( KMimeTextCalResponse ) != KErrNotFound )
{
array.AppendL( KResponse );
}
- else if( aContentType.Find( KMimeTextCalCancel ) != KErrNotFound )
+ else if( aContentType.Find( KMimeTextCalCancel ) != KErrNotFound )
{
array.AppendL( KCancel );
}
@@ -1333,32 +1434,32 @@
CleanupStack::PopAndDestroy( 2, store );
}
if( parentToMultipartAlternative && fileName.Find( _L(".ics")) != KErrNotFound )
- {
+ {
TMsvEntry tAttaEntry = cAtta->Entry();
TMsvId id = tAttaEntry.Parent();
CMsvEntry* cParent = iSession->GetEntryL( id );
CleanupStack::PushL( cParent );
-
+
TMsvEmailEntry tEntry = cParent->Entry();
tEntry.SetMessageFolderType( EFolderTypeAlternative );
cParent->ChangeL( tEntry );
-
+
CleanupStack::PopAndDestroy( cParent );
}
CleanupStack::PopAndDestroy( cAtta );
-
- // Delete the message entries to get all the changes to disk and
+
+ // Delete the message entries to get all the changes to disk and
// possible store locks released
CleanCachedMessageEntries();
-
+
// Create the FS message part object and return it
- result = iMsgMapper->GetMessagePartL( newAttachmentId, aMailBoxId,
+ result = iMsgMapper->GetMessagePartL( newAttachmentId, aMailBoxId,
aMessageId );
return result;
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
CFSMailMessagePart* CIpsPlgSosBasePlugin::CopyMessageAsChildPartL(
const TFSMailMsgId& /* aMailBoxId */,
const TFSMailMsgId& /* aParentFolderId */,
@@ -1371,9 +1472,9 @@
}
// ----------------------------------------------------------------------------
-// Supports currently deletion of attachments and multipart structures
+// Supports currently deletion of attachments and multipart structures
// which are represented as folders in Symbian store)
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
//
void CIpsPlgSosBasePlugin::RemoveChildPartL(
const TFSMailMsgId& /* aMailBoxId */,
@@ -1388,26 +1489,36 @@
TMsvEntry tEntry;
TMsvId serviceId;
status = iSession->GetEntry( aPartId.Id(), serviceId, tEntry );
-
- if ( ( status == KErrNone ) &&
+
+ if ( ( status == KErrNone ) &&
( tEntry.iType == KUidMsvAttachmentEntry ) )
{
CImEmailMessage* message( NULL );
+
// We trust that the message ID really refers to a message
- GetMessageEntryL( aMessageId.Id(), cEntry, message );
-
- MMsvAttachmentManager& attachmentMgr( message->AttachmentManager() );
-
+
+ // Take ownership of message entry objects since thanks to
+ // "clever" use of active scheduler waits we can re-enter
+ // this function leading to crashes if somebody clears the cache
+ // while this iteration still needs them
+ TakeMessageEntryLC( aMessageId.Id(), cEntry, message );
+
+ MMsvAttachmentManager& attachmentMgr( message->AttachmentManager() );
+
CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewL();
CleanupStack::PushL( waiter );
-
- attachmentMgr.RemoveAttachmentL(
+
+ attachmentMgr.RemoveAttachmentL(
(TMsvAttachmentId) aPartId.Id(), waiter->iStatus );
-
+
waiter->Start();
CleanupStack::PopAndDestroy( waiter );
+
+ // Return message entry objects to cache
+ CleanupStack::Pop( 2 ); // cEntry, message
+ ReturnMessageEntry( cEntry, message );
}
- else if ( ( status == KErrNone ) &&
+ else if ( ( status == KErrNone ) &&
( tEntry.iType == KUidMsvFolderEntry ) )
{
cEntry = iSession->GetEntryL( tEntry.Parent() );
@@ -1452,13 +1563,13 @@
// ----------------------------------------------------------------------------
// The implementation supoorts the atachment and body parts at the moment.
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
//
-CFSMailMessagePart* CIpsPlgSosBasePlugin::MessagePartL(
+CFSMailMessagePart* CIpsPlgSosBasePlugin::MessagePartL(
const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& /* aParentFolderId */,
const TFSMailMsgId& aMessageId,
- const TFSMailMsgId& aMessagePartId)
+ const TFSMailMsgId& aMessagePartId)
{
FUNC_LOG;
CFSMailMessagePart* result( NULL );
@@ -1478,7 +1589,7 @@
const TFSMailMsgId& /* aParentFolderId */,
const TFSMailMsgId& /* aMessageId */,
const TFSMailMsgId& aMessagePartId,
- RFile& aFileHandle)
+ RFile& aFileHandle)
{
FUNC_LOG;
TInt status( KErrNone );
@@ -1488,30 +1599,30 @@
TBool hasStore = cEntry->HasStoreL();
if ( hasStore )
{
- //<qmail>
+//<qmail>
// We need to open store for edit to support multipart/alternative
// structure: we must have a possibility to modify text/html message part
//store = cEntry->ReadStoreL();
store = cEntry->EditStoreL();
- //</qmail>
+//</qmail>
}
-
+
if ( !store || !hasStore )
{
User::Leave( KErrNotFound );
}
CleanupStack::PushL( store );
MMsvAttachmentManager& attachmentMgr = store->AttachmentManagerL();
-
+
// It is assumed that the attachment file is always in the index 0
if ( attachmentMgr.AttachmentCount() )
{
- //<qmail>
+//<qmail>
// We need to open store for edit to support multipart/alternative
// structure: we must have a possibility to modify text/html message part
//aFileHandle = attachmentMgr.GetAttachmentFileL( 0 );
aFileHandle = attachmentMgr.GetAttachmentFileForWriteL( 0 );
- //</qmail>
+//</qmail>
}
else
{
@@ -1523,7 +1634,7 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
//
void CIpsPlgSosBasePlugin::CopyMessagePartFileL(
const TFSMailMsgId& /* aMailBoxId */,
@@ -1531,7 +1642,7 @@
const TFSMailMsgId& /*aMessageId*/,
const TFSMailMsgId& aMessagePartId,
const TDesC& aFilePath)
- {
+ {
FUNC_LOG;
//<qmail>
CMsvEntry* cEntry = iSession->GetEntryL( aMessagePartId.Id() );
@@ -1571,14 +1682,14 @@
// ----------------------------------------------------------------------------
// The method supports only reading of the plain text body currently.
-// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::GetContentToBufferL(
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::GetContentToBufferL(
const TFSMailMsgId& /* aMailBoxId */,
const TFSMailMsgId& /* aParentFolderId */,
const TFSMailMsgId& aMessageId,
const TFSMailMsgId& aMessagePartId,
TDes& aBuffer,
- const TUint aStartOffset)
+ const TUint aStartOffset)
{
FUNC_LOG;
CMsvEntry* cEntry( NULL );
@@ -1590,7 +1701,7 @@
{
message->GetBodyTextEntryIdL(
cEntry->Entry().Id(), CImEmailMessage::EThisMessageOnly );
-
+
if ( message->Selection().Count() > 0 )
{
// Check whether the body text is requested
@@ -1600,17 +1711,17 @@
CleanupStack::PushL(globalParaLayer);
CCharFormatLayer* globalCharLayer = CCharFormatLayer::NewL();
CleanupStack::PushL(globalCharLayer);
-
+
CRichText* bodyText = CRichText::NewL(
- globalParaLayer, globalCharLayer);
+ globalParaLayer, globalCharLayer);
CleanupStack::PushL( bodyText );
-
- message->GetBodyTextL(
+
+ message->GetBodyTextL(
aMessageId.Id(), CImEmailMessage::EThisMessageOnly,
*bodyText, *globalParaLayer, *globalCharLayer );
-
+
bodyText->Extract( aBuffer, aStartOffset, aBuffer.MaxLength() );
-
+
CleanupStack::PopAndDestroy(bodyText);
CleanupStack::PopAndDestroy(globalCharLayer);
CleanupStack::PopAndDestroy(globalParaLayer);
@@ -1618,9 +1729,9 @@
}
}
}
-
+
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::SetContentL(
const TDesC& aBuffer,
const TFSMailMsgId& /* aMailBoxId */,
@@ -1630,7 +1741,7 @@
{
FUNC_LOG;
- //<qmail>
+//<qmail> Rewritten in Qmail: CIpsPlgOperationWait is no longer used
// Notice that SetContentL sets only the content of text/plain message part:
// text/html part can be modified directly using GetMessagePartFileL
CMsvEntry* cEntry( NULL );
@@ -1656,21 +1767,68 @@
CleanupStack::PopAndDestroy( 4, store );
}
CleanupStack::PopAndDestroy(cEntry);
- //</qmail>
+//</qmail>
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::RemovePartContentL(
const TFSMailMsgId& /* aMailBoxId */,
const TFSMailMsgId& /* aParentFolderId */,
const TFSMailMsgId& /* aMessageId */,
- const RArray<TFSMailMsgId>& /* aPartIds */)
+ const RArray<TFSMailMsgId>& aPartIds )
{
+ TInt count( aPartIds.Count() );
+
+ for( TInt i(0); i < count; i++ )
+ {
+ CMsvEntry* cEntry = iSession->GetEntryL( aPartIds[i].Id() );
+ CleanupStack::PushL( cEntry );
+ CMsvStore* store = NULL;
+ TBool hasStore = cEntry->HasStoreL();
+ if ( hasStore )
+ {
+ store = cEntry->EditStoreL();
+ }
+
+ if ( !store || !hasStore )
+ {
+ User::Leave( KErrNotFound );
+ }
+ CleanupStack::PushL( store );
+ MMsvAttachmentManager& attachmentMgr = store->AttachmentManagerL();
+
+ // It is assumed that the attachment file is always in the index 0
+ if ( attachmentMgr.AttachmentCount() )
+ {
+ // delete attachment file
+ CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewLC();
+ attachmentMgr.RemoveAttachmentL( 0, waiter->iStatus );
+ waiter->Start();
+ CleanupStack::PopAndDestroy( waiter );
+ store->CommitL();
+
+ // clear complete flag
+ TMsvEntry tEntry( cEntry->Entry() );
+ tEntry.SetComplete( EFalse );
+
+ waiter = CIpsPlgOperationWait::NewLC();
+ CMsvOperation* ops = cEntry->ChangeL( tEntry, waiter->iStatus );
+ CleanupStack::PushL( ops );
+ waiter->Start();
+ CleanupStack::PopAndDestroy( 2, waiter );
+ }
+ else
+ {
+ User::Leave( KErrNotFound );
+ }
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( cEntry );
+ }
}
-
+
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::SetPartContentFromFileL(
const TFSMailMsgId& /* aMailBoxId */,
const TFSMailMsgId& /* aParentFolderId */,
@@ -1681,7 +1839,7 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::StoreMessagePartL(
const TFSMailMsgId& /* aMailBoxId */,
const TFSMailMsgId& /* aParentFolderId */,
@@ -1716,7 +1874,27 @@
void CIpsPlgSosBasePlugin::UnregisterRequestObserver( TInt /* aRequestId */)
{
}
-
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::SendL(TFSMailMsgId aMessageId )
+ {
+ FUNC_LOG;
+ CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
+ CleanupStack::PushL(watcher);
+// <qmail>
+ CIpsPlgSmtpOperation* op = CIpsPlgSmtpOperation::NewLC(
+ *iSession, watcher->iStatus );
+// </qmail>
+ op->SetEventHandler(iEventHandler);
+ watcher->SetOperation(op);
+ CleanupStack::Pop( op ); // op added as member of watcher
+ op->StartSendL( aMessageId.Id() );
+ iOperations.AppendL(watcher);
+ CleanupStack::Pop( watcher );
+ }
+
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::SendMessageL( CFSMailMessage& /*aMessage*/ )
@@ -1766,12 +1944,13 @@
// </qmail>
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
TFSProgress CIpsPlgSosBasePlugin::StatusL( TInt aRequestId )
{
FUNC_LOG;
TFSProgress status;
- status.iProgressStatus = TFSProgress::EFSStatus_RequestComplete;
+ status.iError = KErrNone;
+ status.iProgressStatus = TFSProgress::EFSStatus_RequestComplete;
for ( TInt i = 0; i < iOperations.Count(); i++ )
{
const CIpsPlgBaseOperation* op = iOperations[i]->BaseOperation();
@@ -1784,8 +1963,8 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::CancelL(TInt aRequestId)
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::CancelL(TInt aRequestId)
{
FUNC_LOG;
const TInt count = iOperations.Count();
@@ -1803,58 +1982,58 @@
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::SearchL(
+void CIpsPlgSosBasePlugin::SearchL(
const TFSMailMsgId& aMailBoxId,
const RArray<TFSMailMsgId>& aFolderIds,
const RPointerArray<TDesC>& aSearchStrings,
const TFSMailSortCriteria& aSortCriteria,
- MFSMailBoxSearchObserver& aSearchObserver )
+ MFSMailBoxSearchObserver& aSearchObserver )
{
FUNC_LOG;
- iSearch->SearchL(
+ iSearch->SearchL(
aMailBoxId,
aFolderIds,
aSearchStrings,
aSortCriteria,
aSearchObserver );
}
-
+
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::CancelSearch( const TFSMailMsgId& /* aMailBoxId */ )
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::CancelSearch( const TFSMailMsgId& /* aMailBoxId */ )
{
FUNC_LOG;
iSearch->Cancel();
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::ClearSearchResultCache(
- const TFSMailMsgId& /* aMailBoxId */ )
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::ClearSearchResultCache(
+ const TFSMailMsgId& /* aMailBoxId */ )
{
FUNC_LOG;
iSearch->ClearCache();
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::AddObserverL(MFSMailEventObserver& aObserver)
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::AddObserverL(MFSMailEventObserver& aObserver)
{
FUNC_LOG;
iEventHandler->AddPluginObserverL( &aObserver );
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::RemoveObserver(MFSMailEventObserver& aObserver)
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::RemoveObserver(MFSMailEventObserver& aObserver)
{
//don't delete. we don't own this.
iEventHandler->RemovePluginObserver( &aObserver );
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::DeleteMessagesByUidL(
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::DeleteMessagesByUidL(
const TFSMailMsgId& /*aMailBoxId*/,
const TFSMailMsgId& /*aFolderId*/,
const RArray<TFSMailMsgId>& aMessages )
@@ -1862,7 +2041,7 @@
FUNC_LOG;
CMsvEntrySelection* sel=new(ELeave) CMsvEntrySelection;
CleanupStack::PushL(sel);
-
+
TInt count = aMessages.Count();
TMsvEntry tEntry;
TMsvId service;
@@ -1881,28 +2060,34 @@
CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL( *this );
CleanupStack::PushL( watcher );
- CMsvOperation* op = CIpsPlgDeleteRemote::NewL( *iSession,
- watcher->iStatus, *sel );
+ //<qmail>
+ CMsvOperation* op = CIpsPlgDeleteOperation::NewL( *iSession,
+ watcher->iStatus, sel );
+ //</qmail>
watcher->SetOperation( op );
iOperations.AppendL( watcher );
CleanupStack::Pop( watcher );
- CleanupStack::PopAndDestroy( sel );
+ //<qmail>
+ CleanupStack::Pop( sel );
+ //</qmail>
}
-
+
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::SubscribeMailboxEventsL(
const TFSMailMsgId& aMailboxId,
MFSMailEventObserver& aObserver)
{
FUNC_LOG;
+// <qmail>
TUint32 key(0);
-
+// </qmail>
+
iEventHandler->SubscribeMailboxEventsL( aMailboxId, aObserver, key );
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::UnsubscribeMailboxEvents(
const TFSMailMsgId& aMailboxId,
MFSMailEventObserver& aObserver)
@@ -1912,7 +2097,7 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
TSSMailSyncState CIpsPlgSosBasePlugin::CurrentSyncState(
const TFSMailMsgId& aMailBoxId )
{
@@ -1926,20 +2111,22 @@
{
FUNC_LOG;
TInt error = KErrNone;
-
+// <qmail> iSettingsApi not available in Qmail
+ /*error = iSettingsApi->HandleMailboxCreation( MtmId(), *iSession );
if ( error == KErrNotSupported )
{
// this means that wizard data is not meaned for this plugin (instance)
// just return KErrNone at the moment
return KErrNone;
- }
+ }*/
+// </qmail>
return error;
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-TInt CIpsPlgSosBasePlugin::GetConnectionId(
- TFSMailMsgId /*aMailBoxId*/,
+TInt CIpsPlgSosBasePlugin::GetConnectionId(
+ TFSMailMsgId /*aMailBoxId*/,
TUint32& /*aConnectionId*/ )
{
return KErrNotSupported;
@@ -1947,8 +2134,8 @@
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-TInt CIpsPlgSosBasePlugin::IsConnectionAllowedWhenRoaming(
- TFSMailMsgId /*aMailBoxId*/,
+TInt CIpsPlgSosBasePlugin::IsConnectionAllowedWhenRoaming(
+ TFSMailMsgId /*aMailBoxId*/,
TBool& /*aConnectionAllowed*/ )
{
return KErrNotSupported;
@@ -1962,9 +2149,9 @@
TInt /* aRequestId */)
{
}
-
+
// ----------------------------------------------------------------------------
-// method sets authentication popup data
+// method sets authentication popup data
// ----------------------------------------------------------------------------
//
void CIpsPlgSosBasePlugin::SetCredentialsL( const TFSMailMsgId& /*aMailBoxId*/,
@@ -1999,11 +2186,11 @@
// ----------------------------------------------------------------------------
// CIpsPlgSosBasePlugin::GetMessageEntryL( )
-// Checks whether the requested message is already cached. If not, the cached
+// Checks whether the requested message is already cached. If not, the cached
// objects are deleted and new objects are created.
// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::GetMessageEntryL(
- TMsvId aId,
+void CIpsPlgSosBasePlugin::GetMessageEntryL(
+ TMsvId aId,
CMsvEntry*& aMessageEntry,
CImEmailMessage*& aImEmailMessage )
{
@@ -2012,7 +2199,7 @@
iCachedEmailMessage->IsActive() )
{
CleanCachedMessageEntries();
-
+
iCachedEntry = iSession->GetEntryL( aId );
if ( iCachedEntry->Entry().iType == KUidMsvMessageEntry )
{
@@ -2023,6 +2210,60 @@
aImEmailMessage = iCachedEmailMessage;
}
+
+// ----------------------------------------------------------------------------
+// CIpsPlgSosBasePlugin::TakeMessageEntryL( )
+// Takes ownership of the cached objects or creates new ones
+// ----------------------------------------------------------------------------
+
+void CIpsPlgSosBasePlugin::TakeMessageEntryLC(
+ TMsvId aId,
+ CMsvEntry*& aMessageEntry,
+ CImEmailMessage*& aImEmailMessage )
+ {
+ FUNC_LOG;
+ if ( !iCachedEntry || ( aId != iCachedEntry->Entry().Id() ) ||
+ iCachedEmailMessage->IsActive() )
+ {
+ // Can't use the ones that are in cache, create new ones and don't replace the ones in cache
+ aMessageEntry = iSession->GetEntryL( aId );
+ aImEmailMessage = 0;
+
+ if ( aMessageEntry->Entry().iType == KUidMsvMessageEntry )
+ {
+ CleanupStack::PushL( aMessageEntry );
+ aImEmailMessage = CImEmailMessage::NewL( *aMessageEntry );
+ CleanupStack::Pop();
+ }
+ }
+ else
+ {
+ // Take ownership of the cached objects
+ aMessageEntry = iCachedEntry;
+ aImEmailMessage = iCachedEmailMessage;
+ iCachedEntry = 0;
+ iCachedEmailMessage = 0;
+ }
+
+ // Ownership is transferred to the caller
+ CleanupStack::PushL( aMessageEntry );
+ CleanupStack::PushL( aImEmailMessage );
+ }
+
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::ReturnMessageEntry(
+ CMsvEntry* aMessageEntry,
+ CImEmailMessage* aImEmailMessage )
+ {
+ // Clean old ones from the cache
+ CleanCachedMessageEntries();
+
+ // Always save the latest ones in the cache
+ iCachedEntry = aMessageEntry;
+ iCachedEmailMessage = aImEmailMessage;
+ }
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//
@@ -2034,22 +2275,22 @@
delete iCachedEntry;
iCachedEntry = NULL;
}
-
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-TFSFolderType CIpsPlgSosBasePlugin::GetFolderType(
+TFSFolderType CIpsPlgSosBasePlugin::GetFolderType(
CMsvEntry* aEntry,
TFSMailMsgId aFolderId )
{
FUNC_LOG;
TFSFolderType folderType( EFSOther );
-
+
if( ( aEntry->Entry().iDetails.CompareF( KIpsPlgInbox ) == 0 ) &&
( aEntry->Entry().iType == KUidMsvFolderEntry ) )
{
folderType = EFSInbox;
}
- else if( ( aEntry->Entry().iMtm == KSenduiMtmPop3Uid ) &&
+ else if( ( aEntry->Entry().iMtm == KSenduiMtmPop3Uid ) &&
( aEntry->Entry().iType == KUidMsvServiceEntry ) &&
( aEntry->Entry().iServiceId == aFolderId.Id() ) )
{
@@ -2079,7 +2320,7 @@
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
CIpsPlgTimerOperation& CIpsPlgSosBasePlugin::ActivityTimerL(
const TFSMailMsgId& aMailBoxId )
{
@@ -2092,7 +2333,7 @@
timer = iActivitytimers[i];
}
}
-
+
if ( !timer )
{
// No timer for mailbox found create new
@@ -2101,19 +2342,19 @@
User::LeaveIfError( iActivitytimers.Append( timer ) );
CleanupStack::Pop( timer );
}
- return *timer;
+ return *timer;
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
CIpsPlgSyncStateHandler& CIpsPlgSosBasePlugin::GetSyncStateHandler()
{
return *iSyncStateHandler;
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::CancelAllOnlineOperations(
+// ----------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::CancelAllOnlineOperations(
const TFSMailMsgId& aMailboxId )
{
FUNC_LOG;
@@ -2131,43 +2372,96 @@
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::DeleteAndRemoveOperation(
+void CIpsPlgSosBasePlugin::DeleteAndRemoveOperation(
const TInt aOpArrayIndex, TInt aCompleteCode )
{
FUNC_LOG;
CIpsPlgSingleOpWatcher* opWatcher = iOperations[aOpArrayIndex];
- // <qmail> removed; does nothing
+// <qmail> removed; does nothing
// The operations matches, handle it in protocol plugin...if needed.
//TRAP_IGNORE( HandleOpCompletedL( *opWatcher, aCompleteCode ) );
- // </qmail>
+// </qmail>
const CIpsPlgBaseOperation* op = opWatcher->BaseOperation();
TMsvId service = KErrNotFound;
TUint pluginId = PluginId();
- if ( op && (
+ if ( op && (
op->IpsOpType() == EIpsOpTypeImap4SyncOp ||
- op->IpsOpType() == EIpsOpTypePop3SyncOp ||
+ op->IpsOpType() == EIpsOpTypePop3SyncOp ||
op->IpsOpType() == EIpsOpTypeImap4PopulateOp ) )
{
service = op->Service();
- }
+ }
iOperations.Remove( aOpArrayIndex );
delete opWatcher;
opWatcher = NULL;
// need to remove operation first because after signaling
- // sync complete mailbox status is asked immediatelly
+ // sync complete mailbox status is asked immediatelly
// and function checks connects ops also (see GetMailBoxStatus)
- if ( service != KErrNotFound )
+ if ( service != KErrNotFound )
{
- iEventHandler->SetNewPropertyEvent(
+ iEventHandler->SetNewPropertyEvent(
service, KIpsSosEmailSyncCompleted, aCompleteCode );
}
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
-void CIpsPlgSosBasePlugin::DisconnectL(
- const TFSMailMsgId& aMailBoxId,
+void CIpsPlgSosBasePlugin::FixReplyForwardHeaderL(
+ CFSMailMessage* aMessage,
+ const TFSMailMsgId& aMailBoxId,
+ const TFSMailMsgId& aOriginalMessageId,
+ const TDesC& aHeaderDescriptor )
+ {
+ FUNC_LOG;
+ CFSMailMessagePart* textBodyPart = aMessage->PlainTextBodyPartL();
+ if ( textBodyPart )
+ {
+ CleanupStack::PushL( textBodyPart );
+ CFSMailMessage* origMsg = GetMessageByUidL(
+ aMailBoxId,
+ TFSMailMsgId(),
+ aOriginalMessageId,
+ EFSMsgDataStructure );
+ if ( origMsg )
+ {
+ CleanupStack::PushL( origMsg );
+ CFSMailMessagePart* origMsgTextBodyPart =
+ origMsg->PlainTextBodyPartL();
+ if ( origMsgTextBodyPart )
+ {
+ CleanupStack::PushL( origMsgTextBodyPart );
+ // Use the content provided in aHeaderDescriptor
+ // instead of what is provided by
+ // CreateForwardSmtpMessage..
+ TPckgBuf<TReplyForwardParams> pckg;
+ pckg.Copy( aHeaderDescriptor );
+ TPtr hPtr( pckg().iHeader->Des() );
+ HBufC* body = HBufC::NewLC(
+ textBodyPart->FetchedContentSize() );
+ TPtr bPtr( body->Des() );
+ origMsgTextBodyPart->GetContentToBufferL( bPtr, 0 );
+ HBufC* content = HBufC::NewLC(
+ hPtr.Length() + bPtr.Length() );
+ TPtr cPtr( content->Des() );
+ cPtr.Append( hPtr );
+ cPtr.Append( bPtr );
+ textBodyPart->SetContent( cPtr );
+ textBodyPart->SaveL();
+ CleanupStack::PopAndDestroy( content );
+ CleanupStack::PopAndDestroy( body );
+ CleanupStack::PopAndDestroy( origMsgTextBodyPart );
+ }
+ CleanupStack::PopAndDestroy( origMsg );
+ }
+ CleanupStack::PopAndDestroy( textBodyPart );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+void CIpsPlgSosBasePlugin::DisconnectL(
+ const TFSMailMsgId& aMailBoxId,
MFSMailRequestObserver& aObserver,
const TInt aRequestId,
TBool /*aRemoveAccountAlso*/ )
@@ -2177,9 +2471,9 @@
TMsvEntry tEntry;
TMsvId serv;
iSession->GetEntry( service, serv, tEntry );
-
+
if ( tEntry.Connected() )
- {
+ {
CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
CleanupStack::PushL( watcher );
@@ -2201,10 +2495,10 @@
watcher->SetOperation( op );
CleanupStack::PopAndDestroy( sel );
- iOperations.AppendL( watcher );
+ iOperations.AppendL( watcher );
CleanupStack::Pop( watcher );
}
- }
+ }
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
@@ -2213,7 +2507,7 @@
FUNC_LOG;
for ( TInt i = 0; i < iActivitytimers.Count(); i++ )
{
- // do not disconnect automatically mailboxes that are set to
+ // do not disconnect automatically mailboxes that are set to
// "connected"
if ( iActivitytimers[i]->FSMailboxId().Id() == aMailboxId.Id() )
{
@@ -2222,9 +2516,9 @@
}
}
}
-
+
// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::RequestResponseL(
TFSProgress /*aEvent*/,
TInt /*aRequestId*/ )
@@ -2232,15 +2526,16 @@
}
// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::EmptyOutboxL( const TFSMailMsgId& aMailBoxId )
{
FUNC_LOG;
CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
CleanupStack::PushL(watcher);
- // <qmail>
+// <qmail>
CIpsPlgSmtpOperation* op = CIpsPlgSmtpOperation::NewLC( *iSession, watcher->iStatus );
- // </qmail>
+// </qmail>
+ op->SetEventHandler(iEventHandler);
watcher->SetOperation(op);
op->EmptyOutboxFromPendingMessagesL( aMailBoxId.Id() );
iOperations.AppendL(watcher);
@@ -2253,37 +2548,37 @@
TInt& /*aReason*/ )
{
FUNC_LOG;
-#ifdef __WINS__
+#ifdef __WINS__
return ETrue;
#endif
TBool ret=ETrue;
//check offline mode. If set, we can't connect.
ret = !OfflineModeSetL();
if( ret )
- {
+ {
ret = RoamingCheckL();
}
return ret;
}
// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
TBool CIpsPlgSosBasePlugin::IsUnderUiProcess()
{
return iIsUnderUiProcess;
}
// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
TBool CIpsPlgSosBasePlugin::OfflineModeSetL()
{
FUNC_LOG;
- return !LocalFeatureL( KCRUidCoreApplicationUIs,
- KCoreAppUIsNetworkConnectionAllowed, 1 );
- }
+ return !LocalFeatureL( KCRUidCoreApplicationUIs,
+ KCoreAppUIsNetworkConnectionAllowed, 1 );
+ }
// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
TBool CIpsPlgSosBasePlugin::LocalFeatureL(
const TUid& aCenRepUid,
const TUint32 aKeyId,
@@ -2307,15 +2602,15 @@
// Return the result as a boolean value
return ( flags & aFlag ) == aFlag;
}
-
+
// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
TBool CIpsPlgSosBasePlugin::RoamingCheckL()
{
FUNC_LOG;
//first check our registration status
TInt regStatus = RegistrationStatusL();
-
+
if ( regStatus == ENetworkRegistrationHomeNetwork )
{
return ETrue;
@@ -2333,9 +2628,9 @@
return EFalse;
}
}
-
+
// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
TInt CIpsPlgSosBasePlugin::RegistrationStatusL()
{
FUNC_LOG;
@@ -2344,69 +2639,63 @@
//check network status
iConMon.ConnectL();
-
+
iConMon.GetIntAttribute(
- EBearerIdGSM, 0, KNetworkRegistration,
+ EBearerIdGSM, 0, KNetworkRegistration,
registrationStatus, status );
User::WaitForRequest( status ); // faulty CS warning
-
+
iConMon.Close();
-
- return registrationStatus;
+
+ return registrationStatus;
}
// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-//
-void CIpsPlgSosBasePlugin::BlockCopyMoveFromFoldersL(
- CMsvEntry* aFolderEntry,
- TFSMailMsgId aFolderId,
+// ---------------------------------------------------------------------------
+//
+void CIpsPlgSosBasePlugin::BlockCopyMoveFromFoldersL(
+ CMsvEntry* aFolderEntry,
+ TFSMailMsgId aFolderId,
CFSMailFolder& aFSMailFolder )
{
FUNC_LOG;
- RArray<TFSFolderType> blockFoldersOnline;
- CleanupClosePushL( blockFoldersOnline );
- RArray<TFSFolderType> blockFoldersOffline;
- CleanupClosePushL( blockFoldersOffline );
+ // Currently IPS plugin can connect automatically when doing the actual
+ // move/copy operation, so no need to block offline moves separately
+ RArray<TFSFolderType> blockFolders;
+ CleanupClosePushL( blockFolders );
+
// Move/Copy operations only between remote folders (+ IMAP Inbox) and
// Outbox -> Drafts, block others.
- blockFoldersOnline.Reset();
- blockFoldersOffline.Reset();
-
+ blockFolders.Reset();
+
if( ( GetFolderType( aFolderEntry, aFolderId ) != EFSOther ) &&
( GetFolderType( aFolderEntry, aFolderId ) != EFSInbox ) )
{
- blockFoldersOnline.Append( EFSInbox );
- blockFoldersOnline.Append( EFSOther );
+ blockFolders.Append( EFSInbox );
+ blockFolders.Append( EFSOther );
}
if( GetFolderType( aFolderEntry, aFolderId ) != EFSDraftsFolder )
{
- blockFoldersOnline.Append( EFSOutbox );
- blockFoldersOffline.Append( EFSOutbox );
+ blockFolders.Append( EFSOutbox );
}
- blockFoldersOnline.Append( EFSSentFolder );
- blockFoldersOnline.Append( EFSDraftsFolder );
- blockFoldersOnline.Append( EFSDeleted );
- blockFoldersOffline.Append( EFSSentFolder );
- blockFoldersOffline.Append( EFSDraftsFolder );
- blockFoldersOffline.Append( EFSDeleted );
- blockFoldersOffline.Append( EFSInbox );
- blockFoldersOffline.Append( EFSOther );
-
- // Block move/copy to this folder from blocklist
- aFSMailFolder.BlockCopyFromL( blockFoldersOnline, EFSMailBoxOnline );
- aFSMailFolder.BlockMoveFromL( blockFoldersOnline, EFSMailBoxOnline );
- aFSMailFolder.BlockCopyFromL( blockFoldersOffline, EFSMailBoxOffline );
- aFSMailFolder.BlockMoveFromL( blockFoldersOffline, EFSMailBoxOffline );
-
- CleanupStack::PopAndDestroy( &blockFoldersOffline );
- CleanupStack::PopAndDestroy( &blockFoldersOnline );
+ blockFolders.Append( EFSSentFolder );
+ blockFolders.Append( EFSDraftsFolder );
+ blockFolders.Append( EFSDeleted );
+
+ // Block move/copy to this folder from blocklist, same blocklist
+ // applies to both online and offline moves/copies
+ aFSMailFolder.BlockCopyFromL( blockFolders, EFSMailBoxOnline );
+ aFSMailFolder.BlockMoveFromL( blockFolders, EFSMailBoxOnline );
+ aFSMailFolder.BlockCopyFromL( blockFolders, EFSMailBoxOffline );
+ aFSMailFolder.BlockMoveFromL( blockFolders, EFSMailBoxOffline );
+
+ CleanupStack::PopAndDestroy( &blockFolders );
}
// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
void CIpsPlgSosBasePlugin::StoreIMEIToMailboxL( const TMsvId aMailboxId )
{
FUNC_LOG;
@@ -2426,19 +2715,7 @@
TBool CIpsPlgSosBasePlugin::ConnOpRunning( const TFSMailMsgId& aMailBoxId )
{
FUNC_LOG;
- for ( TInt i = 0; i < iOperations.Count(); i++ )
- {
- const CIpsPlgBaseOperation* baseOp = iOperations[i]->BaseOperation();
-
- if ( baseOp && baseOp->FSMailboxId() == aMailBoxId &&
- ( baseOp->IpsOpType() == EIpsOpTypePop3SyncOp
- || baseOp->IpsOpType() == EIpsOpTypeImap4SyncOp
- || baseOp->IpsOpType() == EIpsOpTypeImap4PopulateOp ) )
- {
- return ETrue;
- }
- }
- return EFalse;
+ return iSyncStateHandler->ConnOpRunning( aMailBoxId );
}
// ---------------------------------------------------------------------------
@@ -2451,6 +2728,7 @@
TMsvEntry tEntry;
TMsvId service;
iSession->GetEntry( aMailboxId.Id(), service, tEntry );
+// <qmail> iSettingsApi removed
}
// ---------------------------------------------------------------------------
@@ -2484,8 +2762,28 @@
if ( iActivitytimers[j]->FSMailboxId() == aMailboxId )
{
delete iActivitytimers[j];
+ iActivitytimers[j] = NULL;
iActivitytimers.Remove( j );
+ timerCount--;
+ j--;
}
}
}
+// <qmail> new function
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+TBool CIpsPlgSosBasePlugin::HasOperations( const TFSMailMsgId& aMailboxId )
+ {
+ FUNC_LOG;
+ TBool ret( EFalse );
+ for ( TInt i = 0; i < iOperations.Count(); i++ )
+ {
+ if( iOperations[i]->BaseOperation()->FSMailboxId() == aMailboxId )
+ {
+ ret = ETrue;
+ }
+ }
+ return ret;
+ }
+// </qmail>