|
1 /* |
|
2 * Copyright (c) 2006 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: IMPS Protocol implementation for Presence Framework |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <ximpprotocolconnectionhost.h> |
|
20 #include "CPublishOwnPresencerequest.h" |
|
21 #include "impsconnectionmanagercontrolif.h" |
|
22 #include "impsdebugprint.h" |
|
23 #include "CImpsPluginAccessHandler.h" |
|
24 #include "CImpsPluginPureDataHandler.h" |
|
25 |
|
26 #include "impsplugintags.h" |
|
27 #include "CPEngXMLParser.h" |
|
28 #include "MPEngXMLParser.h" |
|
29 #include "CPEngXmlSerializer.h" |
|
30 #include "MPEngXmlSerializer.h" |
|
31 #include "CImpsPluginConnectionManager.h" |
|
32 #include "PEngXMLTags.h" |
|
33 |
|
34 #include <ximpobjectfactory.h> |
|
35 #include <ximpobjectcollection.h> |
|
36 #include <protocolpresencepublishingdatahost.h> |
|
37 |
|
38 #include <presentitygroupinfo.h> |
|
39 #include <presenceinfofieldvaluetext.h> |
|
40 #include <presenceinfofieldvalueenum.h> |
|
41 #include <presentitygroupmemberinfo.h> |
|
42 #include <ximpidentity.h> |
|
43 #include <presenceinfo.h> |
|
44 #include <personpresenceinfo.h> |
|
45 #include <servicepresenceinfo.h> |
|
46 #include <devicepresenceinfo.h> |
|
47 #include <presenceinfofield.h> |
|
48 #include <presenceinfofieldcollection.h> |
|
49 #include "PImpsAdapXMLTools.h" |
|
50 |
|
51 // ======== MEMBER FUNCTIONS ======== |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CPublishOwnPresencerequest::CPublishOwnPresencerequest |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 CPublishOwnPresencerequest::CPublishOwnPresencerequest( |
|
58 MImpsPrtPluginConnectionManager& aConnMan, |
|
59 TXIMPRequestId aRequestId ) : |
|
60 CActive( EPriorityNormal ), |
|
61 iRequestId( aRequestId ), |
|
62 iConnMan( aConnMan ) |
|
63 { |
|
64 IMPS_DP( D_IMPS_LIT( "::CPublishOwnPresencerequest Start" ) ); |
|
65 CActiveScheduler::Add( this ); |
|
66 |
|
67 IMPS_DP( D_IMPS_LIT( "::CPublishOwnPresencerequest End" ) ); |
|
68 } |
|
69 |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CPublishOwnPresencerequest::ConstructL |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 void CPublishOwnPresencerequest::ConstructL() |
|
76 { |
|
77 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::ConstructL Start-End" ) ); |
|
78 |
|
79 iParser = CreateXMLParserL(); |
|
80 |
|
81 } |
|
82 |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CPublishOwnPresencerequest::NewL |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CPublishOwnPresencerequest* CPublishOwnPresencerequest::NewL( |
|
89 MImpsPrtPluginConnectionManager& aConnMan, |
|
90 TXIMPRequestId aRequestId ) |
|
91 { |
|
92 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::NewL Start" ) ); |
|
93 |
|
94 CPublishOwnPresencerequest* self = new( ELeave ) |
|
95 CPublishOwnPresencerequest( aConnMan, aRequestId ); |
|
96 CleanupStack::PushL( self ); |
|
97 self->ConstructL(); |
|
98 CleanupStack::Pop( self ); |
|
99 |
|
100 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::NewL End" ) ); |
|
101 return self; |
|
102 } |
|
103 |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // CPublishOwnPresencerequest::NewLC |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 CPublishOwnPresencerequest* CPublishOwnPresencerequest::NewLC( |
|
110 MImpsPrtPluginConnectionManager& aConnMan, |
|
111 TXIMPRequestId aRequestId ) |
|
112 { |
|
113 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::NewLC Start" ) ); |
|
114 |
|
115 CPublishOwnPresencerequest* self = |
|
116 CPublishOwnPresencerequest::NewL( aConnMan, aRequestId ); |
|
117 CleanupStack::PushL( self ); |
|
118 |
|
119 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::NewLC End" ) ); |
|
120 return self; |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // CPublishOwnPresencerequest::~CPublishOwnPresencerequest |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 CPublishOwnPresencerequest::~CPublishOwnPresencerequest() |
|
128 { |
|
129 IMPS_DP( D_IMPS_LIT( "::~CPublishOwnPresencerequest Start" ) ); |
|
130 |
|
131 delete iResponse; |
|
132 CActive::Cancel(); |
|
133 iConnMan.Remove( this ); |
|
134 delete iParser; |
|
135 |
|
136 IMPS_DP( D_IMPS_LIT( "::~CPublishOwnPresencerequest End" ) ); |
|
137 } |
|
138 |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // CPublishOwnPresencerequest::DoCancel() |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 void CPublishOwnPresencerequest::DoCancel() |
|
145 { |
|
146 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::DoCancel Start" ) ); |
|
147 |
|
148 iConnMan.DataHandler().CancelSending( iSendId ); |
|
149 |
|
150 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::DoCancel End" ) ); |
|
151 } |
|
152 |
|
153 |
|
154 // --------------------------------------------------------------------------- |
|
155 // CPublishOwnPresencerequest::RunL() |
|
156 // --------------------------------------------------------------------------- |
|
157 // |
|
158 void CPublishOwnPresencerequest::RunL() |
|
159 { |
|
160 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::RunL Start" ) ); |
|
161 |
|
162 User::LeaveIfError( iStatus.Int() ); |
|
163 |
|
164 iResponse = iConnMan.DataHandler().ResponseL( iSendId ); |
|
165 |
|
166 TPtrC8 resultBlock( NULL, 0 ); |
|
167 TInt wvErrorCode = KErrNone; |
|
168 |
|
169 //Look for mandatory parts |
|
170 if ( iParser->DecodeL( *iResponse, KResultXMLTag, ETrue ) ) |
|
171 { |
|
172 resultBlock.Set( iParser->ResultL() ); |
|
173 if ( iParser->DecodeL( resultBlock, KCodeXMLTag, EFalse ) ) |
|
174 { |
|
175 TPtrC8 cspStatusCodeBlock( iParser->ResultL() ); |
|
176 TInt cspStatusInt; |
|
177 TLex8 lexer( cspStatusCodeBlock ); |
|
178 lexer.SkipSpace(); |
|
179 TInt lexErr = lexer.Val( cspStatusInt ); |
|
180 if ( lexErr == KErrNone ) |
|
181 { |
|
182 wvErrorCode = cspStatusInt; |
|
183 } |
|
184 } |
|
185 } |
|
186 |
|
187 // from server notification extract the own presence details |
|
188 // and update the data in PrFw. |
|
189 |
|
190 IMPS_DP( D_IMPS_LIT( "PublishOwnPresencerequest Returns %d" ), wvErrorCode ); |
|
191 iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, wvErrorCode ); |
|
192 |
|
193 delete this; |
|
194 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::RunL End" ) ); |
|
195 } |
|
196 |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 // CPublishOwnPresencerequest::RunError |
|
200 // --------------------------------------------------------------------------- |
|
201 // |
|
202 TInt CPublishOwnPresencerequest::RunError( TInt aError ) |
|
203 { |
|
204 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::RunError Start" ) ); |
|
205 |
|
206 iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); |
|
207 |
|
208 delete this; |
|
209 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::RunError End" ) ); |
|
210 return KErrNone; |
|
211 } |
|
212 |
|
213 // --------------------------------------------------------------------------- |
|
214 // CPublishOwnPresencerequest::PublishOwnPresenceL |
|
215 // --------------------------------------------------------------------------- |
|
216 // |
|
217 void CPublishOwnPresencerequest::PublishOwnPresenceL( const MPresenceInfo& aPresence ) |
|
218 { |
|
219 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::PublishOwnPresenceL Start" ) ); |
|
220 |
|
221 TPtr8 ptrbuffer( iConnMan.DataHandler().TransferBufferL() ); |
|
222 MPEngXMLSerializer* serializer = CreateXmlSerializerLC( ptrbuffer ); |
|
223 |
|
224 // extract device and service specific count of fields from the info |
|
225 TInt devicecount = aPresence.DevicePresenceCount(); |
|
226 TInt servicecount = aPresence.ServicePresenceCount(); |
|
227 TInt personcount = aPresence.PersonPresence()->Fields().FieldCount(); |
|
228 IMPS_DP( D_IMPS_LIT( "PublishOwnPresenceL Info :device %d service %d " ), |
|
229 devicecount, servicecount ); |
|
230 |
|
231 // how many person pres attributes are set? |
|
232 |
|
233 IMPS_DP( D_IMPS_LIT( "PublishOwnPresenceL Info: person %d " ), personcount ); |
|
234 |
|
235 |
|
236 NImpsAdapXMLTools::AppendTransactionContentTagXmlL( *serializer, iConnMan.GetVersion() ); |
|
237 |
|
238 serializer->StartTagL( KUpdatePresenceRequest ); |
|
239 serializer->StartTagL( KPresenceSubList ); |
|
240 serializer->AttributeL( KXmlXmlns, KPresenceSubListAttributesNS_CSP12 ); |
|
241 ExtractPersonPresenceAttributesL( aPresence, serializer ); |
|
242 ExtractDevicePresenceAttributesL( aPresence, serializer ); |
|
243 ExtractServicePresenceAttributesL( aPresence, serializer ); |
|
244 |
|
245 // extract service presence attributes as below |
|
246 |
|
247 |
|
248 serializer->EndTagL( KPresenceSubList ); |
|
249 serializer->EndTagL( KUpdatePresenceRequest ); |
|
250 serializer->EndTagL( KTransactionContent ); |
|
251 |
|
252 CleanupStack::PopAndDestroy(); //serializer |
|
253 |
|
254 iSendId = iConnMan.DataHandler().SendDataL( iStatus ); |
|
255 |
|
256 IMPS_DP( D_IMPS_LIT( " PublishOwnPresenceL SendData Request id %d " ), iSendId ); |
|
257 // signal the scheduler |
|
258 SetActive(); |
|
259 |
|
260 IMPS_DP( D_IMPS_LIT( "CPublishOwnPresencerequest::PublishOwnPresenceL End" ) ); |
|
261 } |
|
262 |
|
263 // --------------------------------------------------------------------------- |
|
264 // CPublishOwnPresencerequest::ExtractPersonPresenceAttributes |
|
265 // --------------------------------------------------------------------------- |
|
266 // |
|
267 void CPublishOwnPresencerequest::ExtractPersonPresenceAttributesL( |
|
268 const MPresenceInfo& aPresence, |
|
269 MPEngXMLSerializer* aSerializer ) |
|
270 { |
|
271 IMPS_DP( D_IMPS_LIT( "::ExtractPersonPresenceAttributes End" ) ); |
|
272 |
|
273 |
|
274 const MPersonPresenceInfo* personPresence = aPresence.PersonPresence(); |
|
275 |
|
276 const MPresenceInfoFieldCollection& presenceFields = personPresence->Fields(); |
|
277 RPointerArray< HBufC > clientinfoattribute; |
|
278 TInt fieldCount = presenceFields.FieldCount(); |
|
279 TInt count( 0 ); |
|
280 TInt clintinfo[5]; |
|
281 |
|
282 for ( TInt bx( 0 ); bx < fieldCount; bx++ ) |
|
283 { |
|
284 const MPresenceInfoField& presenceField = presenceFields.FieldAt( bx ); |
|
285 |
|
286 TBuf8<32> temp = presenceField.FieldType(); |
|
287 |
|
288 // iterate through each of the field for the values |
|
289 IMPS_DP( D_IMPS_LIT( "ExtractPersonPresenceAttributes:%S " ), &presenceField.FieldType() ); |
|
290 |
|
291 |
|
292 if ( presenceField.FieldType().Compare( KUserAvailabilityXMLTag ) == 0 ) |
|
293 { |
|
294 const MPresenceInfoFieldValueEnum* availability = |
|
295 TXIMPGetInterface< const MPresenceInfoFieldValueEnum >::From( |
|
296 presenceField.FieldValue(), |
|
297 MXIMPBase::EPanicIfUnknown ); |
|
298 |
|
299 // now manufacture the message for the online status |
|
300 aSerializer->StartTagL( KUserAvailabilityXMLTag ); |
|
301 aSerializer->StartTagL( KQualifierXMLTag |
|
302 ).NarrowTextL( KXMLValueTrue |
|
303 ).EndTagL( KQualifierXMLTag ); |
|
304 if ( availability->Value() == 2 ) |
|
305 { |
|
306 aSerializer->StartTagL( KPresenceValueXMLTag |
|
307 ).NarrowTextL( KAvailableXMLTag |
|
308 ).EndTagL( KPresenceValueXMLTag ); |
|
309 } |
|
310 else if ( availability->Value() == 1 ) |
|
311 { |
|
312 aSerializer->StartTagL( KPresenceValueXMLTag |
|
313 ).NarrowTextL( KNotAvailableXMLTag |
|
314 ).EndTagL( KPresenceValueXMLTag ); |
|
315 } |
|
316 aSerializer->EndTagL( KUserAvailabilityXMLTag ); |
|
317 |
|
318 } |
|
319 |
|
320 // publishing online status |
|
321 if ( presenceField.FieldType().Compare( KOnlineStatusXMLTag ) == 0 ) |
|
322 { |
|
323 const MPresenceInfoFieldValueText* onlinestatus = |
|
324 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
325 presenceField.FieldValue(), |
|
326 MXIMPBase::EPanicIfUnknown ); |
|
327 |
|
328 // now manufacture the message for the status text |
|
329 |
|
330 aSerializer->StartTagL( KOnlineStatusXMLTag ); |
|
331 aSerializer->StartTagL( KQualifierXMLTag |
|
332 ).NarrowTextL( KXMLValueTrue |
|
333 ).EndTagL( KQualifierXMLTag ); |
|
334 aSerializer->StartTagL( KPresenceValueXMLTag |
|
335 ).NarrowTextL( KXMLValueTrue |
|
336 ).EndTagL( KPresenceValueXMLTag ); |
|
337 aSerializer->EndTagL( KOnlineStatusXMLTag ); |
|
338 |
|
339 } |
|
340 |
|
341 // publishing status text |
|
342 |
|
343 |
|
344 if ( presenceField.FieldType().Compare( KStatusTextXMLTag ) == 0 ) |
|
345 { |
|
346 const MPresenceInfoFieldValueText* statustext = |
|
347 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
348 presenceField.FieldValue(), |
|
349 MXIMPBase::EPanicIfUnknown ); |
|
350 |
|
351 // now manufacture the message for the status text |
|
352 |
|
353 aSerializer->StartTagL( KStatusTextXMLTag ); |
|
354 aSerializer->StartTagL( KQualifierXMLTag |
|
355 ).NarrowTextL( KXMLValueTrue |
|
356 ).EndTagL( KQualifierXMLTag ); |
|
357 aSerializer->StartTagL( KPresenceValueXMLTag |
|
358 ).UnicodeTextL( statustext->TextValue() |
|
359 ).EndTagL( KPresenceValueXMLTag ); |
|
360 aSerializer->EndTagL( KStatusTextXMLTag ); |
|
361 |
|
362 } |
|
363 // end of status text |
|
364 |
|
365 |
|
366 // publishing status mood |
|
367 if ( presenceField.FieldType().Compare( KStatusMood ) == 0 ) |
|
368 { |
|
369 const MPresenceInfoFieldValueText* statusmood = |
|
370 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
371 presenceField.FieldValue(), |
|
372 MXIMPBase::EPanicIfUnknown ); |
|
373 |
|
374 // now manufacture the message for the status Mood |
|
375 |
|
376 aSerializer->StartTagL( KStatusMoodXMLTag ); |
|
377 aSerializer->StartTagL( KQualifierXMLTag |
|
378 ).NarrowTextL( KXMLValueTrue |
|
379 ).EndTagL( KQualifierXMLTag ); |
|
380 aSerializer->StartTagL( KPresenceValueXMLTag |
|
381 ).UnicodeTextL( statusmood->TextValue() |
|
382 ).EndTagL( KPresenceValueXMLTag ); |
|
383 aSerializer->EndTagL( KStatusMoodXMLTag ); |
|
384 |
|
385 } |
|
386 //end of status tag |
|
387 |
|
388 //publishing Alias |
|
389 |
|
390 if ( presenceField.FieldType().Compare( KAliasXMLTag ) == 0 ) |
|
391 { |
|
392 const MPresenceInfoFieldValueText* alias = |
|
393 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
394 presenceField.FieldValue(), |
|
395 MXIMPBase::EPanicIfUnknown ); |
|
396 |
|
397 // now manufacture the message for the alias |
|
398 |
|
399 aSerializer->StartTagL( KAliasXMLTag ); |
|
400 aSerializer->StartTagL( KQualifierXMLTag |
|
401 ).NarrowTextL( KXMLValueTrue |
|
402 ).EndTagL( KQualifierXMLTag ); |
|
403 aSerializer->StartTagL( KPresenceValueXMLTag |
|
404 ).UnicodeTextL( alias->TextValue() |
|
405 ).EndTagL( KPresenceValueXMLTag ); |
|
406 aSerializer->EndTagL( KAliasXMLTag ); |
|
407 |
|
408 } |
|
409 //end of Alias |
|
410 |
|
411 //publishing preferred language |
|
412 if ( presenceField.FieldType().Compare( KPreferredLanguage ) == 0 ) |
|
413 { |
|
414 const MPresenceInfoFieldValueText* preferredlanguage = |
|
415 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
416 presenceField.FieldValue(), |
|
417 MXIMPBase::EPanicIfUnknown ); |
|
418 |
|
419 |
|
420 // now manufacture the message for the language |
|
421 |
|
422 aSerializer->StartTagL( KPreferredLanguage ); |
|
423 aSerializer->StartTagL( KQualifierXMLTag |
|
424 ).NarrowTextL( KXMLValueTrue |
|
425 ).EndTagL( KQualifierXMLTag ); |
|
426 aSerializer->StartTagL( KPresenceValueXMLTag |
|
427 ).UnicodeTextL( preferredlanguage->TextValue() |
|
428 ).EndTagL( KPresenceValueXMLTag ); |
|
429 aSerializer->EndTagL( KPreferredLanguage ); |
|
430 |
|
431 } |
|
432 |
|
433 //end of preferred language |
|
434 |
|
435 if ( presenceField.FieldType().Compare( KStatusContentXMLTag ) == 0 ) |
|
436 { |
|
437 const MPresenceInfoFieldValueText* statuscontent = |
|
438 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
439 presenceField.FieldValue(), |
|
440 MXIMPBase::EPanicIfUnknown ); |
|
441 |
|
442 // now manufacture the message for the status content |
|
443 |
|
444 aSerializer->StartTagL( KStatusContentXMLTag ); |
|
445 aSerializer->StartTagL( KQualifierXMLTag |
|
446 ).NarrowTextL( KXMLValueTrue |
|
447 ).EndTagL( KQualifierXMLTag ); |
|
448 aSerializer->StartTagL( KPresenceValueXMLTag |
|
449 ).UnicodeTextL( statuscontent->TextValue() |
|
450 ).EndTagL( KPresenceValueXMLTag ); |
|
451 aSerializer->EndTagL( KStatusContentXMLTag ); |
|
452 |
|
453 } |
|
454 |
|
455 if ( presenceField.FieldType().Compare( KLinkXMLTag ) == 0 ) |
|
456 { |
|
457 const MPresenceInfoFieldValueText* link = |
|
458 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
459 presenceField.FieldValue(), |
|
460 MXIMPBase::EPanicIfUnknown ); |
|
461 // now manufacture the message for the status content |
|
462 |
|
463 aSerializer->StartTagL( KInfoLinkXMLTag ); |
|
464 aSerializer->StartTagL( KInflink ); |
|
465 aSerializer->StartTagL( KQualifierXMLTag |
|
466 ).NarrowTextL( KXMLValueTrue |
|
467 ).EndTagL( KQualifierXMLTag ); |
|
468 aSerializer->StartTagL( KLinkXMLTag |
|
469 ).UnicodeTextL( link->TextValue() |
|
470 ).EndTagL( KLinkXMLTag ); |
|
471 aSerializer->EndTagL( KInflink ); |
|
472 aSerializer->EndTagL( KInfoLinkXMLTag ); |
|
473 |
|
474 } |
|
475 if ( presenceField.FieldType().Compare( KTextXMLTag ) == 0 ) |
|
476 { |
|
477 const MPresenceInfoFieldValueText* text = |
|
478 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
479 presenceField.FieldValue(), |
|
480 MXIMPBase::EPanicIfUnknown ); |
|
481 // now manufacture the message for the status content |
|
482 |
|
483 aSerializer->StartTagL( KInfoLinkXMLTag ); |
|
484 aSerializer->StartTagL( KInflink ); |
|
485 aSerializer->StartTagL( KQualifierXMLTag |
|
486 ).NarrowTextL( KXMLValueTrue |
|
487 ).EndTagL( KQualifierXMLTag ); |
|
488 aSerializer->StartTagL( KTextXMLTag |
|
489 ).UnicodeTextL( text->TextValue() |
|
490 ).EndTagL( KTextXMLTag ); |
|
491 aSerializer->EndTagL( KInflink ); |
|
492 aSerializer->EndTagL( KInfoLinkXMLTag ); |
|
493 |
|
494 } |
|
495 if ( presenceField.FieldType().Compare( KContentTypeXMLTag ) == 0 ) |
|
496 { |
|
497 const MPresenceInfoFieldValueText* text = |
|
498 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
499 presenceField.FieldValue(), |
|
500 MXIMPBase::EPanicIfUnknown ); |
|
501 // now manufacture the message for the status content |
|
502 |
|
503 aSerializer->StartTagL( KInfoLinkXMLTag ); |
|
504 aSerializer->StartTagL( KInflink ); |
|
505 aSerializer->StartTagL( KQualifierXMLTag |
|
506 ).NarrowTextL( KXMLValueTrue |
|
507 ).EndTagL( KQualifierXMLTag ); |
|
508 aSerializer->StartTagL( KContentTypeXMLTag |
|
509 ).UnicodeTextL( text->TextValue() |
|
510 ).EndTagL( KContentTypeXMLTag ); |
|
511 aSerializer->EndTagL( KInflink ); |
|
512 aSerializer->EndTagL( KInfoLinkXMLTag ); |
|
513 |
|
514 } |
|
515 // publish client info |
|
516 if ( ( presenceField.FieldType().Compare( KClientTypeXMLTag ) == 0 ) || |
|
517 ( presenceField.FieldType().Compare( KClientLanguageXMLTag ) == 0 ) || |
|
518 ( presenceField.FieldType().Compare( KDevManufacturerXMLTag ) == 0 ) || |
|
519 ( presenceField.FieldType().Compare( KDeviceModelXMLTag ) == 0 ) ) |
|
520 { |
|
521 |
|
522 // TDesC8 temp = presenceField.FieldType(); |
|
523 // clientinfoattribute.AppendL(*temp); |
|
524 clintinfo[count++] = bx; |
|
525 |
|
526 |
|
527 |
|
528 } |
|
529 |
|
530 // publish common capability |
|
531 |
|
532 if ( presenceField.FieldType().Compare( KCommCapStatusXMLTag ) == 0 ) |
|
533 { |
|
534 |
|
535 aSerializer->StartTagL( KCommCapXMLTag ); |
|
536 aSerializer->StartTagL( KCommCXMLTag ); |
|
537 aSerializer->StartTagL( KCommCapXMLTagCap ).RawValueL( KCommCapIMXMLTag ).EndTagL( KCommCapXMLTagCap ); |
|
538 |
|
539 |
|
540 const MPresenceInfoFieldValueText* status = |
|
541 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
542 presenceField.FieldValue(), |
|
543 MXIMPBase::EPanicIfUnknown ); |
|
544 aSerializer->StartTagL( KCommCapStatusXMLTag |
|
545 ).UnicodeTextL( status->TextValue() |
|
546 ).EndTagL( KCommCapStatusXMLTag ); |
|
547 aSerializer->EndTagL( KCommCapXMLTag ); |
|
548 aSerializer->EndTagL( KCommCXMLTag ); |
|
549 |
|
550 |
|
551 } |
|
552 |
|
553 } |
|
554 |
|
555 if ( count > 0 ) |
|
556 { |
|
557 |
|
558 aSerializer->StartTagL( KClientInfoXMLTag ); |
|
559 aSerializer->StartTagL( KQualifierXMLTag |
|
560 ).NarrowTextL( KXMLValueTrue |
|
561 ).EndTagL( KQualifierXMLTag ); |
|
562 |
|
563 for ( TInt ix( 0 );ix < count;ix++ ) |
|
564 |
|
565 { |
|
566 const MPresenceInfoField& presenceField = presenceFields.FieldAt( clintinfo[ix] ); |
|
567 // putting client type |
|
568 |
|
569 if ( presenceField.FieldType().Compare( KClientTypeXMLTag ) == 0 ) |
|
570 { |
|
571 const MPresenceInfoFieldValueText* clienttype = |
|
572 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
573 presenceField.FieldValue(), |
|
574 MXIMPBase::EPanicIfUnknown ); |
|
575 aSerializer->StartTagL( KClientTypeXMLTag |
|
576 ).UnicodeTextL( clienttype->TextValue() |
|
577 ).EndTagL( KClientTypeXMLTag ); |
|
578 |
|
579 } |
|
580 |
|
581 //client langauage |
|
582 if ( presenceField.FieldType().Compare( KClientLanguageXMLTag ) == 0 ) |
|
583 { |
|
584 const MPresenceInfoFieldValueText* clientlangauage = |
|
585 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
586 presenceField.FieldValue(), |
|
587 MXIMPBase::EPanicIfUnknown ); |
|
588 aSerializer->StartTagL( KClientLanguageXMLTag |
|
589 ).UnicodeTextL( clientlangauage->TextValue() |
|
590 ).EndTagL( KClientLanguageXMLTag ); |
|
591 |
|
592 } |
|
593 |
|
594 // device manufacturer |
|
595 if ( presenceField.FieldType().Compare( KDevManufacturerXMLTag ) == 0 ) |
|
596 { |
|
597 const MPresenceInfoFieldValueText* devmanu = |
|
598 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
599 presenceField.FieldValue(), |
|
600 MXIMPBase::EPanicIfUnknown ); |
|
601 aSerializer->StartTagL( KDevManufacturerXMLTag |
|
602 ).UnicodeTextL( devmanu->TextValue() |
|
603 ).EndTagL( KDevManufacturerXMLTag ); |
|
604 |
|
605 } |
|
606 |
|
607 // device modal |
|
608 |
|
609 if ( presenceField.FieldType().Compare( KDeviceModelXMLTag ) == 0 ) |
|
610 { |
|
611 const MPresenceInfoFieldValueText* devmodal = |
|
612 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
613 presenceField.FieldValue(), |
|
614 MXIMPBase::EPanicIfUnknown ); |
|
615 aSerializer->StartTagL( KDeviceModelXMLTag |
|
616 ).UnicodeTextL( devmodal->TextValue() |
|
617 ).EndTagL( KDeviceModelXMLTag ); |
|
618 |
|
619 } |
|
620 // now manufacture the message for the status Mood |
|
621 } |
|
622 |
|
623 aSerializer->EndTagL( KClientInfoXMLTag ); |
|
624 } |
|
625 |
|
626 IMPS_DP( D_IMPS_LIT( "::ExtractPersonPresenceAttributes End" ) ); |
|
627 } |
|
628 |
|
629 // --------------------------------------------------------------------------- |
|
630 // CPublishOwnPresencerequest::ExtractServicePresenceAttributes |
|
631 // --------------------------------------------------------------------------- |
|
632 // |
|
633 void CPublishOwnPresencerequest::ExtractServicePresenceAttributesL( |
|
634 const MPresenceInfo& aPresence, |
|
635 MPEngXMLSerializer* aSerializer ) |
|
636 { |
|
637 IMPS_DP( D_IMPS_LIT( "::ExtractServicePresenceAttributes End" ) ); |
|
638 TInt servicePresences = aPresence.ServicePresenceCount(); |
|
639 |
|
640 for ( TInt ix( 0 ); ix < servicePresences; ix++ ) |
|
641 { |
|
642 const MServicePresenceInfo& servicePresence = aPresence.ServicePresenceAt( ix ); |
|
643 const MPresenceInfoFieldCollection& presenceFields = servicePresence.Fields(); |
|
644 |
|
645 TInt fieldCount = presenceFields.FieldCount(); |
|
646 for ( TInt bx( 0 ); bx < fieldCount; bx++ ) |
|
647 { |
|
648 const MPresenceInfoField& presenceField = presenceFields.FieldAt( bx ); |
|
649 if ( presenceField.FieldType().Compare( KRegistrationXMLTag ) == 0 ) |
|
650 { |
|
651 const MPresenceInfoFieldValueText* registration = |
|
652 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( presenceField.FieldValue(), |
|
653 MXIMPBase::EPanicIfUnknown ); |
|
654 |
|
655 aSerializer->StartTagL( KRegistrationXMLTag ); |
|
656 aSerializer->StartTagL( KQualifierXMLTag |
|
657 ).NarrowTextL( KXMLValueTrue |
|
658 ).EndTagL( KQualifierXMLTag ); |
|
659 aSerializer->StartTagL( KPresenceValueXMLTag |
|
660 ).UnicodeTextL( registration->TextValue() |
|
661 ).EndTagL( KPresenceValueXMLTag ); |
|
662 aSerializer->EndTagL( KRegistrationXMLTag ); |
|
663 } |
|
664 } |
|
665 } |
|
666 |
|
667 |
|
668 IMPS_DP( D_IMPS_LIT( "::ExtractServicePresenceAttributes End" ) ); |
|
669 } |
|
670 |
|
671 // --------------------------------------------------------------------------- |
|
672 // CPublishOwnPresencerequest::ExtractDevicePresenceAttributes |
|
673 // --------------------------------------------------------------------------- |
|
674 // |
|
675 void CPublishOwnPresencerequest::ExtractDevicePresenceAttributesL( |
|
676 const MPresenceInfo& aPresence, |
|
677 MPEngXMLSerializer* aSerializer ) |
|
678 { |
|
679 |
|
680 IMPS_DP( D_IMPS_LIT( "::ExtractDevicePresenceAttributes End" ) ); |
|
681 |
|
682 TInt devicePresenceCount = aPresence.DevicePresenceCount(); |
|
683 |
|
684 for ( TInt ix( 0 ); ix < devicePresenceCount; ix++ ) |
|
685 { |
|
686 const MDevicePresenceInfo& devicePresence = aPresence.DevicePresenceAt( ix ); |
|
687 const MPresenceInfoFieldCollection& presenceFields = devicePresence.Fields(); |
|
688 |
|
689 TInt fieldCount = presenceFields.FieldCount(); |
|
690 |
|
691 for ( TInt bx( 0 ); bx < fieldCount; bx++ ) |
|
692 { |
|
693 const MPresenceInfoField& presenceField = presenceFields.FieldAt( bx ); |
|
694 |
|
695 if ( presenceField.FieldType().Compare( KPlmn ) == 0 ) |
|
696 { |
|
697 const MPresenceInfoFieldValueText* plmn = |
|
698 TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( |
|
699 presenceField.FieldValue(), |
|
700 MXIMPBase::EPanicIfUnknown ); |
|
701 |
|
702 aSerializer->StartTagL( KPlmn ); |
|
703 aSerializer->StartTagL( KQualifierXMLTag |
|
704 ).NarrowTextL( KXMLValueTrue |
|
705 ).EndTagL( KQualifierXMLTag ); |
|
706 aSerializer->StartTagL( KPresenceValueXMLTag |
|
707 ).UnicodeTextL( plmn->TextValue() |
|
708 ).EndTagL( KPresenceValueXMLTag ); |
|
709 aSerializer->EndTagL( KPlmn ); |
|
710 } |
|
711 |
|
712 |
|
713 } |
|
714 } |
|
715 |
|
716 IMPS_DP( D_IMPS_LIT( "::ExtractDevicePresenceAttributes End" ) ); |
|
717 } |
|
718 |
|
719 // End of file |