TMmsGenUtils Class Reference

class TMmsGenUtils
Public Member Functions
TMmsGenUtils ()
~TMmsGenUtils ()
IMPORT_C void AddAttributeL (const TDesC &, const TDesC &, CDesCArray &)
IMPORT_C TInt AddressTypeAndRealAddress (const TDesC &, TMmsAddressType &, TDes &, TInt , const TDesC &, const TDesC &)
IMPORT_C TPtrC Alias (const TDesC &, const TDesC &, const TDesC &)
IMPORT_C void DecodeAndConvertMessageHeaderL (const TDesC8 &, TDes16 &, RFs &)
IMPORT_C void DeleteAttribute (const TDesC &, CDesCArray &)
IMPORT_C TBool DiskSpaceBelowCriticalLevelL ( RFs *, TInt , TInt )
IMPORT_C TBool FindAttribute (const TDesC &, const CDesCArray &)
IMPORT_C HBufC * GenerateAddressL (const TDesC &, const TDesC &, const TDesC &, const TDesC &)
IMPORT_C TInt GenerateDetails (const TDesC &, TDes &, TInt , RFs &)
IMPORT_C TInt GetAlias (const TDesC &, TDes &, TInt , RFs &)
IMPORT_C void GetAliasForAllL (const CDesCArray &, CDesCArray &, TInt , RFs &)
IMPORT_C TPtrC GetAttributeL (const TDesC &, const CDesCArray &)
IMPORT_C void GetDescriptionL ( RFs &, const TDesC &, TInt , TPtrC8 , TInt , TDes &)
IMPORT_C void GetLoggingSettings ( TBool &, TBool &)
IMPORT_C TBool IsValidAddress (const TDesC &, TBool , const TDesC &, const TDesC &)
IMPORT_C TBool IsValidEmailAddress (const TDesC &, TBool , const TDesC &, const TDesC &)
IMPORT_C TBool IsValidMMSPhoneAddress (const TDesC &, TBool , const TDesC &, const TDesC &)
IMPORT_C void Log ( TRefByValue < const TDesC >, ...)
IMPORT_C TBool NetworkOperationsAllowed ()
IMPORT_C TPtrC PureAddress (const TDesC &, const TDesC &, const TDesC &)
IMPORT_C void ReplaceCRLFAndTrim ( TDes16 &)
IMPORT_C void ReplaceCRLFAndTrim ( TDes8 &)
Private Member Functions
TMmsGenUtils (const TMmsGenUtils &)
TInt DigitsToMatch ()
void DoGetAliasL ( RFs &, const TDesC &, TDes &, TInt )
void DoGetAliasL (const TDesC &, TDes &, TInt , CContactMatcher &, TInt )
TInt FindAttributePosition (const TDesC &, const CDesCArray &)
HBufC * GetContactNameInLowerCaseL (const MVPbkContactLink &, CContactMatcher &)
HBufC * GetContactNameL (const MVPbkContactLink &, CContactMatcher &)
TInt GetCurrentStoreIndexL ( CVPbkContactLinkArray &)
CContactMatcher * OpenAllStoresL ( RFs &)
TBool ShowContactNameL ( CVPbkContactLinkArray *, TInt &, CContactMatcher &)
TMmsGenUtils & operator= (const TMmsGenUtils &)

Constructor & Destructor Documentation

TMmsGenUtils()

IMPORT_C TMmsGenUtils ( )

Constructor.

TMmsGenUtils(const TMmsGenUtils &)

TMmsGenUtils ( const TMmsGenUtils & ) [private]

Parameters

const TMmsGenUtils &

~TMmsGenUtils()

IMPORT_C ~TMmsGenUtils ( )

Destructor.

Member Functions Documentation

AddAttributeL(const TDesC &, const TDesC &, CDesCArray &)

IMPORT_C void AddAttributeL ( const TDesC & aName,
const TDesC & aValue,
CDesCArray & aAttributeList
) [static]

Add attribute to an attribute array. No duplicates allowed If attribute exists, its value is changed

Parameters

const TDesC & aName Name of the attribute (case sensitive)
const TDesC & aValue Value of the attribute
CDesCArray & aAttributeList Array of attributes Leaves if memory runs out

AddressTypeAndRealAddress(const TDesC &, TMmsAddressType &, TDes &, TInt, const TDesC &, const TDesC &)

IMPORT_C TInt AddressTypeAndRealAddress ( const TDesC & aAddress,
TMmsAddressType & aType,
TDes & aRealAddress,
TInt aMaxLength,
const TDesC & aOpen = KSepaOpen,
const TDesC & aClose = KSepaClose
) [static]

