CMsvSession Class Reference

#include <mw/msvapi.h>

class CMsvSession : public CActive, public CActive

Inherits from

Public Member Functions
~CMsvSession()
IMPORT_C voidAddObserverL(MMsvSessionObserver &)
IMPORT_C voidChangeAttributesL(const CMsvEntrySelection &, TUint, TUint)
IMPORT_C CMsvOperation *ChangeDriveL(TInt, TRequestStatus &)
IMPORT_C voidCleanupEntry(TAny *)
IMPORT_C voidCleanupEntryPop(TInt)
IMPORT_C voidCleanupEntryPushL(TMsvId)
IMPORT_C voidCloseMessageServer()
IMPORT_C CMsvOperation *CopyStoreL(const TDriveUnit &, TRequestStatus &)
IMPORT_C TDriveUnitCurrentDriveL()
IMPORT_C TIntDeInstallMtmGroup(const TDesC &)
IMPORT_C voidDecPcSyncCountL(const CMsvEntrySelection &)
IMPORT_C CMsvOperation *DeleteStoreL(const TDriveUnit &, TRequestStatus &)
IMPORT_C TBoolDriveContainsStoreL(TDriveUnit)
IMPORT_C RFs &FileSession()
IMPORT_C TBoolGetAndClearIndexCorruptFlagL()
IMPORT_C voidGetChildIdsL(TMsvId, const CMsvEntryFilter &, CMsvEntrySelection &)
IMPORT_C TIntGetEntry(TMsvId, TMsvId &, TMsvEntry &)
IMPORT_C CMsvEntry *GetEntryL(TMsvId)
IMPORT_C voidGetMtmRequiredCapabilitiesL(TUid, TCapabilitySet &)
IMPORT_C voidIncPcSyncCountL(const CMsvEntrySelection &)
IMPORT_C TIntInstallMtmGroup(const TDesC &)
IMPORT_C TIntMessageCount(TMsvId)
IMPORT_C TBoolMessageStoreDrivePresentL()
IMPORT_C CMsvSession *OpenAsObserverL(MMsvSessionObserver &)
IMPORT_C CMsvSession *OpenAsObserverL(MMsvSessionObserver &, RFs &)
IMPORT_C CMsvSession *OpenAsObserverL(MMsvSessionObserver &, TInt)
IMPORT_C CMsvSession *OpenAsObserverL(MMsvSessionObserver &, RFs &, TInt)
IMPORT_C CMsvSession *OpenAsyncL(MMsvSessionObserver &)
IMPORT_C CMsvSession *OpenAsyncL(MMsvSessionObserver &, RFs &)
IMPORT_C CMsvSession *OpenAsyncL(MMsvSessionObserver &, TInt)
IMPORT_C CMsvSession *OpenAsyncL(MMsvSessionObserver &, RFs &, TInt)
IMPORT_C CMsvSession *OpenSyncL(MMsvSessionObserver &)
IMPORT_C CMsvSession *OpenSyncL(MMsvSessionObserver &, RFs &)
IMPORT_C CMsvSession *OpenSyncL(MMsvSessionObserver &, TInt)
IMPORT_C CMsvSession *OpenSyncL(MMsvSessionObserver &, RFs &, TInt)
IMPORT_C TIntOutstandingOperationsL()
IMPORT_C voidRemoveEntry(TMsvId)
IMPORT_C voidRemoveObserver(MMsvSessionObserver &)
IMPORT_C TIntServiceAccessPointId(TMsvId, TUint32 &)
IMPORT_C TBoolServiceActive(TMsvId)
IMPORT_C TIntServiceProgress(TMsvId, TDes8 &)
IMPORT_C TIntSetReceiveEntryEvents(TBool)
IMPORT_C TIntStopService(TMsvId)
MMsvStoreManager &StoreManager()
IMPORT_C CMsvOperation *TransferCommandL(const CMsvEntrySelection &, TInt, const TDesC8 &, TRequestStatus &)
IMPORT_C voidTransferCommandL(const CMsvEntrySelection &, TInt, const TDesC8 &, TDes8 &)
IMPORT_C TIntUnreadMessageCount(TMsvId, TInt32)
IMPORT_C CMsvEntrySelection *UnreadMessageIdListL(TMsvId, TInt32)
Protected Member Functions
CMsvSession(MMsvSessionObserver &)
CMsvSession(MMsvSessionObserver &, RFs &)
CMsvSession(MMsvSessionObserver &, TInt)
CMsvSession(MMsvSessionObserver &, RFs &, TInt)
voidCheckDrive()
voidConstructAsObserverL()
voidConstructL(TBool)
virtual voidDoCancel()
IMPORT_C TIntOperationId()
virtual TInt RunError(TInt)
virtual voidRunL()
IMPORT_C RMsvServerSession &Session()
Inherited Attributes
CActive::iStatus
Inherited Enumerations
CActive:TPriority
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()

