messagingappbase/smsmtm/clientmtm/inc/smut.h
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // smut.h 
       
    15 //
       
    16 #ifndef __SMUT_H__
       
    17 #define __SMUT_H__
       
    18 
       
    19 #include <msvstd.h>
       
    20 #include <msvids.h>
       
    21 #include <barsc.h>
       
    22 
       
    23 class CSmsMessage;
       
    24 class CContactItemField;
       
    25 class TResourceReader;
       
    26 class CMsvSession;
       
    27 class CMsvServerEntry;
       
    28 class CMsvEntry;
       
    29 class CSmsSettings;
       
    30 
       
    31 /**
       
    32 The SMS MTM UID.
       
    33 
       
    34 Used to identify the MTMs used for handling SMS messages.
       
    35 
       
    36 @publishedAll
       
    37 @released
       
    38 */
       
    39 const TUid KUidMsgTypeSMS			= {0x1000102C};
       
    40 
       
    41 /**
       
    42 The default maximum length used when extracting a description for an SMS message.
       
    43 
       
    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.
       
    47 
       
    48 The CSmsSettings provides accessors to get and set the preferred maximum
       
    49 description length.
       
    50 
       
    51 @deprecated
       
    52 This should not really be used outside of the SMS client MTM. The value provided
       
    53 by the CSmsSettings class should be used.
       
    54 
       
    55 @see	CSmsSettings::GetDescriptionLength
       
    56 */
       
    57 const TInt KSmsDescriptionLength	= 32;
       
    58 
       
    59 /**
       
    60 The default maximum length used when extracting the sender/recipiant details for
       
    61 an SMS message.
       
    62 
       
    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.
       
    66 
       
    67 @deprecated
       
    68 This should really be used at all.
       
    69 */
       
    70 const TInt KSmsDetailsLength		= 32;
       
    71 
       
    72 _LIT(KSmsResourceFile, "\\resource\\messaging\\SMSS.RSC");
       
    73 
       
    74 /**
       
    75 SMS Messaging utility functions.
       
    76 
       
    77 @publishedAll
       
    78 @released
       
    79 */
       
    80 class TSmsUtilities
       
    81 	{
       
    82 public:
       
    83 
       
    84 /**
       
    85 Special SMS Message Indication Type.
       
    86 
       
    87 A special SMS message indication is used to notify of waiting services, for
       
    88 instance a voicemail message.
       
    89 
       
    90 The TSmsUtilitiesSpecialMessageType enum represents the flags for the known
       
    91 indication types.
       
    92 */
       
    93 	enum TSmsUtilitiesSpecialMessageType
       
    94 		{
       
    95 /**
       
    96 Voice message waiting.
       
    97 */
       
    98 		EVoiceMessageWaiting = 0,
       
    99 /**
       
   100 Fax message waiting.
       
   101 */
       
   102 		EFaxMessageWaiting,
       
   103 /**
       
   104 E-mail message waiting.
       
   105 */
       
   106 		EEmailMessageWaiting,
       
   107 /**
       
   108 Other message-type waiting (see 3GPP TS 23.038 [9] for definition of "other").
       
   109 */
       
   110 		EOtherMessageWaiting,
       
   111 /**
       
   112 Mask used to obtain the mesasge indication type from the SMS data.
       
   113 */
       
   114 		ESpecialMessageTypeMask = 0x7F
       
   115 		};
       
   116 
       
   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
       
   120 
       
   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);
       
   123 
       
   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);
       
   127 
       
   128 	IMPORT_C static RResourceFile OpenResourceFileL(RFs& aFs);
       
   129 	IMPORT_C static void ReadResourceStringL(RResourceFile aResourceFile, TInt aResourceId, TDes& aString);
       
   130 
       
   131 private:
       
   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);
       
   136 
       
   137 	static TBool DoGetDescriptionL(const CSmsMessage& aMessage, TDes& aDescription, TInt aMaxLength);
       
   138 	static void ExtractDescriptionFromMessage(const CSmsMessage& aMessage, TDes& aDescription, TInt aMaxLength);
       
   139 
       
   140 	static TBool ValidGsmNumber(const TDesC& aTelephone);
       
   141 	};
       
   142 
       
   143 #endif	// __SMUT_H__