Resolve address type and the real address part excluding alias definition. NOTE: Ipv4 and IPv6 not yet supported.

Parameters

const TDesC & aAddress address to be resolved. May include alias part.
TMmsAddressType & aType address type (OUT)
TDes & aRealAddress real address part (OUT)
TInt aMaxLength maximum length of the address.
const TDesC & aOpen = KSepaOpen
const TDesC & aClose = KSepaClose

Alias(const TDesC &, const TDesC &, const TDesC &)

IMPORT_C TPtrC Alias ( const TDesC & aAddress,
const TDesC & aOpen = KSepaOpen,
const TDesC & aClose = KSepaClose
) [static]

Alias part from the address.

Parameters

const TDesC & aAddress address to be resolved.
const TDesC & aOpen = KSepaOpen real address part start separator. Optional. Open bracket is default.
const TDesC & aClose = KSepaClose real address part end separator. Optional. Close bracket is default.

DecodeAndConvertMessageHeaderL(const TDesC8 &, TDes16 &, RFs &)

IMPORT_C void DecodeAndConvertMessageHeaderL ( const TDesC8 & aInput,
TDes16 & aOutput,
RFs & aFs
) [static]

Removes all escapes from standard URIs, and replaces them with chars. The user is reponsible for allocating the aOutput object prior to calling the method. (e.g. <space> character coding is changed from "%20" to " ".)

Parameters

const TDesC8 & aInput 'base64' or 'quoted-printable' encoded string (IN).
TDes16 & aOutput 16 bit unicode descriptor containing the resulting string.
RFs & aFs open file system handle

DeleteAttribute(const TDesC &, CDesCArray &)

IMPORT_C void DeleteAttribute ( const TDesC & aName,
CDesCArray & aAttributeList
) [static]

Delete named attribute from list

Parameters

const TDesC & aName Name of the attribute (case sensitive)
CDesCArray & aAttributeList Array of attributes

DigitsToMatch()

TInt DigitsToMatch ( ) [private, static]

Get number of digits to be used when matching phone numbers

DiskSpaceBelowCriticalLevelL(RFs *, TInt, TInt)

IMPORT_C TBool DiskSpaceBelowCriticalLevelL ( RFs * aFs,
TInt aBytesToWrite,
TInt aDrive
) [static]

Generic method to check if free drive storage space is or will fall below Critical Level (CL). The CL per drive is defined by this module.

Parameters

RFs * aFs File server session. Must be given if available in the caller. If NULL this method will create a temporary session for a check, but then the check is more expensive.
TInt aBytesToWrite number of bytes the caller is about to add FFS.The value 0 checks if the current space is already below the CL.
TInt aDrive number of the drive to be checked. (see TDriveNumber of f32file.h)

DoGetAliasL(RFs &, const TDesC &, TDes &, TInt)

void DoGetAliasL ( RFs & aFs,
const TDesC & aAddress,
TDes & aAlias,
TInt aMaxLength
) [private, static]

Generate alias from ContactDb based on given address.

Parameters

RFs & aFs file system
const TDesC & aAddress real address
TDes & aAlias generated alias name (OUT)
TInt aMaxLength maximum length of the alias

DoGetAliasL(const TDesC &, TDes &, TInt, CContactMatcher &, TInt)

void DoGetAliasL ( const TDesC & aAddress,
TDes & aAlias,
TInt aMaxLength,
CContactMatcher & aContactMatcher,
TInt aDigitsToMatch
) [private, static]

Generate aliases from ContactDb based on given address. This is optimized version of the previous DoGetAliasL because the contact db is opened before calling this function. Opening the db is quite an time consuming operation.

Parameters

const TDesC & aAddress real address
TDes & aAlias generated alias name (OUT)
TInt aMaxLength maximum length of the alias
CContactMatcher & aContactMatcher pointer to contact matcher
TInt aDigitsToMatch number of digits to match

FindAttribute(const TDesC &, const CDesCArray &)

IMPORT_C TBool FindAttribute ( const TDesC & aName,
const CDesCArray & aAttributeList
) [static]

Check if attribute is present

Parameters

const TDesC & aName Name of the attribute (case sensitive)
const CDesCArray & aAttributeList Array of attributes

FindAttributePosition(const TDesC &, const CDesCArray &)

TInt FindAttributePosition ( const TDesC & aName,
const CDesCArray & aAttributeList
) [private, static]

Find position of attribute

Parameters

const TDesC & aName Name of the attribute (case sensitive)
const CDesCArray & aAttributeList Array of attributes

GenerateAddressL(const TDesC &, const TDesC &, const TDesC &, const TDesC &)