Detailed Description

Represents a channel of communication between a client thread (Client-side MTM, User Interface MTM, or message client application) and the Message Server thread.

The class provides the means by which clients are notified when important Message Server events occur.

Note the following significant groups of functions:

Creation functions: a message client application must use OpenSyncL() or OpenASyncL() to create a session object, before it can instantiate any MTM or CMsvEntry object. Only a single session should be created within a thread. As Client-side MTM, User Interface MTM, and CMsvEntry objects are created in the client thread, these use the client session, and do not create their own. Note that to close a session, delete all objects relying on that session, and then the session object itself.

Cleanup functions: CMsvSession provides the ability to handle the cleanup of entries in the event of a leave occurring, in a very similar manner to the standard cleanup stack. The difference is that, on a leave, any entries that are on the entry cleanup stack are removed from the Message Server. The implementation uses the standard cleanup stack, so entry push and pop functions should be used in the same order as all other types of push and pop. The functions can be used both by MTM implementations and message client applications.

Constructor & Destructor Documentation

CMsvSession ( MMsvSessionObserver & )

CMsvSession(MMsvSessionObserver &aObserver)[protected]

CMsvSession ( MMsvSessionObserver &, RFs & )

CMsvSession(MMsvSessionObserver &aObserver,
RFs &aFs
)[protected]

CMsvSession ( MMsvSessionObserver &, TInt )

CMsvSession(MMsvSessionObserver &aObserver,
TIntaPriority
)[protected]

CMsvSession ( MMsvSessionObserver &, RFs &, TInt )

CMsvSession(MMsvSessionObserver &aObserver,
RFs &aFs,
TIntaPriority
)[protected]

~CMsvSession ( )

~CMsvSession()

Member Function Documentation

AddObserverL ( MMsvSessionObserver & )

IMPORT_C voidAddObserverL(MMsvSessionObserver &aObserver)

Registers a new session observer.

CMsvSession objects can call back observer objects that implement the MMsvSessionObserver::HandleSessionEvent() when certain events occur. Any number of observers can be registered.

For details of when observers are called, see TMsvSessionEvent::TMsvEntryEvent.

Parameters
aObserverA reference to an observer to be registered for events
Leave Codes
KErrNoMemoryNot enough memory to register the observer

ChangeAttributesL ( const CMsvEntrySelection &, TUint, TUint )

IMPORT_C voidChangeAttributesL(const CMsvEntrySelection &aSelection,
TUintaSetAttributes,
TUintaClearAttributes
)

Provides a quick way to set or clear multiple fields in a selection of entries.

Fields to change are specified using a bitmask of TMsvAttribute values. Possible fields that can be changed using this function are:

1. PC synchronisation

2. Visibility flag

3. Read flag

4. In-preparation flag

5. Connected flag

6. New flag

See also: TMsvAttribute

Parameters
aSelectionThe entries to change
aSetAttributesA bitmask of the fields to set
aClearAttributesA bitmask of the fields to clear

ChangeDriveL ( TInt, TRequestStatus & )

IMPORT_C CMsvOperation *ChangeDriveL(TIntaDrive,
TRequestStatus &aStatus
)

Changes the Message Server current drive to the specified drive.

Progress information is provided by a TMsvIndexLoadProgress object.

If an error occurs, the index is unchanged.

See also: TDriveNumber TMsvIndexLoadProgress

