CSmtpClientMtm Class Reference

class CSmtpClientMtm : public CBaseMtm

SMTP client MTM interface.

Most of the functions in this class are implementations of the virtual functions defined by the base class CBaseMtm.

Inherits from

Public Member Functions
~CSmtpClientMtm()
voidAddAddresseeL(const TDesC &)
voidAddAddresseeL(const TDesC &, const TDesC &)
voidAddAddresseeL(TMsvRecipientType, const TDesC &)
voidAddAddresseeL(TMsvRecipientType, const TDesC &, const TDesC &)
IMPORT_C voidAddAttachmentL(const TDesC &, const TDesC8 &, TUint, TRequestStatus &)
IMPORT_C voidAddAttachmentL(RFile &, const TDesC8 &, TUint, TRequestStatus &)
IMPORT_C voidAddEntryAsAttachmentL(TMsvId, TRequestStatus &)
IMPORT_C voidAddLinkedAttachmentL(const TDesC &, const TDesC8 &, TUint, TRequestStatus &)
IMPORT_C voidCancelAttachmentOperation()
IMPORT_C voidChangeDefaultServiceL(const TMsvId &)
IMPORT_C voidCreateAttachmentL(const TDesC &, RFile &, const TDesC8 &, TUint, TRequestStatus &)
IMPORT_C voidCreateMessageL(TMsvId)
IMPORT_C TMsvIdDefaultServiceL()
TMsvPartList Find(const TDesC &, TMsvPartList)
CMsvOperation *ForwardL(TMsvId, TMsvPartList, TRequestStatus &)
CMsvOperation *InvokeAsyncFunctionL(TInt, const CMsvEntrySelection &, TDes8 &, TRequestStatus &)
voidInvokeSyncFunctionL(TInt, const CMsvEntrySelection &, TDes8 &)
voidLoadMessageL()
IMPORT_C CSmtpClientMtm *NewL(CRegisteredMtmDll &, CMsvSession &)
TInt QueryCapability(TUid, TInt &)
voidRemoveAddressee(TInt)
IMPORT_C voidRemoveDefaultServiceL()
CMsvOperation *ReplyL(TMsvId, TMsvPartList, TRequestStatus &)
IMPORT_C voidRestoreSettingsL()
voidSaveMessageL()
IMPORT_C voidSetSettingsL(const CImSmtpSettings &)
IMPORT_C voidSetSubjectL(const TDesC &)
IMPORT_C const CImSmtpSettings &Settings()
IMPORT_C voidStoreSettingsL()
IMPORT_C const TPtrCSubjectL()
TMsvPartList ValidateMessage(TMsvPartList)
Protected Member Functions
CSmtpClientMtm(CRegisteredMtmDll &, CMsvSession &)
voidConstructL()
voidContextEntrySwitched()
Private Member Functions
TMsvPartList DoFindL(const TDesC &, TMsvPartList)
TInt32 GetAttachmentSizeL(CImEmailMessage &, TMsvId)
voidGetBodyTextL(CImEmailMessage &, TMsvId)
voidResetData()
voidRestoreEmailMessageL()
voidSetAddresseeListL()
voidStoreEmailMessageL()
TBool ValidateAddress(const TPtrC &)
Inherited Functions
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()
CBaseMtm::AddresseeList()const
CBaseMtm::BioTypeChangedL(TUid)
CBaseMtm::Body()
CBaseMtm::Body()const
CBaseMtm::CBaseMtm(CRegisteredMtmDll &,CMsvSession &)
CBaseMtm::Entry()const
CBaseMtm::Extension_(TUint,TAny *&,TAny *)
CBaseMtm::Filler1()
CBaseMtm::Filler2()
CBaseMtm::GetExtensionData()
CBaseMtm::GetInterface(TUid)
CBaseMtm::HandleEntryEventL(TMsvEntryEvent,TAny *,TAny *,TAny *)
CBaseMtm::HasContext()const
CBaseMtm::RestoreBodyL(CMsvStore &)
CBaseMtm::Session()
CBaseMtm::SetCurrentEntryL(CMsvEntry *)
CBaseMtm::SetExtensionData(TAny *)
CBaseMtm::SetMessageCharacterSet(TUint)
CBaseMtm::StoreBodyL(CMsvStore &)
CBaseMtm::SwitchCurrentEntryL(TMsvId)
CBaseMtm::Type()const
CBaseMtm::~CBaseMtm()
Private Attributes
CImAttachmentWaiter *iAttachmentWaiter
HBufC *iEmailAddressFormatString
CImEmailMessage *iEmailMessage
CMsvEntrySelection *iEntrySelection
CImHeader *iHeader
CImEmailOperation *iImEmailOperation
CImSmtpSettings *iImSmtpSettings
HBufC *iSubject
TImMessageField iTImMessageField
CMsvOperationActiveSchedulerWait *iWait
Inherited Attributes
CBaseMtm::iAddresseeList
CBaseMtm::iCharFormatLayer
CBaseMtm::iMsvEntry
CBaseMtm::iParaFormatLayer

