|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Utility class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _C_CS_MSG_PLUGIN_UTILITY_H_ |
|
20 #define _C_CS_MSG_PLUGIN_UTILITY_H_ |
|
21 |
|
22 // SYSTEM INCLUDES |
|
23 #include <msvapi.h> |
|
24 #include <smuthdr.h> // CSmsHeader |
|
25 #include <txtetext.h> |
|
26 #include <msvids.h> |
|
27 #include <ccsdefs.h> |
|
28 #include <ccsconversationentry.h> |
|
29 |
|
30 // FORWARD DECLARATION |
|
31 class CCsConversationEntry; |
|
32 |
|
33 /** |
|
34 * Message plugin Utility Class |
|
35 * This class provides some utility methods |
|
36 */ |
|
37 class CCsMsgPluginUtility: public CBase |
|
38 { |
|
39 |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Two phase construction |
|
44 */ |
|
45 static CCsMsgPluginUtility* NewL(); |
|
46 |
|
47 /** |
|
48 * Destructor |
|
49 */ |
|
50 virtual ~CCsMsgPluginUtility(); |
|
51 |
|
52 /** |
|
53 * Creates CCsConversationEntry using input parameters |
|
54 * |
|
55 * @since S60 |
|
56 * @param aContact Conatct details |
|
57 * @param aEnryId Unique Id |
|
58 * @param aTimeStamp time stamp details |
|
59 * @param aDir TMsvId of Parent |
|
60 * @param aDescription description of the body message |
|
61 * @param aSendState TCsSendState enum value |
|
62 * @param aMsgAttribs TCsAttribute enum value |
|
63 * @return CCsConversationEntry object |
|
64 */ |
|
65 CCsConversationEntry* CreateConversationEntryL( |
|
66 const HBufC* aContact, |
|
67 TMsvId aEnryId, |
|
68 TInt64 aTimeStamp, |
|
69 TMsvId aDir, |
|
70 const HBufC* aDescription, |
|
71 TCsSendState aSendState, |
|
72 TCsAttribute aMsgAttribs, |
|
73 TCsType aCsType) const ; |
|
74 |
|
75 /** |
|
76 * Map the call direction to TCsDirection. |
|
77 * |
|
78 * @since S60 |
|
79 * @param aDir The direction string which needs to be mapped |
|
80 * @return TCsDirection enum value |
|
81 */ |
|
82 TCsDirection MapDirection( TMsvId aDir ) const; |
|
83 |
|
84 /** |
|
85 * Returns the message attributes as a bitmask of TCsAttribute values. |
|
86 * |
|
87 * @param aEntry Message entry. |
|
88 * @return A bitmask of TCsAttribute values. |
|
89 * @see TCsAttribute |
|
90 */ |
|
91 TUint16 GetMsgAttributes( const TMsvEntry& aEntry ); |
|
92 |
|
93 /** |
|
94 * Returns the send status. |
|
95 * |
|
96 * @param aContext Message entry. |
|
97 * @return send status like failed, sent, suspended etc. |
|
98 * @see TCsSendState |
|
99 */ |
|
100 TCsSendState GetSendState( const TMsvEntry& aContext ); |
|
101 |
|
102 /** |
|
103 * Create the Contact (From/To) of the message |
|
104 * |
|
105 * @param aSession Message Server session |
|
106 * @param aEntry Message entry |
|
107 * @param addressList List from extracted from/to addresses |
|
108 */ |
|
109 void CreateContactL( CMsvSession* aSession, |
|
110 const TMsvEntry& aEntry, |
|
111 RPointerArray<HBufC>& addressList); |
|
112 |
|
113 /** |
|
114 * Compare previous entry with new entry |
|
115 * |
|
116 * @param aOldContext previous Message entry |
|
117 * @param aNewContext new Message entry |
|
118 * @param aDir entry folder |
|
119 * @return ETrue/EFalse for same/different |
|
120 */ |
|
121 TBool CompareEntry( const TMsvEntry& aOldContext, |
|
122 const TMsvEntry& aNewContext, |
|
123 TMsvId aDir ) const; |
|
124 |
|
125 /** |
|
126 * Extracts name and address from the aMsvAddress |
|
127 * which is of the form name<address> |
|
128 * @param aMsvAddress which is of the form name<address> |
|
129 * @param aName extracted name |
|
130 * @param aAddress extracted address |
|
131 */ |
|
132 void NameAndAddress( const TPtrC& aMsvAddress, |
|
133 TPtrC& aName, |
|
134 TPtrC& aAddress ); |
|
135 |
|
136 /** |
|
137 * Extract the address part for MMS ignoring the alias |
|
138 */ |
|
139 TPtrC PureAddress(const TDesC& aAddress); |
|
140 |
|
141 private: |
|
142 /** |
|
143 * Constructor |
|
144 */ |
|
145 CCsMsgPluginUtility(); |
|
146 |
|
147 }; |
|
148 |
|
149 #endif // _C_CS_MSG_PLUGIN_UTILITY_H_ |