Parameters
aDriveThe drive to which to move the Message Server index, specified by a TDriveNumber value
aStatusAsynchronous completion status
Return Value
Asynchronous operation used to control the move. The operation's MTM value is set to KUidMsvServerMtm, which can be used to distinguish it from a local operation.
Leave Codes
KErrServerBusyCannot change drive because there are outstanding Message Server operations.

CheckDrive ( )

voidCheckDrive()[protected]

Checks that the current drive matches the one on the server updates it if it doesn't used because sync create might cause the drive to change, which we will be notified about, but the client might try and do something before that notification comes in.

CleanupEntry ( TAny * )

IMPORT_C voidCleanupEntry(TAny *aPtr)[static]

Cleans up an entry that has been added to the cleanup stack using CleanupEntryPushL().

This function defines the clean up function that is called when an entry on the stack needs cleaning up.

Parameters
aPtrPointer to the current message server session

CleanupEntryPop ( TInt )

IMPORT_C voidCleanupEntryPop(TIntaCount = 1)

Pops one or more entries from the entry cleanup stack.

Parameters
aCountThe number of entries to pop off the entry cleanup stack

CleanupEntryPushL ( TMsvId )

IMPORT_C voidCleanupEntryPushL(TMsvIdaId)

Pushes the specified entry ID to the entry cleanup stack.

Parameters
aIdThe ID of the entry to push onto the entry cleanup stack
Leave Codes
KErrNoMemoryThe entry will have been pushed onto the entry cleanup stack before the leave occurs

CloseMessageServer ( )

IMPORT_C voidCloseMessageServer()

Closes down the Message Server.

Normal clients should not use this function, as it will affect other message clients.

The function results in the session sending a shutdown session notification (TMsvSessionEvent::EMsvCloseSession) to all current sessions. The Message Server closes when all sessions have been closed.

ConstructAsObserverL ( )

voidConstructAsObserverL()[protected]

ConstructL ( TBool )

voidConstructL(TBoolaSyncOpening)[protected]

CopyStoreL ( const TDriveUnit &, TRequestStatus & )

IMPORT_C CMsvOperation *CopyStoreL(const TDriveUnit &aDrive,
TRequestStatus &aStatus
)

Copies the Message Store to the specified drive.

Progress information is provided by a TMsvCopyProgress object.

If an error occurs, the Message Store is unchanged.

See also: TDriveUnit TMsvCopyDeleteProgress

Parameters
aDriveThe drive to which to copy the Message Store, specified by a TDriveUnit value
aStatusAsynchronous completion status
Return Value
Asynchronous operation used to control the move. The operation's MTM value is set to KUidMsvServerMtm, which can be used to distinguish it from a local operation.
Leave Codes
KErrServerBusyCannot copy store because there are outstanding Message Server operations.

CurrentDriveL ( )

IMPORT_C TDriveUnitCurrentDriveL()

DeInstallMtmGroup ( const TDesC & )

IMPORT_C TIntDeInstallMtmGroup(const TDesC &aFullName)

Removes an installed MTM.

It is used by specialised MTM-deinstallation programs.

Parameters
aFullNameThe full path name of the MTM group file
Return Value
KErrNone - success; KErrInUse - The MTM is currently being used

DecPcSyncCountL ( const CMsvEntrySelection & )

IMPORT_C voidDecPcSyncCountL(const CMsvEntrySelection &aSelection)

Decreases the PC synchronisation index field for a selection of entries.

If an entry has its Deleted flag set, and this call causes its PC synchronisation field to become zero, then the entry is permanently deleted.

Parameters
aSelectionEntries for which to decrease the PC synchronisation index field

DeleteStoreL ( const TDriveUnit &, TRequestStatus & )

IMPORT_C CMsvOperation *DeleteStoreL(const TDriveUnit &aDrive,
TRequestStatus &aStatus
)

Deletes the Message Store to the specified drive.

Progress information is provided by a TMsvDeleteProgress object.

If an error occurs, the Message Store is unchanged.

See also: TDriveUnit TMsvCopyDeleteProgress

Parameters
aDriveThe drive to which to copy the Message Store, specified by a TDriveUnit value
aStatusAsynchronous completion status
Return Value
Asynchronous operation used to control the move. The operation's MTM value is set to KUidMsvServerMtm, which can be used to distinguish it from a local operation.
Leave Codes
KErrServerBusyCannot copy store because there are outstanding Message Server operations.

