|
1 /* |
|
2 * Copyright (c) 2005 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: Implementation of the IM Client interface (imclient.h) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef IMAPI_IMCLIENTIMPL_H |
|
21 #define IMAPI_IMCLIENTIMPL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "imclient.h" |
|
25 #include "impsimcli.h" |
|
26 |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CImConnectionImpl; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * Implementation of the MImClient abstract interface |
|
34 * |
|
35 * |
|
36 * @lib imclient.lib |
|
37 * @since S60 3.0 |
|
38 */ |
|
39 class CImClient : public CBase, |
|
40 public MImClient, |
|
41 public MImpsImHandler2, |
|
42 public MImpsErrorHandler2 |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 * @param aImConnection the Connection |
|
49 */ |
|
50 static CImClient* NewL( CImConnectionImpl& aImConnection ); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 virtual ~CImClient(); |
|
56 |
|
57 public: // New functions |
|
58 |
|
59 /** |
|
60 * Gets the Imps IM handler |
|
61 * @since S60 3.0 |
|
62 * @return MImpsImHandler |
|
63 */ |
|
64 MImpsImHandler2* ImpsImHandler(); |
|
65 |
|
66 /** |
|
67 * Gets the Imps Error handler |
|
68 * @since S60 3.0 |
|
69 * @return MImpsErrorHandler |
|
70 */ |
|
71 MImpsErrorHandler2& ImpsErrorHandler(); |
|
72 |
|
73 /** |
|
74 * Gets the Imps Engine |
|
75 * @since S60 3.0 |
|
76 * @return RImpsEngine |
|
77 */ |
|
78 RImpsEng& ImpsEngine(); |
|
79 |
|
80 /** |
|
81 * Gets the 3rd party IM observer |
|
82 * @since S60 3.0 |
|
83 * @return MImObserver |
|
84 */ |
|
85 MImObserver* ClientObserver(); |
|
86 |
|
87 public: // Functions from base classes |
|
88 |
|
89 /** |
|
90 * From MImClient |
|
91 * @see MImClient::RegisterL |
|
92 */ |
|
93 virtual void RegisterObserverL( |
|
94 MImObserver* aObserver ); |
|
95 |
|
96 /** |
|
97 * From MImClient |
|
98 * @see MImClient::UnregisterL |
|
99 */ |
|
100 virtual void UnregisterObserver( ); |
|
101 |
|
102 /** |
|
103 * From MImClient |
|
104 * @see MImClient::SendPToPMessage |
|
105 */ |
|
106 virtual TInt SendPToPMessageL( |
|
107 const TContactItemId& aContactItem, |
|
108 const TDesC16& aContent ); |
|
109 |
|
110 /** |
|
111 * From MImClient |
|
112 * @see MImClient::SendPToPMessage |
|
113 */ |
|
114 virtual TInt SendPToPMessageL( |
|
115 const CContactIdArray& aContactIds, |
|
116 const TDesC& aContentType, |
|
117 const TDesC8& aContent ); |
|
118 |
|
119 /** |
|
120 * From MImClient |
|
121 * @see MImClient::SendPToPMessage |
|
122 */ |
|
123 virtual TInt SendPToPMessageL( |
|
124 const MDesCArray& aUserIds, |
|
125 const TDesC& aContentType, |
|
126 const TDesC8& aContent ); |
|
127 |
|
128 /** |
|
129 * From MImClient |
|
130 * @see MImClient::SendPToPMessage |
|
131 */ |
|
132 virtual TInt SendPToPMessageL( |
|
133 const TDesC& aUserId, |
|
134 const TDesC16& aContent ); |
|
135 |
|
136 /** |
|
137 * From MImClient |
|
138 * @see MImClient::SendPToPMessage |
|
139 */ |
|
140 virtual TInt SendPToPMessageL( |
|
141 const CContactIdArray& aContactIds, |
|
142 const TDesC16& aContent ); |
|
143 |
|
144 /** |
|
145 * From MImClient |
|
146 * @see MImClient::SendPToPMessage |
|
147 */ |
|
148 virtual TInt SendPToPMessageL( |
|
149 const MDesCArray& aUserIds, |
|
150 const TDesC16& aContent ); |
|
151 /** |
|
152 * From MImpsImHandler2 |
|
153 * @see MImpsImHandler2::HandleNewTextMessageL |
|
154 */ |
|
155 virtual void HandleNewTextMessageL( |
|
156 TInt aOpId, |
|
157 const TDesC& aMessageId, |
|
158 const TDesC& aSender, |
|
159 const TDesC& aGroupId, |
|
160 const MDesCArray& aRecipients, |
|
161 const MDesCArray& aScreenNames, |
|
162 const TDesC& aText, |
|
163 TImpsCspIdentifier& aCspId ); |
|
164 |
|
165 /** |
|
166 * From MImpsImHandler2 |
|
167 * @see MImpsImHandler::HandleSendCompleteL |
|
168 */ |
|
169 virtual void HandleSendCompleteL( |
|
170 TInt aOpId, |
|
171 TBool aDeliveryReportOrdered, |
|
172 TImpsCspIdentifier& aCspId ); |
|
173 |
|
174 /** |
|
175 * From MImpsImHandler2 |
|
176 * @see MImpsImHandler2::HandleNewContentMessageL |
|
177 */ |
|
178 virtual void HandleNewContentMessageL( |
|
179 TInt aOpId, |
|
180 const TDesC& aMessageId, |
|
181 const TDesC& aSender, |
|
182 const TDesC& aGroupId, |
|
183 const MDesCArray& aRecipients, |
|
184 const MDesCArray& aScreenNames, |
|
185 const TDesC& aContentType, |
|
186 const TDesC8& aContent, |
|
187 TImpsCspIdentifier& aCspId ); |
|
188 |
|
189 /** |
|
190 * From MImpsImHandler2 |
|
191 * @see MImpsImHandler2::HandleDeliveryReportL |
|
192 */ |
|
193 virtual void HandleDeliveryReportL( |
|
194 const TDesC& aMessageId, |
|
195 TInt aResult, |
|
196 const TDesC* aDescription, |
|
197 TImpsCspIdentifier& aCspId ); |
|
198 |
|
199 /** |
|
200 * From MImpsErrorHandler |
|
201 * @see MImpsErrorHandler::HandleErrorL |
|
202 */ |
|
203 virtual void HandleErrorL( |
|
204 TInt aStatus, |
|
205 TInt aOpId, |
|
206 const TDesC* aDescription, |
|
207 const CImpsDetailed* aDetailedRes, |
|
208 TImpsCspIdentifier& aCspId ); |
|
209 |
|
210 |
|
211 private: |
|
212 |
|
213 /** |
|
214 * C++ default constructor. |
|
215 * @param aImConnection the Connection |
|
216 */ |
|
217 CImClient( CImConnectionImpl& aImConnection ); |
|
218 |
|
219 /** |
|
220 * By default Symbian 2nd phase constructor is private. |
|
221 */ |
|
222 void ConstructL(); |
|
223 |
|
224 /** |
|
225 * Sends IM using WV client |
|
226 * @param aUserIds the recipients list |
|
227 * @param aContentType the content type of the message |
|
228 * @param aContent the message |
|
229 * @return OpId |
|
230 */ |
|
231 TInt DoSendMessageL( |
|
232 const MDesCArray& aUserIds, |
|
233 const TDesC& aContent ); |
|
234 |
|
235 |
|
236 /** |
|
237 * Deletes the OpId from the outstanding OpIds list |
|
238 * @param aOpId an OpId to be deleted |
|
239 */ |
|
240 void RemoveOpId( TInt aOpId ); |
|
241 |
|
242 |
|
243 private: // Data |
|
244 CImConnectionImpl& iImConnection; // The API manager (not owned) |
|
245 RImpsImClient2 iImClient; // Imps IM client |
|
246 MImObserver* iClientObserver;// The user observer (not owned) |
|
247 RArray<TInt> iOutstandingOpIds; // OpIds waiting for response |
|
248 }; |
|
249 |
|
250 // CLASS DECLARATION |
|
251 // Detailed result item received from the remote SAP |
|
252 class TDetailedResultItem |
|
253 { |
|
254 public: |
|
255 TDetailedResultItem(); |
|
256 ~TDetailedResultItem(); |
|
257 |
|
258 /** |
|
259 * Error code setter |
|
260 * @param aErroCode the error code |
|
261 */ |
|
262 void SetErrorCode( TInt aErroCode ); |
|
263 |
|
264 /** |
|
265 * Error code getter |
|
266 * @return the error code |
|
267 */ |
|
268 TInt ErrorCode( ) const; |
|
269 |
|
270 /** |
|
271 * User ID setter |
|
272 * @param aUserId the user ID |
|
273 */ |
|
274 void SetUserId( TDesC& aUserId ); |
|
275 |
|
276 /** |
|
277 * User ID getter |
|
278 * @return the user ID |
|
279 */ |
|
280 const TDesC& UserId( ) const; |
|
281 |
|
282 private: |
|
283 TInt iErrorCode; |
|
284 TPtrC iUserId; |
|
285 }; |
|
286 |
|
287 /** |
|
288 * Implementation of the MImClientDetailedError abstract interface |
|
289 * |
|
290 * |
|
291 * @lib imclient.lib |
|
292 * @since S60 3.0 |
|
293 */ |
|
294 class CImClientDetailedErrorImpl : public CBase, |
|
295 public MImClientDetailedError |
|
296 { |
|
297 public: // Constructors and destructor |
|
298 |
|
299 /** |
|
300 * Two-phased constructor. |
|
301 * @param aImConnection the Connection |
|
302 */ |
|
303 static CImClientDetailedErrorImpl* NewL( |
|
304 const CImpsDetailed* aImpsDetailed ); |
|
305 |
|
306 /** |
|
307 * Destructor. |
|
308 */ |
|
309 virtual ~CImClientDetailedErrorImpl(); |
|
310 |
|
311 public: // Functions from base classes |
|
312 |
|
313 /** |
|
314 * From MImClientDetailedError |
|
315 * @see MImClientDetailedError::Count |
|
316 */ |
|
317 TInt Count(); |
|
318 |
|
319 /** |
|
320 * From MImClientDetailedError |
|
321 * @see MImClientDetailedError::UserId |
|
322 */ |
|
323 const TDesC& UserId( TInt aIndex ); |
|
324 |
|
325 /** |
|
326 * From MImClientDetailedError |
|
327 * @see MImClientDetailedError::ErrorCode |
|
328 */ |
|
329 TInt ErrorCode( TInt aIndex ); |
|
330 |
|
331 private: |
|
332 CImClientDetailedErrorImpl( ); |
|
333 void ConstructL( const CImpsDetailed* aImpsDetailed ); |
|
334 |
|
335 // Constructs the object from CImpsDetailed |
|
336 void DoInitL( const CImpsDetailed* aImpsDetailed ); |
|
337 |
|
338 /** |
|
339 * Converts the error code returned by the WV server to API error code. |
|
340 * @since 3.0 |
|
341 * @param aErroCode WV error code |
|
342 * @return API error code |
|
343 */ |
|
344 TInt ConvertWVErrorCode( TInt aErrorCode ); |
|
345 |
|
346 |
|
347 private: //Data |
|
348 CArrayFixFlat<TDetailedResultItem>* iDetailedList; |
|
349 |
|
350 }; |
|
351 |
|
352 |
|
353 #endif // IMAPI_IMCLIENTIMPL_H |
|
354 |
|
355 // End of File |