IMPORT_C HBufC * GenerateAddressL ( const TDesC & aRealAddress,
const TDesC & aAlias,
const TDesC & aOpen = KSepaOpen,
const TDesC & aClose = KSepaClose
) [static]

Generate address from given address and alias

Parameters

const TDesC & aRealAddress real address
const TDesC & aAlias alias part
const TDesC & aOpen = KSepaOpen real address part start separator. Optional. Open bracket is default.
const TDesC & aClose = KSepaClose real address part end separator. Optional. Close bracket is default.

GenerateDetails(const TDesC &, TDes &, TInt, RFs &)

IMPORT_C TInt GenerateDetails ( const TDesC & aAddress,
TDes & aAlias,
TInt aMaxLength,
RFs & aFs
) [static]

Generate message details (alias) from ContactDb based on given address. Only default separators <> are allowed (compatibility with email)

Since
3.1

Parameters

const TDesC & aAddress address. May include alias part, which will be the result.
TDes & aAlias generated alias name (OUT). If no match in contact db then this is a real address part of aAddress.
TInt aMaxLength maximum length of the alias
RFs & aFs file system

GetAlias(const TDesC &, TDes &, TInt, RFs &)

IMPORT_C TInt GetAlias ( const TDesC & aAddress,
TDes & aAlias,
TInt aMaxLength,
RFs & aFs
) [static]

Get alias from ContactDb based on given address.

Since
3.1

Parameters

const TDesC & aAddress address (pure real address).
TDes & aAlias generated alias name (OUT).
TInt aMaxLength maximum length of the alias
RFs & aFs file system

GetAliasForAllL(const CDesCArray &, CDesCArray &, TInt, RFs &)

IMPORT_C void GetAliasForAllL ( const CDesCArray & aAddress,
CDesCArray & aAlias,
TInt aMaxLength,
RFs & aFs
) [static]

Get alias from ContactDb based on given address.

Since
3.1

Parameters

const CDesCArray & aAddress Array of addresses (pure real address).
CDesCArray & aAlias Array of generated alias names (OUT).
TInt aMaxLength maximum length of the alias
RFs & aFs file system Leaves in case of error

GetAttributeL(const TDesC &, const CDesCArray &)

IMPORT_C TPtrC GetAttributeL ( const TDesC & aName,
const CDesCArray & aAttributeList
) [static]

Get value for an attribute.

Parameters

const TDesC & aName Name of the attribute (case sensitive)
const CDesCArray & aAttributeList Array of attributes

GetContactNameInLowerCaseL(const MVPbkContactLink &, CContactMatcher &)

HBufC * GetContactNameInLowerCaseL ( const MVPbkContactLink & aContactLink,
CContactMatcher & aContactMatcher
) [private, static]

extracts contact name and converts to lower case chars. Caller must delete the name buffer returned

Parameters

const MVPbkContactLink & aContactLink - contact link
CContactMatcher & aContactMatcher - contact matcher

GetContactNameL(const MVPbkContactLink &, CContactMatcher &)

HBufC * GetContactNameL ( const MVPbkContactLink & aContactLink,
CContactMatcher & aContactMatcher
) [private, static]

extracts contact name out of the contact link passed Caller must delete the name buffer returned

Parameters

const MVPbkContactLink & aContactLink - contact link
CContactMatcher & aContactMatcher - contact matcher

GetCurrentStoreIndexL(CVPbkContactLinkArray &)

TInt GetCurrentStoreIndexL ( CVPbkContactLinkArray & aLinkArray ) [private, static]

Gets the index of contact match in current store. If multiple matches are found in current store, then the link Array is modified to include only current store contact matches for further name mapping. else, link array can be used as is for further name mapping

Parameters

CVPbkContactLinkArray & aLinkArray

GetDescriptionL(RFs &, const TDesC &, TInt, TPtrC8, TInt, TDes &)

IMPORT_C void GetDescriptionL ( RFs & aFs,
const TDesC & aPath,
TInt aFileSize,
TPtrC8 aMimetype,
TInt aCharSet,
TDes & aDescription
) [static]

Get message's description.

Parameters

RFs & aFs
const TDesC & aPath full path of the attachment binary file
TInt aFileSize attachment size
TPtrC8 aMimetype
TInt aCharSet attachment character set MIBEnum value.
TDes & aDescription message entry's description (OUT). Truncated as necessary to fit into return value.

GetLoggingSettings(TBool &, TBool &)

IMPORT_C void GetLoggingSettings ( TBool & aDecodeLoggingOn,
TBool & aDumpOn
) [static]
Read decode logging and dump settings from central repository
Since
3.2

Parameters