Constructor & Destructor Documentation

CSmtpClientMtm(CRegisteredMtmDll &, CMsvSession &)

CSmtpClientMtm(CRegisteredMtmDll &aRegisteredMtmDll,
CMsvSession &aMsvSession
)[protected]

Parameters

CRegisteredMtmDll & aRegisteredMtmDll
CMsvSession & aMsvSession

~CSmtpClientMtm()

~CSmtpClientMtm()

Member Functions Documentation

AddAddresseeL(const TDesC &)

voidAddAddresseeL(const TDesC &aRealAddress)[virtual]

Adds an addressee for the current context.

Addresses are not validated by checking their format by this function. Usually that is performed by calling ValidateMessage().

Requirements:

Implementations should append the address to the object's address cache in the protected iAddresseeList data member. Some implementations may also wish to store addresses in an internal data structure appropriate for the protocol, for example, a class holding message header information.

leave

KErrNotSupported The message already has the maximum number of addressees

leave

Other leave codes Dependent on implementation

Parameters

const TDesC & aRealAddressString representing an address to be added to the list for the current message

AddAddresseeL(const TDesC &, const TDesC &)

voidAddAddresseeL(const TDesC &aRealAddress,
const TDesC &aAlias
)[virtual]

Adds an addressee for the current context, and enables the client to specify an alias, which may be useful for some protocols. For example, for fax, if the address is the fax number, the alias could supply the recipient's name.

Addresses are not validated by checking their format by this function. Usually that is performed by calling ValidateMessage().

Requirements:

Implementations should append the address to the object's address cache in the protected iAddresseeList data member. Some implementations may also wish to store addresses in an internal data structure appropriate for the protocol, for example, a class holding message header information.

leave

KErrNotSupported The message already has the maximum number of addressees

leave

Other leave codes Dependent on implementation

Parameters

const TDesC & aRealAddressString representing an address to be added to the list for the current message
const TDesC & aAliasAlias information

AddAddresseeL(TMsvRecipientType, const TDesC &)

voidAddAddresseeL(TMsvRecipientTypeaType,
const TDesC &aRealAddress
)[virtual]

Parameters

TMsvRecipientType aType
const TDesC & aRealAddress

AddAddresseeL(TMsvRecipientType, const TDesC &, const TDesC &)

voidAddAddresseeL(TMsvRecipientTypeaType,
const TDesC &aRealAddress,
const TDesC &aAlias
)[virtual]

Parameters

TMsvRecipientType aType
const TDesC & aRealAddress
const TDesC & aAlias

AddAttachmentL(const TDesC &, const TDesC8 &, TUint, TRequestStatus &)

IMPORT_C voidAddAttachmentL(const TDesC &aFilePath,
const TDesC8 &aMimeType,
TUintaCharset,
TRequestStatus &aStatus
)[virtual]

