Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE task
PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-1E2DB50A-D8D7-595D-8448-77F057655E82" xml:lang="en"><title>Writing
a Client MTM</title><abstract><p>This section describes the initial steps to be performed to write
a Client MTM. It does not explain the implementation of all <xref href="GUID-E180D222-CC4F-5007-93FC-C339BBE708BC.dita">Client
MTM functionality</xref>. You can refer the <xref href="GUID-232E2D33-8BC1-5CC3-A4DF-2C99900E1083.dita">Client
MTM example</xref> for detailed implementation steps </p></abstract><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context><p>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 <xref href="GUID-8CB90FA2-A6CF-3FA2-81FF-7D22EFD9C2CE.dita"><apiname>CMsvStore</apiname></xref> class.
Finally, after any changes are made to a store that stores the message body, <xref href="GUID-8CB90FA2-A6CF-3FA2-81FF-7D22EFD9C2CE.dita#GUID-8CB90FA2-A6CF-3FA2-81FF-7D22EFD9C2CE/GUID-F1D4FE2A-8BB9-3CC2-9C30-DC053848A6B5"><apiname>CMsvStore::CommitL()</apiname></xref> must
be called to commit those changes. </p> </context>
<steps id="GUID-6A78327C-5D21-5913-9404-7153B2002264">
<step id="GUID-BC043CD5-E41A-5534-A2ED-0C6003723004"><cmd/>
<info>Derive a class from the <xref href="GUID-177AF50B-14EF-3C45-AE22-1FEE5678261D.dita"><apiname>CBaseMtm</apiname></xref> class. </info>
</step>
<step id="GUID-7A80C910-9012-57FF-8A7A-4A63631BBE33"><cmd/>
<info>Register it using the <xref href="GUID-0D5D7FAC-4F14-3046-92FB-873B8350FF4C.dita"><apiname>CRegisteredMtmDll</apiname></xref> parameter. </info>
</step>
<step id="GUID-B0606F56-C9D4-532F-B866-2D2AF54EC71C"><cmd/>
<info>Create a session with Message Server using the <xref href="GUID-2DA04D96-F0AD-3FDC-9E36-1C27D889AF4B.dita"><apiname>CMsvSession</apiname></xref> parameter. </info>
</step>
<step id="GUID-72F50006-EA9B-5BF3-8A8F-BC51C4434F9D"><cmd/>
<info>Create the <xref href="GUID-AF724192-6580-3DE3-9287-3A005C0AA932.dita"><apiname>CMsvOperation</apiname></xref> -based classes for performing
the different operations that are required for your Messaging protocol. See <xref href="GUID-E180D222-CC4F-5007-93FC-C339BBE708BC.dita#GUID-E180D222-CC4F-5007-93FC-C339BBE708BC/GUID-6DD0912E-1E82-5BAD-889C-5FA79E5E800C">Client-side
operations</xref>. </info>
</step>
</steps>
<example><title>Client MTM example</title><codeblock xml:space="preserve">//
// 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;
}</codeblock> <p>For more details on implementing all Client
MTM functions, see <xref href="GUID-232E2D33-8BC1-5CC3-A4DF-2C99900E1083.dita">example
code</xref>. </p> </example>
</taskbody><related-links>
<link href="GUID-59217FA7-3078-53CA-88B3-78D6FB788271.dita"><linktext>MTM overview</linktext>
</link>
<link href="GUID-E180D222-CC4F-5007-93FC-C339BBE708BC.dita"><linktext>Client MTM</linktext>
</link>
</related-links></task>