TBool & aDecodeLoggingOn tells if detailed logging is needed
TBool & aDumpOn tells if binary dump of message is needed

IsValidAddress(const TDesC &, TBool, const TDesC &, const TDesC &)

IMPORT_C TBool IsValidAddress ( const TDesC & aAddress,
TBool aReal = ETrue,
const TDesC & aOpen = KSepaOpen,
const TDesC & aClose = KSepaClose
) [static]

Validate the address. The address must be EMail address or MMS global phone number address.

Parameters

const TDesC & aAddress address to be resolved.
TBool aReal = ETrue is true if address is real address excluding alias definition.
const TDesC & aOpen = KSepaOpen real address part start separator. Optional. Open bracket is default.
const TDesC & aClose = KSepaClose real address part end separator. Optional. Close bracket is default.

IsValidEmailAddress(const TDesC &, TBool, const TDesC &, const TDesC &)

IMPORT_C TBool IsValidEmailAddress ( const TDesC & aAddress,
TBool aReal = ETrue,
const TDesC & aOpen = KSepaOpen,
const TDesC & aClose = KSepaClose
) [static]

Validate that the address contains valid EMail address.

Parameters

const TDesC & aAddress address to be resolved.
TBool aReal = ETrue is true if address is real address excluding alias definition.
const TDesC & aOpen = KSepaOpen real address part start separator. Optional. Open bracket is default.
const TDesC & aClose = KSepaClose real address part end separator. Optional. Close bracket is default.

IsValidMMSPhoneAddress(const TDesC &, TBool, const TDesC &, const TDesC &)

IMPORT_C TBool IsValidMMSPhoneAddress ( const TDesC & aAddress,
TBool aReal = ETrue,
const TDesC & aOpen = KSepaOpen,
const TDesC & aClose = KSepaClose
) [static]

Validate that the address contains valid MMS global phone number address. You do not need to strip off the alias before this method.

Parameters

const TDesC & aAddress address to be resolved.
TBool aReal = ETrue is true if address is real address without alias definition.
const TDesC & aOpen = KSepaOpen real address part start separator. Optional. Open bracket is default.
const TDesC & aClose = KSepaClose real address part end separator. Optional. Close bracket is default.

Log(TRefByValue< const TDesC >, ...)

IMPORT_C void Log ( TRefByValue < const TDesC > aFmt,
...
) [static]

Write message to MMS client log

Parameters

TRefByValue < const TDesC > aFmt like sprintf params in C++.
...

NetworkOperationsAllowed()

IMPORT_C TBool NetworkOperationsAllowed ( ) [static]

Check if network operations are allowed

OpenAllStoresL(RFs &)

CContactMatcher * OpenAllStoresL ( RFs & aFs ) [private, static]

Create contact match wrapper and open all stores Caller must close stores and delete contact matcher when no longer needed

Parameters

RFs & aFs file system

PureAddress(const TDesC &, const TDesC &, const TDesC &)

IMPORT_C TPtrC PureAddress ( const TDesC & aAddress,
const TDesC & aOpen = KSepaOpen,
const TDesC & aClose = KSepaClose
) [static]

Real address excluding alias part.

Parameters

const TDesC & aAddress address to be resolved.
const TDesC & aOpen = KSepaOpen real address part start separator. Optional. Open bracket is default.
const TDesC & aClose = KSepaClose real address part end separator. Optional. Close bracket is default.

ReplaceCRLFAndTrim(TDes16 &)

IMPORT_C void ReplaceCRLFAndTrim ( TDes16 & aDes ) [static]

Replaces CRs + LFs with spaces and trims all white spaces.

Parameters

TDes16 & aDes string where to replace CRs + LFs (IN/OUT)

ReplaceCRLFAndTrim(TDes8 &)

IMPORT_C void ReplaceCRLFAndTrim ( TDes8 & aDes ) [static]

Replaces CRs + LFs with spaces and trims all white spaces.

Parameters

TDes8 & aDes string where to replace CRs + LFs (IN/OUT)

ShowContactNameL(CVPbkContactLinkArray *, TInt &, CContactMatcher &)

TBool ShowContactNameL ( CVPbkContactLinkArray * aLinkArray,
TInt & aNameIndex,
CContactMatcher & aContactMatcher
) [private, static]

checks if contact names in the linkArray are identical. Can be used t Caller must delete the name buffer returned

Parameters

CVPbkContactLinkArray * aLinkArray
TInt & aNameIndex - index of the name to be finally shown(output param)
CContactMatcher & aContactMatcher - contact matcher

operator=(const TMmsGenUtils &)

TMmsGenUtils & operator= ( const TMmsGenUtils & ) [private]

Parameters

const TMmsGenUtils &