Parameters

const TDesC & aFilePath
const TDesC8 & aMimeType
TUint aCharset
TRequestStatus & aStatus

AddAttachmentL(RFile &, const TDesC8 &, TUint, TRequestStatus &)

IMPORT_C voidAddAttachmentL(RFile &aFile,
const TDesC8 &aMimeType,
TUintaCharset,
TRequestStatus &aStatus
)[virtual]

Parameters

RFile & aFile
const TDesC8 & aMimeType
TUint aCharset
TRequestStatus & aStatus

AddEntryAsAttachmentL(TMsvId, TRequestStatus &)

IMPORT_C voidAddEntryAsAttachmentL(TMsvIdaAttachmentId,
TRequestStatus &aStatus
)[virtual]

Parameters

TMsvId aAttachmentId
TRequestStatus & aStatus

AddLinkedAttachmentL(const TDesC &, const TDesC8 &, TUint, TRequestStatus &)

IMPORT_C voidAddLinkedAttachmentL(const TDesC &aFilePath,
const TDesC8 &aMimeType,
TUintaCharset,
TRequestStatus &aStatus
)[virtual]

Parameters

const TDesC & aFilePath
const TDesC8 & aMimeType
TUint aCharset
TRequestStatus & aStatus

CancelAttachmentOperation()

IMPORT_C voidCancelAttachmentOperation()[virtual]

ChangeDefaultServiceL(const TMsvId &)

IMPORT_C voidChangeDefaultServiceL(const TMsvId &aService)[virtual]

Parameters

const TMsvId & aService

ConstructL()

voidConstructL()[protected]

ContextEntrySwitched()

voidContextEntrySwitched()[protected, virtual]

Called by the base class functions SwitchCurrentEntryL() and SetCurrentEntryL() when the context is changed to another entry.

Client applications do not use this function. It is relevant only to implementers of derived classes.

Requirements:

An implementation should clear:

1. address data stored in iAddresseeList

2. any caches of MTM-specific entry data relating to a previous context. For example, if the implementation has a private buffer storing a message subject, for access through Subject(), this buffer should be cleared.

CreateAttachmentL(const TDesC &, RFile &, const TDesC8 &, TUint, TRequestStatus &)

IMPORT_C voidCreateAttachmentL(const TDesC &aFileName,
RFile &aAttachmentFile,
const TDesC8 &aMimeType,
TUintaCharset,
TRequestStatus &aStatus
)[virtual]

Parameters

const TDesC & aFileName
RFile & aAttachmentFile
const TDesC8 & aMimeType
TUint aCharset
TRequestStatus & aStatus

CreateMessageL(TMsvId)

IMPORT_C voidCreateMessageL(TMsvIdaServiceId)[virtual]

Parameters

TMsvId aServiceId

DefaultServiceL()

IMPORT_C TMsvIdDefaultServiceL()const [virtual]

DoFindL(const TDesC &, TMsvPartList)

TMsvPartList DoFindL(const TDesC &aTextToFind,
TMsvPartListaPartList
)[private]

Parameters

const TDesC & aTextToFind
TMsvPartList aPartList

Find(const TDesC &, TMsvPartList)

TMsvPartList Find(const TDesC &aTextToFind,
TMsvPartListaPartList
)[virtual]

Searches the specified message part(s) for the plain-text version of the text to be found.

If the specified part list indicates a part that is not supported, or is not present in the current message, the function behaves as if the specified part exists but does not contain the required text.

Requirements:

The parts of the entry for which searching is allowed is implementation specific. If no searching is supported, always return 0.

If the text was not found, or searching is unsupported, 0. If the text was found, a bitmask of the TMsvPartList IDs for each part in which the text was present.

Parameters

const TDesC & aTextToFindThe plain-text version of the text to be found.
TMsvPartList aPartListIndicates the message parts which should be searched.

