Writing a Client MTM

This section describes the initial steps to be performed to write a Client MTM. It does not explain the implementation of all Client MTM functionality. You can refer the Client MTM example for detailed implementation steps

The main function of the Client MTM is to load the entry currently referred to by the MTM’s context, and save it once any changes have been made to it. An individual entry’s store is represented by the CMsvStore class. Finally, after any changes are made to a store that stores the message body, CMsvStore::CommitL() must be called to commit those changes.


  1. Derive a class from the CBaseMtm class.

  2. Register it using the CRegisteredMtmDll parameter.

  3. Create a session with Message Server using the CMsvSession parameter.

  4. Create the CMsvOperation -based classes for performing the different operations that are required for your Messaging protocol. See Client-side operations.

Client MTM example

// 
// CTextMtmClient
//      Implements CBaseMtm to provide Client-side Text MTM     
//

EXPORT_C CTextMtmClient* CTextMtmClient::NewL(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession)
// Factory function
    {
    CTextMtmClient* self = new (ELeave) CTextMtmClient(aRegisteredMtmDll,aMsvSession);
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop();
    return self;
    }

For more details on implementing all Client MTM functions, see example code.

Related concepts
MTM overview
Client MTM