1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
24 class CContactItemField;
25 class TResourceReader;
27 class CMsvServerEntry;
34 Used to identify the MTMs used for handling SMS messages.
39 const TUid KUidMsgTypeSMS = {0x1000102C};
42 The default maximum length used when extracting a description for an SMS message.
44 Used as default value of aMaxLength in TSmsUtilities::GetDescription. This
45 function is used to extract a string to used as a suitable description field in
46 the message index for a particular SMS message.
48 The CSmsSettings provides accessors to get and set the preferred maximum
52 This should not really be used outside of the SMS client MTM. The value provided
53 by the CSmsSettings class should be used.
55 @see CSmsSettings::GetDescriptionLength
57 const TInt KSmsDescriptionLength = 32;
60 The default maximum length used when extracting the sender/recipiant details for
63 Used as default value of aMaxLength in TSmsUtilities::GetDetails. This function
64 is used to extract a string to used as the details field in the message index
65 for a particular SMS message.
68 This should really be used at all.
70 const TInt KSmsDetailsLength = 32;
72 _LIT(KSmsResourceFile, "\\resource\\messaging\\SMSS.RSC");
75 SMS Messaging utility functions.
85 Special SMS Message Indication Type.
87 A special SMS message indication is used to notify of waiting services, for
88 instance a voicemail message.
90 The TSmsUtilitiesSpecialMessageType enum represents the flags for the known
93 enum TSmsUtilitiesSpecialMessageType
96 Voice message waiting.
98 EVoiceMessageWaiting = 0,
104 E-mail message waiting.
106 EEmailMessageWaiting,
108 Other message-type waiting (see 3GPP TS 23.038 [9] for definition of "other").
110 EOtherMessageWaiting,
112 Mask used to obtain the mesasge indication type from the SMS data.
114 ESpecialMessageTypeMask = 0x7F
117 IMPORT_C static void ServiceIdL(CMsvServerEntry& aEntry, TMsvId& aFirstId, TUid aMtm = KUidMsgTypeSMS, CMsvEntrySelection* aServiceIds = NULL);
118 IMPORT_C static void ServiceIdL(CMsvEntry& aEntry, TMsvId& aFirstId, TUid aMtm = KUidMsgTypeSMS, CMsvEntrySelection* aServiceIds = NULL);
119 IMPORT_C static void ServiceIdL(CMsvSession& aSession, TMsvId& aFirstId, TUid aMtm = KUidMsgTypeSMS, CMsvEntrySelection* aServiceIds = NULL); //more efficient version of the previous one
121 IMPORT_C static void PopulateMsgEntry(TMsvEntry& aEntry, const CSmsMessage& aMessage, TMsvId aServiceId, TUid aMtm = KUidMsgTypeSMS);
122 IMPORT_C static void PopulateMsgEntry(TMsvEntry& aEntry, const CSmsMessage& aMessage, TMsvId aServiceId, const CSmsSettings& aSettings, TUid aMtm = KUidMsgTypeSMS);
124 IMPORT_C static TInt GetDetails(RFs& aFs, const CSmsMessage& aMessage, TDes& aDetails, TInt aMaxLength = KSmsDetailsLength);
125 IMPORT_C static TInt GetDetails(RFs& aFs, const TDesC& aFromAddress, TDes& aDetails, TInt aMaxLength = KSmsDetailsLength);
126 IMPORT_C static TInt GetDescription(const CSmsMessage& aMessage, TDes& aDescription, TInt aMaxLength = KSmsDescriptionLength);
128 IMPORT_C static RResourceFile OpenResourceFileL(RFs& aFs);
129 IMPORT_C static void ReadResourceStringL(RResourceFile aResourceFile, TInt aResourceId, TDes& aString);
132 static void CompareEntryL(const TMsvEntry& aEntry, TUid aMtm, TMsvId& aFirstId, CMsvEntrySelection* aServiceIds);
133 static void GetName(CContactItemField& aField, TUid aFieldType, TDes& aName);
134 static void DoGetDetailsL(RFs& aFs, const TDesC& aFromAddress, TDes& aDetails, TInt aMaxLength);
135 static void Replace(const TDesC& aOld, const TDesC& aNew, TDes& aString);
137 static TBool DoGetDescriptionL(const CSmsMessage& aMessage, TDes& aDescription, TInt aMaxLength);
138 static void ExtractDescriptionFromMessage(const CSmsMessage& aMessage, TDes& aDescription, TInt aMaxLength);
140 static TBool ValidGsmNumber(const TDesC& aTelephone);