ForwardL(TMsvId, TMsvPartList, TRequestStatus &)

CMsvOperation *ForwardL(TMsvIdaDestination,
TMsvPartListaPartList,
TRequestStatus &aCompletionStatus
)[virtual]

Creates a forwarded message from the current message context.

Some MTMs may support inclusion of elements, specified by aPartlist, from the original message in the forwarded message. The parent for the new entry is specified in aDestination. The returned CMsvOperation object completes when editing the forwarded message is complete. On completion, the context is set to the forwarded message.

Requirements:

A typical implementation for this function would include the following steps:

1. create a new message in the specified destination by calling CMsvEntry::CreateL()

2. set the entry index values as appropriate

3. set message content as required. The normal minimum is to include the text of the original message. An implementation may also follow the options specified in aPartlist to include other properties of the original message.

4. set the context to the reply

5. return a CMsvOperation-derived object to provide asynchronous control and monitoring of the operation

If forwarded messages are not supported, implementations should leave with KErrNotSupported.

The implementation of this function may be similar to that of ReplyL(), allowing opportunities for code sharing.

leave

KErrNotSupported The Client-side MTM does not support creation of forwarded messages

leave

Other leave codes Dependent on implementation

If successful, this is an asynchronously completing forward message operation. If failed, this is a completed operation, with status set to the relevant error code.

Parameters

TMsvId aDestinationThe entry to which to assign the forwarded message
TMsvPartList aPartListDefines the parts that are to be copied from the original message into the forwarded message
TRequestStatus & aCompletionStatusThe request status to be completed when the operation has finished

GetAttachmentSizeL(CImEmailMessage &, TMsvId)

TInt32 GetAttachmentSizeL(CImEmailMessage &aMessage,
TMsvIdaMsvId
)[private]

Parameters

CImEmailMessage & aMessage
TMsvId aMsvId

GetBodyTextL(CImEmailMessage &, TMsvId)

voidGetBodyTextL(CImEmailMessage &aMessage,
TMsvIdaMsvId
)[private]

Parameters

CImEmailMessage & aMessage
TMsvId aMsvId

InvokeAsyncFunctionL(TInt, const CMsvEntrySelection &, TDes8 &, TRequestStatus &)

CMsvOperation *InvokeAsyncFunctionL(TIntaFunctionId,
const CMsvEntrySelection &aSelection,
TDes8 &aParameter,
TRequestStatus &aCompletionStatus
)[virtual]

Invokes asynchronous protocol-specific operations. For synchronous operations, a similar function, InvokeSyncFunctionL(), is available.

aSelection and aParameter allow data to be passed to the operation. The TRequestStatus and CMsvOperation objects are used as normal to control and monitor the operation.

Requirements:

For functionality that requires message transport access, such as making a connection, the implementation should pass the request onto the corresponding Server-side MTM. This is done through calling CMsvSession::TransferCommandL(). Implementations may also provide protocol-specific functions themselves if this is useful.

InvokeAsyncFunctionL() should return a CMsvOperation-derived object to provide asynchronous control and monitoring of the operation. If CMsvSession::TransferCommandL() is called, this should be the CMsvOperation object returned by that function.

leave

KErrNotSupported aFunctionId is not a recognised operation ID

leave

Other leave codes Dependent on implementation

If successful, this is an asynchronously completing operation. If failed, this is a completed operation, with status set to the relevant error code.

Parameters

TInt aFunctionIdID of the requested operation
const CMsvEntrySelection & aSelectionSelection of message entries. This is used if the operation requires message entries to work on.
TDes8 & aParameterBuffer containing input and output parameters. The format of this is specific to the operation.
TRequestStatus & aCompletionStatusThe request status to be completed when the operation has finished

InvokeSyncFunctionL(TInt, const CMsvEntrySelection &, TDes8 &)

voidInvokeSyncFunctionL(TIntaFunctionId,
const CMsvEntrySelection &aSelection,
TDes8 &aParameter
)[virtual]

