--- a/emailservices/emailstore/message_store/client/src/MessageStoreClient.cpp Tue Feb 02 00:02:40 2010 +0200
+++ b/emailservices/emailstore/message_store/client/src/MessageStoreClient.cpp Fri Feb 19 22:37:30 2010 +0200
@@ -22,7 +22,7 @@
// ========
#include <e32svr.h>
-#include <S32MEM.H>
+#include <s32mem.h>
//#include <MessageStoreClient.h>
//<cmail>
#include "msgstoretypes.h"
@@ -30,12 +30,12 @@
//</cmail>
#include "MessageStoreClientServer.h"
-#include "EmailStoreUids.hrh"
+#include "emailstoreuids.hrh"
#include "PropertiesSerializer.h"
-#include "MsgStoreFolder.h"
-#include "MsgStoreObserver.h"
-#include "MsgStorePropertyContainerWithContent.h"
-#include "MsgStoreSessionContext.h"
+#include "msgstorefolder.h"
+#include "msgstoreobserver.h"
+#include "msgstorepropertycontainerwithcontent.h"
+#include "msgstoresessioncontext.h"
// =========
// CONSTANTS
@@ -46,34 +46,34 @@
/** This class defines the message store search client API.
- This class is used to notify the search client of the completion of an asynchronous search of the
- message store.
+ This class is used to notify the search client of the completion of an asynchronous search of the
+ message store.
*/
class MMsgStoreSearchClient
- {
- public:
+ {
+ public:
- virtual void MatchFound( TMsgStoreId aMessageId ) = 0;
-
- virtual void SearchCompleted() = 0;
-
- }; // end class MMsgStoreSearchClient
+ virtual void MatchFound( TMsgStoreId aMessageId ) = 0;
+
+ virtual void SearchCompleted() = 0;
+
+ }; // end class MMsgStoreSearchClient
/** This class defines the message store quick property client API.
- This class is used to notify the client when a quick property is ready to be processed, or
+ This class is used to notify the client when a quick property is ready to be processed, or
to notify the client something has changed, restart building the list
*/
class MMsgStoreQuickPropertyClient
- {
- public:
+ {
+ public:
- virtual void ProcessQuickProperty( const CMsgStorePropertyContainer& aContainer ) = 0;
-
- virtual void Reset() = 0;
-
- }; // end class MMsgStoreSearchClient
+ virtual void ProcessQuickProperty( const CMsgStorePropertyContainer& aContainer ) = 0;
+
+ virtual void Reset() = 0;
+
+ }; // end class MMsgStoreSearchClient
@@ -84,10 +84,10 @@
{
public:
- // ==============
- // PUBLIC METHODS
- // ==============
-
+ // ==============
+ // PUBLIC METHODS
+ // ==============
+
TPropertyContainerProxy( MMsgStoreQuickPropertyClient& aClient );
// inherited from MPropertiesArray
@@ -96,10 +96,10 @@
private:
- // ==================
- // PRIVATE ATTRIBUTES
- // ==================
-
+ // ==================
+ // PRIVATE ATTRIBUTES
+ // ==================
+
MMsgStoreQuickPropertyClient& iClient;
}; // end class TPropertyContainerProxy
@@ -118,209 +118,209 @@
// FUNCTION: CopyAttachmentL
// ==========================================================================
EXPORT_C TMsgStoreId CMsgStoreSession::CopyAttachmentL( TMsgStoreId aAttachmentId,
- TMsgStoreId aSourceMessageId,
- TMsgStoreId aSourceFolderId,
- TMsgStoreId aDestinationMessageId,
- TMsgStoreId aDestinationFolderId )
- {
- iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits );
- iContext->VerifyTypeL( aSourceMessageId, EMsgStoreMessageBits );
- iContext->VerifyTypeL( aSourceFolderId, EMsgStoreFolderBits );
- iContext->VerifyTypeL( aDestinationMessageId, EMsgStoreMessageBits );
- iContext->VerifyTypeL( aDestinationFolderId, EMsgStoreFolderBits );
-
- return iContext->iSession.CopyContainerL( aAttachmentId,
- aSourceMessageId,
- aSourceFolderId,
- aDestinationMessageId,
- aDestinationFolderId );
- } // end CopyAttachmentL
+ TMsgStoreId aSourceMessageId,
+ TMsgStoreId aSourceFolderId,
+ TMsgStoreId aDestinationMessageId,
+ TMsgStoreId aDestinationFolderId )
+ {
+ iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits );
+ iContext->VerifyTypeL( aSourceMessageId, EMsgStoreMessageBits );
+ iContext->VerifyTypeL( aSourceFolderId, EMsgStoreFolderBits );
+ iContext->VerifyTypeL( aDestinationMessageId, EMsgStoreMessageBits );
+ iContext->VerifyTypeL( aDestinationFolderId, EMsgStoreFolderBits );
+
+ return iContext->iSession.CopyContainerL( aAttachmentId,
+ aSourceMessageId,
+ aSourceFolderId,
+ aDestinationMessageId,
+ aDestinationFolderId );
+ } // end CopyAttachmentL
// ==========================================================================
// FUNCTION: QuickMessagePropertiesL
// ==========================================================================
EXPORT_C void CMsgStoreSession::QuickMessagePropertiesL( TMsgStoreId aFolderId, RPointerArray<CMsgStorePropertyContainer>& aQuickProperties )
- {
- iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
-
- TPropertyContainersArray containersArray( aQuickProperties );
-
- iContext->iSession.ChildrenPropertiesL( aFolderId, // aId
- KMsgStoreInvalidId, // aParentId (do not need to check parent ID)
- EMsgStoreMessageBits, // aContainerType
- ETrue, // aQuickProperties
- EFalse, // aRecursive
- containersArray );
- } // end QuickMessagePropertiesL
-
+ {
+ iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
+
+ TPropertyContainersArray containersArray( aQuickProperties );
+
+ iContext->iSession.ChildrenPropertiesL( aFolderId, // aId
+ KMsgStoreInvalidId, // aParentId (do not need to check parent ID)
+ EMsgStoreMessageBits, // aContainerType
+ ETrue, // aQuickProperties
+ EFalse, // aRecursive
+ containersArray );
+ } // end QuickMessagePropertiesL
+
// ==========================================================================
// FUNCTION: QuickMessagePropertiesL overloaded
// ==========================================================================
EXPORT_C void CMsgStoreSession::QuickMessagePropertiesL( TMsgStoreId aFolderId, MMsgStoreQuickPropertyClient& aClient )
- {
- iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
-
- TPropertyContainerProxy containerProxy( aClient );
-
- iContext->iSession.ChildrenPropertiesL( aFolderId, // aId
- KMsgStoreInvalidId, // aParentId (do not need to check parent ID)
- EMsgStoreMessageBits, // aContainerType
- ETrue, // aQuickProperties
- EFalse, // aRecursive
- containerProxy );
- } // end QuickMessagePropertiesL
+ {
+ iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
+
+ TPropertyContainerProxy containerProxy( aClient );
+
+ iContext->iSession.ChildrenPropertiesL( aFolderId, // aId
+ KMsgStoreInvalidId, // aParentId (do not need to check parent ID)
+ EMsgStoreMessageBits, // aContainerType
+ ETrue, // aQuickProperties
+ EFalse, // aRecursive
+ containerProxy );
+ } // end QuickMessagePropertiesL
// ==========================================================================
// FUNCTION: AttachmentsL
// ==========================================================================
EXPORT_C void CMsgStoreSession::AttachmentsL( TMsgStoreId aMessageId,
- TMsgStoreId aFolderId,
- RPointerArray<CMsgStoreAttachment>& aAttachmentsList )
- {
- iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits );
- iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
+ TMsgStoreId aFolderId,
+ RPointerArray<CMsgStoreAttachment>& aAttachmentsList )
+ {
+ iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits );
+ iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
-// TAttachmentsArray attachmentsArray( *iContext, aAttachmentsList );
-
- iContext->iSession.ChildrenPropertiesL( aMessageId, // aId
- aFolderId, // aParentId
- EMsgStoreAttachmentBits, // aContainerType
- EFalse, // aQuickProperties
- EFalse, // aRecursive
- attachmentsArray );
- } // end AttachmentsL
+// TAttachmentsArray attachmentsArray( *iContext, aAttachmentsList );
+
+ iContext->iSession.ChildrenPropertiesL( aMessageId, // aId
+ aFolderId, // aParentId
+ EMsgStoreAttachmentBits, // aContainerType
+ EFalse, // aQuickProperties
+ EFalse, // aRecursive
+ attachmentsArray );
+ } // end AttachmentsL
// ==========================================================================
// FUNCTION: AttachmentL
// ==========================================================================
EXPORT_C CMsgStoreAttachment* CMsgStoreSession::AttachmentL( TMsgStoreId aAttachmentId,
- TMsgStoreId aMessageId,
- TMsgStoreId aFolderId )
- {
- iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits );
- iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits );
- iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
-
- RBuf8 propertiesBuf;
- CleanupClosePushL( propertiesBuf );
-
- iContext->iSession.ContainerPropertiesL( aAttachmentId, aMessageId, aFolderId, propertiesBuf );
+ TMsgStoreId aMessageId,
+ TMsgStoreId aFolderId )
+ {
+ iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits );
+ iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits );
+ iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
+
+ RBuf8 propertiesBuf;
+ CleanupClosePushL( propertiesBuf );
+
+ iContext->iSession.ContainerPropertiesL( aAttachmentId, aMessageId, aFolderId, propertiesBuf );
- CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, aAttachmentId, aMessageId, propertiesBuf );
-
- CleanupStack::PopAndDestroy( &propertiesBuf );
-
- return attachment;
- } // end AttachmentL
+ CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, aAttachmentId, aMessageId, propertiesBuf );
+
+ CleanupStack::PopAndDestroy( &propertiesBuf );
+
+ return attachment;
+ } // end AttachmentL
// ==========================================================================
// FUNCTION: AddAttachmentL
// ==========================================================================
EXPORT_C CMsgStoreAttachment* CMsgStoreSession::AddAttachmentL( TMsgStoreId aMessageId,
- TMsgStoreId aFolderId,
- const TDesC& aFilename,
- const CMsgStorePropertyContainer& aProperties )
- {
- iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits );
- iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
-
- if( aFilename.Length() == 0 )
- {
- __LOG_STATIC_ENTER( "msg", "AddAttachmentL" )
- __LOG_WRITE_ERROR( "zero length file name" )
- __LOG_STATIC_EXIT
- User::Leave( KErrArgument );
- } // end if
-
- RBuf8 serializedProperties;
- CleanupClosePushL( serializedProperties );
- aProperties.SerializeL( serializedProperties );
-
- TInt id = iContext->iSession.CreateContainerL( aMessageId,
- aFolderId,
- EMsgStoreAttachmentBits,
- serializedProperties,
- ETrue,
- aFilename );
-
- CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, id, aMessageId, serializedProperties );
-
- CleanupStack::PopAndDestroy( &serializedProperties );
-
- return attachment;
- } // end AddAttachmentL
+ TMsgStoreId aFolderId,
+ const TDesC& aFilename,
+ const CMsgStorePropertyContainer& aProperties )
+ {
+ iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits );
+ iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
+
+ if( aFilename.Length() == 0 )
+ {
+ __LOG_STATIC_ENTER( "msg", "AddAttachmentL" )
+ __LOG_WRITE_ERROR( "zero length file name" )
+ __LOG_STATIC_EXIT
+ User::Leave( KErrArgument );
+ } // end if
+
+ RBuf8 serializedProperties;
+ CleanupClosePushL( serializedProperties );
+ aProperties.SerializeL( serializedProperties );
+
+ TInt id = iContext->iSession.CreateContainerL( aMessageId,
+ aFolderId,
+ EMsgStoreAttachmentBits,
+ serializedProperties,
+ ETrue,
+ aFilename );
+
+ CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, id, aMessageId, serializedProperties );
+
+ CleanupStack::PopAndDestroy( &serializedProperties );
+
+ return attachment;
+ } // end AddAttachmentL
// ==========================================================================
// FUNCTION: AddAttachmentL
// ==========================================================================
EXPORT_C CMsgStoreAttachment* CMsgStoreSession::AddAttachmentL( TMsgStoreId aMessageId,
- TMsgStoreId aFolderId,
- const CMsgStorePropertyContainer& aProperties )
- {
- iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits );
- iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
-
- RBuf8 serializedProperties;
- CleanupClosePushL( serializedProperties );
- aProperties.SerializeL( serializedProperties );
-
- TInt id = iContext->iSession.CreateContainerL( aMessageId,
- aFolderId,
- EMsgStoreAttachmentBits,
- serializedProperties );
-
- CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, id, aMessageId, serializedProperties );
-
- CleanupStack::PopAndDestroy( &serializedProperties );
-
- return attachment;
- } // end AddAttachmentL
+ TMsgStoreId aFolderId,
+ const CMsgStorePropertyContainer& aProperties )
+ {
+ iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits );
+ iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
+
+ RBuf8 serializedProperties;
+ CleanupClosePushL( serializedProperties );
+ aProperties.SerializeL( serializedProperties );
+
+ TInt id = iContext->iSession.CreateContainerL( aMessageId,
+ aFolderId,
+ EMsgStoreAttachmentBits,
+ serializedProperties );
+
+ CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, id, aMessageId, serializedProperties );
+
+ CleanupStack::PopAndDestroy( &serializedProperties );
+
+ return attachment;
+ } // end AddAttachmentL
// ==========================================================================
// FUNCTION: RemoveAttachmentL
// ==========================================================================
EXPORT_C void CMsgStoreSession::RemoveAttachmentL( TMsgStoreId aAttachmentId,
- TMsgStoreId aMessageId,
- TMsgStoreId aFolderId )
- {
- iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits );
- iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
- iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits );
-
- iContext->iSession.DeleteContainerL( aAttachmentId, aMessageId, aFolderId );
- } // end RemoveAttachmentL
-
+ TMsgStoreId aMessageId,
+ TMsgStoreId aFolderId )
+ {
+ iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits );
+ iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
+ iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits );
+
+ iContext->iSession.DeleteContainerL( aAttachmentId, aMessageId, aFolderId );
+ } // end RemoveAttachmentL
+
// ==========================================================================
// FUNCTION: SearchL
// ==========================================================================
EXPORT_C void CMsgStoreSession::SearchL( TMsgStoreId aFolderId,
TMsgStoreSearchType aSearchType,
- const TDesC& aSearchString,
- MMsgStoreSearchClient& aSearchClient )
+ const TDesC& aSearchString,
+ MMsgStoreSearchClient& aSearchClient )
{
- iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
+ iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits );
- if( aSearchString.Length() == 0 )
- {
- __LOG_STATIC_ENTER( "msg", "SearchL" )
- __LOG_WRITE_ERROR( "zero length search string" )
+ if( aSearchString.Length() == 0 )
+ {
+ __LOG_STATIC_ENTER( "msg", "SearchL" )
+ __LOG_WRITE_ERROR( "zero length search string" )
__LOG_STATIC_EXIT
User::Leave( KErrArgument );
- } // end if
+ } // end if
if( iContext->iSearchHandler )
{
- __LOG_STATIC_ENTER( "msg", "SearchL" )
- __LOG_WRITE_ERROR( "search already in progress" )
+ __LOG_STATIC_ENTER( "msg", "SearchL" )
+ __LOG_WRITE_ERROR( "search already in progress" )
__LOG_STATIC_EXIT
User::Leave( KErrInUse );
} // end if
-
+
iContext->iSearchHandler = CMsgStoreSearchHandler::NewL( iContext->iSession, aFolderId, aSearchType, aSearchString, *this );
iContext->iSearchClient = &aSearchClient;
} // end SearchL
-
+
// ==========================================================================
// FUNCTION: CancelSearch
// ==========================================================================
@@ -363,8 +363,8 @@
CMsgStoreSearchHandler* CMsgStoreSearchHandler::NewL( RMessageStoreSession& aSession,
TMsgStoreId aFolderId,
TMsgStoreSearchType aSearchType,
- const TDesC& aSearchString,
- MMsgStoreSearchClient& aSearchClient )
+ const TDesC& aSearchString,
+ MMsgStoreSearchClient& aSearchClient )
{
CMsgStoreSearchHandler* self = new(ELeave) CMsgStoreSearchHandler( aSession, aSearchClient );
CleanupStack::PushL( self );
@@ -372,27 +372,27 @@
CleanupStack::Pop( self );
return self;
} // end NewL
-
+
// ==========================================================================
// FUNCTION: Constructor
// ==========================================================================
CMsgStoreSearchHandler::CMsgStoreSearchHandler( RMessageStoreSession& aSession,
MMsgStoreSearchClient& aSearchClient ) :
- CActive( EPriorityStandard ),
- iSession( aSession ),
+ CActive( EPriorityStandard ),
+ iSession( aSession ),
iSearchClient( aSearchClient )
{
__LOG_CONSTRUCT( "msg", "CMsgStoreSearchHandler" )
- CActiveScheduler::Add(this);
+ CActiveScheduler::Add(this);
} // end constructor
-
+
// ==========================================================================
// FUNCTION: ConstructL
// ==========================================================================
void CMsgStoreSearchHandler::ConstructL( TMsgStoreId aFolderId,
TMsgStoreSearchType aSearchType,
- const TDesC& aSearchString )
+ const TDesC& aSearchString )
{
iMatchBuffer[0].CreateL( sizeof(TMsgStoreId) * KSearchBufferLength );
iMatchBuffer[1].CreateL( sizeof(TMsgStoreId) * KSearchBufferLength );
@@ -420,7 +420,7 @@
__LOG_DESTRUCT
} // end destructor
-
+
// ==========================================================================
// FUNCTION: RunL
// ==========================================================================
@@ -431,12 +431,12 @@
RBuf8& currentMatchBuffer = iMatchBuffer[iMatchBufferIndex];
if( iStatus == KErrNone && currentMatchBuffer.Length() > 0 )
- {
- // Switch to the other match buffer for the next call to the session. Make this call before
- // calling the search client with matches, just in case the client cancels the search during
- // the callback. This will cause DoCancel to be called during this object's destruction, which
- // will cancel the server-side search.
- iMatchBufferIndex = (iMatchBufferIndex + 1) % 2;
+ {
+ // Switch to the other match buffer for the next call to the session. Make this call before
+ // calling the search client with matches, just in case the client cancels the search during
+ // the callback. This will cause DoCancel to be called during this object's destruction, which
+ // will cancel the server-side search.
+ iMatchBufferIndex = (iMatchBufferIndex + 1) % 2;
iSession.GetMatchesL( iStatus, iMatchBuffer[iMatchBufferIndex] );
SetActive();
@@ -445,13 +445,13 @@
TBool thisObjectHasBeenDeleted = EFalse;
iThisObjectHasBeenDeleted = &thisObjectHasBeenDeleted;
- TBool atEndOfIds = (currentMatchBuffer.Length() == 0);
- TUint offset = 0;
+ TBool atEndOfIds = (currentMatchBuffer.Length() == 0);
+ TUint offset = 0;
- while( !thisObjectHasBeenDeleted && !atEndOfIds )
- {
- const TMsgStoreId& currentId = *reinterpret_cast<const TMsgStoreId *>( currentMatchBuffer.Ptr() + offset );
-
+ while( !thisObjectHasBeenDeleted && !atEndOfIds )
+ {
+ const TMsgStoreId& currentId = *reinterpret_cast<const TMsgStoreId *>( currentMatchBuffer.Ptr() + offset );
+
__LOG_WRITE8_FORMAT1_INFO( "match found (%i)", currentId )
offset += sizeof(TMsgStoreId);
@@ -463,22 +463,22 @@
// Note that the client may cancel the search during this callback.
iSearchClient.MatchFound( currentId );
- } // end while
+ } // end while
if( !thisObjectHasBeenDeleted )
{
iThisObjectHasBeenDeleted = NULL;
} // end if
- }
+ }
else
- {
+ {
__LOG_WRITE8_FORMAT1_INFO( "Search completed, iStatus=%d", iStatus.Int() );
iSearchClient.SearchCompleted();
- } // end if
+ } // end if
- // __LOG_EXIT was removed because it crashes in cases where thisObjectHasBeenDeleted is true
+ // __LOG_EXIT was removed because it crashes in cases where thisObjectHasBeenDeleted is true
} // end RunL