DoCancel ( )

voidDoCancel()[protected, virtual]

Reimplemented from CActive::DoCancel()

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel().

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel().

See also: CActive::Cancel

DriveContainsStoreL ( TDriveUnit )

IMPORT_C TBoolDriveContainsStoreL(TDriveUnitaDrive)

FileSession ( )

IMPORT_C RFs &FileSession()

Allows a Server-side MTM to access the file session handle created by the Message Server.

This is preferable, as more efficient, to creating another handle.

Return Value
File session handle

GetAndClearIndexCorruptFlagL ( )

IMPORT_C TBoolGetAndClearIndexCorruptFlagL()

Checks a flag in the message server that is set when the server deletes a corrupt index file. Then clears the flag.

It is intended to allow the message centre UI to check whether a corrupt index has been deleted on startup. If it has the UI may inform the user about the loss of their messages.

Return Value
ETrue if a corrupt index flag was present indicating that a corrupt index file has been deleted since the last time this function was called.

GetChildIdsL ( TMsvId, const CMsvEntryFilter &, CMsvEntrySelection & )

IMPORT_C voidGetChildIdsL(TMsvIdaId,
const CMsvEntryFilter &aFilter,
CMsvEntrySelection &aSelection
)

Gets filtered list of children of a specified message entry.

Parameters
aIdMessage entry of which to get children
aFilterFilter by which various message entries can be excluded
aSelectionOn return, a list of message entry IDs

GetEntry ( TMsvId, TMsvId &, TMsvEntry & )

IMPORT_C TIntGetEntry(TMsvIdaId,
TMsvId &aService,
TMsvEntry &aEntry
)

Gets the index entry for the specified entry ID.

Parameters
aIdThe ID of the entry to access
aServiceOn return, the ID of the service that owns the entry
aEntryOn return, the index entry
Return Value
KErrNone if successful, otherwise one of the system-wide error codes

GetEntryL ( TMsvId )

IMPORT_C CMsvEntry *GetEntryL(TMsvIdaEntId)

Accesses the entry with the specified ID.

If a client is unaware of the entries that exist, it can set aId to KMsvRootIndexEntryId to obtain the root entry, from where all other entries can be obtained.

The CMsvEntry object must be deleted by the client when it is no longer required.

Parameters
aEntIdThe ID of the entry to access
Return Value
A new entry object
Leave Codes
KErrNotFoundThe requested entry does not exist

GetMtmRequiredCapabilitiesL ( TUid, TCapabilitySet & )

IMPORT_C voidGetMtmRequiredCapabilitiesL(TUidaMtmTypeUid,
TCapabilitySet &aCapSet
)const

Gets the additional security capabilities required by a given MTM, over and above those required by the message server itself.

Parameters
aMtmTypeUidThe type UID of the MTM being queried
aCapSetA reference to a TCapabilitySet in which the security capabilities will be returned. Any existing capabilities will be removed.

IncPcSyncCountL ( const CMsvEntrySelection & )

IMPORT_C voidIncPcSyncCountL(const CMsvEntrySelection &aSelection)

Increases the PC synchronisation index field for a selection of entries.

Parameters
aSelectionEntries for which to increase the PC synchronisation index field

InstallMtmGroup ( const TDesC & )

IMPORT_C TIntInstallMtmGroup(const TDesC &aFullName)

Installs a new group of MTMs.

It is used by specialised MTM-installation programs.

Parameters
aFullNameThe full path name of the MTM group file
Return Value
KErrNone - success; KErrAlreadyExists - MTM already installed

MessageCount ( TMsvId )

IMPORT_C TIntMessageCount(TMsvIdaFolderId)

MessageCount() This function returns the message count of a folder.

Parameters
aFolderIdId of the folder for which total message count needs to be found.
Return Value
Number of messages in that folder.

MessageStoreDrivePresentL ( )

IMPORT_C TBoolMessageStoreDrivePresentL()

Checks to see if the currently selected drive contains the correct mail store.

Return Value
ETrue if the same drive is mounted. otherwise returns EFalse
Capability
None