Invokes synchronous protocol-specific operations. For asynchronous operations, a similar function, InvokeAsyncFunctionL(), is available.

aSelection and aParameter allow data to be passed to the operation.

Requirements:

For functionality that requires message transport access, such as making a connection, the implementation should pass the request onto the corresponding Server-side MTM. This is done through calling CMsvSession::TransferCommandL(). Implementations may also provide protocol-specific functions themselves if this is useful.

leave

KErrNotSupported aFunctionId is not a recognised operation ID

leave

Other leave codes Dependent on implementation

Parameters

TInt aFunctionIdID of the requested operation
const CMsvEntrySelection & aSelectionSelection of message entries. This is used if the operation requires message entries to work on.
TDes8 & aParameterBuffer containing input and output parameters. The format of this is specific to the operation.

LoadMessageL()

voidLoadMessageL()[virtual]

Loads the cache with the message data for the current context.

It can only be called on message contexts.

It is typically used after the context has been set with SetCurrentEntryL() or SwitchCurrentEntryL(). CBaseMtm functions to manipulate the entry can only be called after this function has been called.

Requirements:

An implementation must restore the store and index entry relating to the message context. Typically, the message store should be opened for reading with CMsvEntry::ReadStoreL(). It should be then be read to set the following:

1. body text: call RestoreBodyL() to update the cached body text

2. address list: read the appropriate MTM-specific area of the store to update iAddresseeList

3. subject: if supported, read the appropriate MTM-specific area of the store and update the cache with SetSubjectL()

The function should panic for non-message contexts.

NewL(CRegisteredMtmDll &, CMsvSession &)

IMPORT_C CSmtpClientMtm *NewL(CRegisteredMtmDll &aRegisteredMtmDll,
CMsvSession &aMsvSession
)[static]

Parameters

CRegisteredMtmDll & aRegisteredMtmDll
CMsvSession & aMsvSession

QueryCapability(TUid, TInt &)

TInt QueryCapability(TUidaCapability,
TInt &aResponse
)[virtual]

Parameters

TUid aCapability
TInt & aResponse

RemoveAddressee(TInt)

voidRemoveAddressee(TIntaIndex)[virtual]

Removes an address from the current address list. The address is specified by a zero-based index into the address list. If the index is not known, applications can use AddresseeList() to retrieve the entire list to find the item.

Requirements:

Implementations should call iAddresseeList->Delete(aIndex) to remove the address from in the address list protected data member.

Parameters

TInt aIndexIndex of address to be removed

RemoveDefaultServiceL()

IMPORT_C voidRemoveDefaultServiceL()[virtual]

ReplyL(TMsvId, TMsvPartList, TRequestStatus &)

CMsvOperation *ReplyL(TMsvIdaDestination,
TMsvPartListaPartlist,
TRequestStatus &aCompletionStatus
)[virtual]

Creates a reply message to the current message context.

Some MTMs may support inclusion of elements, specified by aPartlist, from the original message in the reply. The parent for the new entry is specified in aDestination.

The returned CMsvOperation object completes when creating the reply is complete. On completion, the context is set to the reply message.

Requirements:

A typical implementation for this function would include the following steps:

1. create a new message in the specified destination by calling CMsvEntry::CreateL()

2. set the entry index values as appropriate

3. set the properties of the message as required. The normal minimum is to set the address to the sender of the original message. An implementation may also follow the options specified in aPartlist to set other properties, for example, to include the original message text.

4. set the context to the reply

5. return a CMsvOperation-derived object to provide asynchronous control and monitoring of the operation

If message replies are not supported, implementations should leave with KErrNotSupported.

The implementation of this function may be similar to that of ForwardL(), allowing opportunities for code sharing.

leave

KErrNotSupported The Client-side MTM does not support reply operations

leave

Other leave codes Dependent on implementation

If successful, this is an asynchronously completing reply operation. If failed, this is a completed operation, with status set to the relevant error code.