OpenAsObserverL ( MMsvSessionObserver & )

IMPORT_C CMsvSession *OpenAsObserverL(MMsvSessionObserver &aObserver)[static]

Creates a session that is used only as an observer.

The session created with this function should only be used to observe events, and not actively use the server. It used for applications such as system monitoring utilities.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenAsObserverL ( MMsvSessionObserver &, RFs & )

IMPORT_C CMsvSession *OpenAsObserverL(MMsvSessionObserver &aObserver,
RFs &aFs
)[static]

Creates a session that is used only as an observer.

The session created with this function should only be used to observe events, and not actively use the server. It used for applications such as system monitoring utilities.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
aFsA connected file server session
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenAsObserverL ( MMsvSessionObserver &, TInt )

IMPORT_C CMsvSession *OpenAsObserverL(MMsvSessionObserver &aObserver,
TIntaPriority
)[static]

Creates a session that is used only as an observer.

The session created with this function should only be used to observe events, and not actively use the server. It used for applications such as system monitoring utilities. Clients to specify a priority that is tuned to their scheduler.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
aPriorityActive object priority
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenAsObserverL ( MMsvSessionObserver &, RFs &, TInt )

IMPORT_C CMsvSession *OpenAsObserverL(MMsvSessionObserver &aObserver,
RFs &aFs,
TIntaPriority
)[static]

Creates a session that is used only as an observer.

The session created with this function should only be used to observe events, and not actively use the server. It used for applications such as system monitoring utilities. Clients to specify a priority that is tuned to their scheduler.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
aFsA connected file server session
aPriorityActive object priority
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenAsyncL ( MMsvSessionObserver & )

IMPORT_C CMsvSession *OpenAsyncL(MMsvSessionObserver &aObserver)[static]

Creates a session asynchronously.

The session cannot be used until the passed MMsvSessionObserver observer has been informed that the message server is ready with TMsvSessionEvent::EMsvServerReady. If any functions are called before this, they will fail with KErrNotReady.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenAsyncL ( MMsvSessionObserver &, RFs & )

IMPORT_C CMsvSession *OpenAsyncL(MMsvSessionObserver &aObserver,
RFs &aFs
)[static]

Creates a session asynchronously.

The session cannot be used until the passed MMsvSessionObserver observer has been informed that the message server is ready with TMsvSessionEvent::EMsvServerReady. If any functions are called before this, they will fail with KErrNotReady.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
aFsA connected file server session
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenAsyncL ( MMsvSessionObserver &, TInt )

IMPORT_C CMsvSession *OpenAsyncL(MMsvSessionObserver &aObserver,
TIntaPriority
)[static]

Creates a session asynchronously.

The session cannot be used until the passed MMsvSessionObserver observer has been informed that the message server is ready with TMsvSessionEvent::EMsvServerReady. If any functions are called before this, they will fail with KErrNotReady. Clients to specify a priority that is tuned to their scheduler.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
aPriorityActive object priority
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenAsyncL ( MMsvSessionObserver &, RFs &, TInt )

IMPORT_C CMsvSession *OpenAsyncL(MMsvSessionObserver &aObserver,
RFs &aFs,
TIntaPriority
)[static]

Creates a session asynchronously.

The session cannot be used until the passed MMsvSessionObserver observer has been informed that the message server is ready with TMsvSessionEvent::EMsvServerReady. If any functions are called before this, they will fail with KErrNotReady. Clients to specify a priority that is tuned to their scheduler.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
aFsA connected file server session
aPriorityActive object priority
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenSyncL ( MMsvSessionObserver & )

IMPORT_C CMsvSession *OpenSyncL(MMsvSessionObserver &aObserver)[static]

Creates a session synchronously.

The session can be used once the function returns.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenSyncL ( MMsvSessionObserver &, RFs & )

IMPORT_C CMsvSession *OpenSyncL(MMsvSessionObserver &aObserver,
RFs &aFs
)[static]

Creates a session synchronously.

The session can be used once the function returns.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
aFsA connected file server session
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenSyncL ( MMsvSessionObserver &, TInt )

IMPORT_C CMsvSession *OpenSyncL(MMsvSessionObserver &aObserver,
TIntaPriority
)[static]

Creates a session synchronously.

The session can be used once the function returns. Clients to specify a priority that is tuned to their scheduler.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
aPriorityActive object priority
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OpenSyncL ( MMsvSessionObserver &, RFs &, TInt )

IMPORT_C CMsvSession *OpenSyncL(MMsvSessionObserver &aObserver,
RFs &aFs,
TIntaPriority
)[static]

Creates a session synchronously.

The session can be used once the function returns. Clients to specify a priority that is tuned to their scheduler.

Parameters
aObserverA reference to a session observer, through which the program can be notified of important events regarding entries, MTMs, and the Message Server.
aFsA connected file server session
aPriorityActive object priority
Return Value
New session object
Leave Codes
KErrNoMemoryNot enough memory to create object.

OperationId ( )

IMPORT_C TIntOperationId()[protected]

OutstandingOperationsL ( )

IMPORT_C TIntOutstandingOperationsL()

Gets the number of outstanding operations.

Return Value
The number of outstanding operations

RemoveEntry ( TMsvId )

IMPORT_C voidRemoveEntry(TMsvIdaId)

Deletes the specified entry from the Message Server.

The call is guaranteed not to fail. If the entry cannot be deleted immediately, it will be deleted later. This call should only be used in preference to the normal deleting mechanism when no error reporting is required, typically in a destructor.

Parameters
aIdThe ID of the entry to remove

RemoveObserver ( MMsvSessionObserver & )

IMPORT_C voidRemoveObserver(MMsvSessionObserver &aObserver)

Deregisters a previously registered observer.

Parameters
aObserverA reference to an observer to be unregistered for events

RunError ( TInt )

TInt RunError(TIntaError)[protected, virtual]

Reimplemented from CActive::RunError(TInt)

RunL ( )

voidRunL()[protected, virtual]

Reimplemented from CActive::RunL()

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.

See also: CActiveScheduler::Start CActiveScheduler::Error CActiveScheduler::WaitForAnyRequest TRAPD

ServiceAccessPointId ( TMsvId, TUint32 & )

IMPORT_C TIntServiceAccessPointId(TMsvIdaServiceId,
TUint32 &aAccessPointId
)

Get the ID of the access point currently in use by the server side MTM for the given service ID

Parameters
aAccessPointIdIf return code is KErrNone, this will store the access point ID
Return Value
KErrNone if successful, KErrNotSupported if the server side MTM does not support this operation, KErrNotFound if the server side MTM is not connected at the time of the request, or one of the other system wide error codes.

ServiceActive ( TMsvId )

IMPORT_C TBoolServiceActive(TMsvIdaServiceId)

Tests whether a Server-side MTM for a particular service is loaded by the Message Server.

The Server-side MTM does not have to be executing a command - it may be waiting for another command.

Parameters
aServiceIdThe ID of the relevant service
Return Value
ETrue if the Server-side MTM for the service is loaded, otherwise EFalse

ServiceProgress ( TMsvId, TDes8 & )

IMPORT_C TIntServiceProgress(TMsvIdaServiceId,
TDes8 &aProgress
)

Gets the current progress information from the Server-side MTM for the specified service.

It is typically used by User Interface MTMs. The format of the progress information returned in the aProgress buffer is MTM-specific.

Calling this function results in the Message Server calling CBaseServerMtm::Progress() on the relevant Server-side MTM.

Note that the progress information is independent of which message client application started the current operation.

Parameters
aServiceIdThe ID of the service from which to get the progress information
aProgressOn return, a descriptor holding progress information. It is the caller's responsibility to ensure the descriptor is large enough for this information.
Return Value
KErrNone - success; KErrNotFound - The service is not active (the relevant Server-side MTM is not loaded by the Message Server); KErrOverflow - The descriptor was too small for the progress information

Session ( )

IMPORT_C RMsvServerSession &Session()[protected]

SetReceiveEntryEvents ( TBool )

IMPORT_C TIntSetReceiveEntryEvents(TBoolaReceive)

Sets whether the session's observer should be notified of events related to changes in message server entries.