Parameters

TMsvId aDestinationThe entry to which to assign the reply
TMsvPartList aPartlistDefines the parts that are to be copied from the original message into the reply
TRequestStatus & aCompletionStatusThe request status to be completed when the operation has finished

ResetData()

voidResetData()[private]

RestoreEmailMessageL()

voidRestoreEmailMessageL()[private]

RestoreSettingsL()

IMPORT_C voidRestoreSettingsL()

SaveMessageL()

voidSaveMessageL()[virtual]

Commits cached changes to the storage controlled by the Message Server.

It can only be called on message contexts. It should be called in the following circumstances:

1. to preserve changes when the context is changed, or when the Client-side MTM object is deleted

2. to enable other parts of the Messaging to access the updated entry, as required, for example, before sending a message

Requirements:

An implementation must update the store and index entry relating to the message context. Typically, the message store should be opened for editing with CMsvEntry::EditStoreL(). It should be updated as follows:

1. body text: call StoreBodyL() to update the store's body text stream

2. address list: update the appropriate MTM-specific area of the store from the data in iAddresseeList

3. subject: if supported, update the appropriate MTM-specific area of the store from the private cache set by SetSubjectL()

Changes can then be committed to the store with CMsvStore::CommitL().

The index entry should also be updated to reflect changes. Possible fields that may need updating include: Description (for subject changes); Details and Multiple Recipients (for recipient changes); and Size. Index entry changes are committed using CMsvEntry::ChangeL().

The function should panic for non-message contexts.

SetAddresseeListL()

voidSetAddresseeListL()[private]

SetSettingsL(const CImSmtpSettings &)

IMPORT_C voidSetSettingsL(const CImSmtpSettings &aSettings)

Parameters

const CImSmtpSettings & aSettings

SetSubjectL(const TDesC &)

IMPORT_C voidSetSubjectL(const TDesC &aSubject)[virtual]

Parameters

const TDesC & aSubject

Settings()

IMPORT_C const CImSmtpSettings &Settings()const

StoreEmailMessageL()

voidStoreEmailMessageL()[private]

StoreSettingsL()

IMPORT_C voidStoreSettingsL()

SubjectL()

IMPORT_C const TPtrCSubjectL()const [virtual]

ValidateAddress(const TPtrC &)

TBool ValidateAddress(const TPtrC &anAddress)[private]

Parameters

const TPtrC & anAddress

ValidateMessage(TMsvPartList)

TMsvPartList ValidateMessage(TMsvPartListaPartList)[virtual]

Validates the current message context.

The precise validation performed is specific to the MTM, but, typically, checks that the specified message parts are well-formed.

Requirements:

Implementation of this function is highly protocol-specific. A minimum step is to check that the current context is a message.

If valid, KErrNone If invalid, identifies the invalid part(s). The error value is the bitmask of the TMsvPartList IDs for each invalid part

Parameters

TMsvPartList aPartListIndicates the message parts for which validation is requested

Member Data Documentation

CImAttachmentWaiter * iAttachmentWaiter

CImAttachmentWaiter *iAttachmentWaiter[private]

HBufC * iEmailAddressFormatString

HBufC *iEmailAddressFormatString[private]

CImEmailMessage * iEmailMessage

CImEmailMessage *iEmailMessage[private]

CMsvEntrySelection * iEntrySelection

CMsvEntrySelection *iEntrySelection[private]

CImHeader * iHeader

CImHeader *iHeader[private]

CImEmailOperation * iImEmailOperation

CImEmailOperation *iImEmailOperation[private]

CImSmtpSettings * iImSmtpSettings

CImSmtpSettings *iImSmtpSettings[private]

HBufC * iSubject

HBufC *iSubject[private]

TImMessageField iTImMessageField

TImMessageField iTImMessageField[private]

CMsvOperationActiveSchedulerWait * iWait

CMsvOperationActiveSchedulerWait *iWait[private]