If the flag is set to true, the session observer will be notified of all events types. If it is set to false, the observer will not be notified of events of types EMsvEntriesCreated, EMsvEntriesChanged, EMsvEntriesDeleted, or EMsvEntriesMoved. (Event types are enumerated in MMsvSessionObserver::TMsvSessionEvent.)

If a session has additional observers, as set through AddObserver(), then the value of this flag is ignored, and the observers receive notification of all events.

See also: MMsvSessionObserver::TMsvSessionEvent

Return Value
Symbian OS error code

StopService ( TMsvId )

IMPORT_C TIntStopService(TMsvIdaServiceId)

Stops any operations that a Server-side MTM for the specified service is running, and then unloads the Server-side MTM.

The current operation and any queued operations are cancelled.

Parameters
aServiceIdThe ID of the service to stop
Return Value
KErrNone - success;

StoreManager ( )

MMsvStoreManager &StoreManager()

TransferCommandL ( const CMsvEntrySelection &, TInt, const TDesC8 &, TRequestStatus & )

IMPORT_C CMsvOperation *TransferCommandL(const CMsvEntrySelection &aSelection,
TIntaCommandId,
const TDesC8 &aParameter,
TRequestStatus &aStatus
)

Passes MTM-specific operations asynchronously to the associated Server-side MTM by means of the Message Server.

It is typically used in the implementation of CBaseMtm::InvokeSyncFunctionL()/InvokeAsyncFunctionL() and CBaseMtmUi::InvokeSyncFunctionL()/InvokeAsyncFunctionL(). It is not used by message client applications. How the passed aSelection and aParameter parameters are used is specific to the operation.

Calling this function results in the Message Server calling CBaseServerMtm::StartCommandL() on the relevant Server-side MTM. If the Server-side MTM is not already loaded, then the Message Server loads it.

The returned CMsvOperation object completes when the operation is complete.

Parameters
aSelectionA selection of entries that may be relevant to the operation
aCommandIdThe command ID. The interpretation of the command is MTM-specific.
aParameterA descriptor containing operation-specific parameters
aStatusThe request status to be completed when the operation has finished
Return Value
The CMsvOperation object used to control the operation.
Leave Codes
KErrNoMemoryNot enough memory
KErrArgumentif aSelection is empty

TransferCommandL ( const CMsvEntrySelection &, TInt, const TDesC8 &, TDes8 & )

IMPORT_C voidTransferCommandL(const CMsvEntrySelection &aSelection,
TIntaCommandId,
const TDesC8 &aParameter,
TDes8 &aProgress
)

Passes MTM-specific operations synchronously to the associated Server-side MTM by means of the Message Server.

It is typically used in the implementation of CBaseMtm::InvokeSyncFunctionL() and CBaseMtmUi::InvokeSyncFunctionL(). It is not used by message client applications. How the passed aSelection and aParameter parameters are used is specific to the operation.

Calling this function results in the Message Server calling CBaseServerMtm::StartCommandL() on the relevant Server-side MTM. If the Server-side MTM is not already loaded, then the Message Server loads it.

Parameters
aSelectionA selection of entries that may be relevant to the operation
aCommandIdThe command ID. The interpretation of the command is MTM-specific.
aParameterA descriptor containing operation-specific parameters
aProgressProgress information returned from the Message Server
Leave Codes
KErrNoMemoryNot enough memory

UnreadMessageCount ( TMsvId, TInt32 )

IMPORT_C TIntUnreadMessageCount(TMsvIdaFolderId,
TInt32aBioType = 0
)

UnreadMessageCount() This function returns the unread message count of a folder.

Parameters
aFolderIdId of the folder for which total unread message count needs to be found.
aBioTypeBio id of the messages that needs to be fetched.
Return Value
Number of messages in that folder.

UnreadMessageIdListL ( TMsvId, TInt32 )

IMPORT_C CMsvEntrySelection *UnreadMessageIdListL(TMsvIdaFolderId,
TInt32aBioType = 0
)

UnReadMessageIdsL()

Parameters
aFolderIdId of the folder from which unread message ids need to be fetched
aBioTypeBio id of the messages that needs to be fetched
Return Value
aSelection On sucess contains the unread message ids, ownership is passed to the caller of the API. This function returns the unread message ids of a folder.