1 /* |
|
2 * Copyright (c) 2006-2009 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: IETF SIMPLE Protocol implementation for XIMP Framework |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <badesca.h> |
|
20 #include <ximpbase.h> |
|
21 #include <ximpserviceinfo.h> |
|
22 #include <protocolpresencefeatures.h> |
|
23 #include <cprotocolimfeatures.h> |
|
24 #include <protocolpresencedatahost.h> |
|
25 #include <presenceobjectfactory.h> |
|
26 |
|
27 #include <ximpcontextclientinfo.h> |
|
28 #include <protocolpresenceauthorization.h> |
|
29 #include <ximpprotocolconnectionhost.h> |
|
30 #include <ximpfeatureinfo.h> //for etc. KPublish |
|
31 #include <msimpleconnection.h> //Part of Registration API from SIMPLE engine |
|
32 #include <msimpleconnectionobserver.h>//Connection callback methods |
|
33 #include <presenceinfo.h> |
|
34 |
|
35 #include "presencepluginconnection.h" |
|
36 #include "presencepluginsession.h" |
|
37 #include "mpresencepluginconnectionobs.h" |
|
38 #include "presencepluginwatcher.h" |
|
39 #include "presencepluginauthorization.h" |
|
40 #include "presencepluginwinfo.h" |
|
41 #include "presencepluginpublisher.h" |
|
42 #include "presenceplugingroup.h" |
|
43 #include "presencepluginxdmutils.h" |
|
44 #include "presencepluginvirtualgroup.h" |
|
45 #include "presenceconnectioninfo.h" |
|
46 #include "presenceplugindata.h" |
|
47 |
|
48 #include "simpleimpluginuids.hrh" //KImplUidSimpleImPlugin |
|
49 |
|
50 // ======== MEMBER FUNCTIONS ======== |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // CPresencePluginConnection::CPresencePluginConnection() |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CPresencePluginConnection::CPresencePluginConnection( ): |
|
57 CActive( CActive::EPriorityHigh ), iSipPresentity(NULL), |
|
58 iStopPublishState( EFalse ), iGrantListSubs( EFalse ), iStopPublishCall( EFalse ), |
|
59 iTerminatedCall( EFalse ) |
|
60 { |
|
61 DP_SDA("CPresencePluginConnection::CPresencePluginConnection"); |
|
62 CActiveScheduler::Add(this); |
|
63 iOwnTupleId = 0; |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CPresencePluginConnection::NewL() |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 CPresencePluginConnection* CPresencePluginConnection::NewL( |
|
71 const MXIMPServiceInfo& aServiceInfo, |
|
72 const MXIMPContextClientInfo& aClientCtxInfo ) |
|
73 { |
|
74 DP_SDA("CPresencePluginConnection::NewL"); |
|
75 CPresencePluginConnection* self = |
|
76 new( ELeave ) CPresencePluginConnection( ); |
|
77 CleanupStack::PushL( self ); |
|
78 self->ConstructL( aServiceInfo, aClientCtxInfo ); |
|
79 CleanupStack::Pop( self ); |
|
80 return self; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CPresencePluginConnection::NewL() loaded |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CPresencePluginConnection* CPresencePluginConnection::NewL( |
|
88 const MXIMPServiceInfo& aServiceInfo, |
|
89 const MXIMPContextClientInfo& aClientCtxInfo, |
|
90 const TDesC8& aETag ) |
|
91 { |
|
92 DP_SDA("CPresencePluginConnection::NewL loaded"); |
|
93 CPresencePluginConnection* self = |
|
94 new( ELeave ) CPresencePluginConnection( ); |
|
95 CleanupStack::PushL( self ); |
|
96 self->ConstructL( aServiceInfo, aClientCtxInfo, aETag ); |
|
97 CleanupStack::Pop( self ); |
|
98 return self; |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // CPresencePluginConnection::ConstructL() loaded |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 void CPresencePluginConnection::ConstructL( |
|
106 const MXIMPServiceInfo& aServiceInfo, |
|
107 const MXIMPContextClientInfo& /*aClientCtxInfo*/, |
|
108 const TDesC8& aETag ) |
|
109 { |
|
110 DP_SDA("CPresencePluginConnection::ConstructL loaded"); |
|
111 |
|
112 iETag = aETag.AllocL(); |
|
113 |
|
114 iSession = CPresencePluginSession::NewL( aServiceInfo, *this ); |
|
115 |
|
116 // create instance from data class |
|
117 iPresenceData = CPresencePluginData::NewL( *this, |
|
118 aServiceInfo.IapId() ); |
|
119 |
|
120 DP_SDA("ConstructL create subscribed buddy list loaded "); |
|
121 // create another virtual group for all subscribed buddyes |
|
122 iSubscribedBuddys = |
|
123 CPresencePluginVirtualGroup::NewL( *this, |
|
124 KPresenceBuddyList(), |
|
125 iPresenceData ); |
|
126 |
|
127 iAuth = CPresencePluginAuthorization::NewL( *this, iPresenceData ); |
|
128 |
|
129 iPublisher = CPresencePluginPublisher::NewL( |
|
130 *this, |
|
131 *iSession->SimpleConnection(), |
|
132 iPresenceData ); |
|
133 |
|
134 iWatcher = CPresencePluginWatcher::NewL( |
|
135 *this, |
|
136 *iSession->SimpleConnection(), |
|
137 iPresenceData ); |
|
138 |
|
139 iGroups = CPresencePluginGroups::NewL( |
|
140 *this, iSubscribedBuddys, iPresenceData ); |
|
141 |
|
142 iPluginWinfo = CPresencePluginWinfo::NewL( |
|
143 *this, *(iSession->SimpleConnection() )); |
|
144 |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // CPresencePluginConnection::ConstructL() |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 void CPresencePluginConnection::ConstructL( |
|
152 const MXIMPServiceInfo& aServiceInfo, |
|
153 const MXIMPContextClientInfo& /*aClientCtxInfo*/ ) |
|
154 { |
|
155 DP_SDA("CPresencePluginConnection::ConstructL"); |
|
156 |
|
157 iETag = KNullDesC8().AllocL(); |
|
158 |
|
159 iSession = CPresencePluginSession::NewL( aServiceInfo, *this ); |
|
160 |
|
161 // create instance from data class |
|
162 iPresenceData = CPresencePluginData::NewL( *this, |
|
163 aServiceInfo.IapId() ); |
|
164 |
|
165 DP_SDA("ConstructL create subscribed buddy list"); |
|
166 // create another virtual group for all subscribed buddyes |
|
167 iSubscribedBuddys = |
|
168 CPresencePluginVirtualGroup::NewL( |
|
169 *this, KPresenceBuddyList(), iPresenceData ); |
|
170 |
|
171 iAuth = CPresencePluginAuthorization::NewL( *this, iPresenceData ); |
|
172 |
|
173 iPublisher = CPresencePluginPublisher::NewL( |
|
174 *this, |
|
175 *iSession->SimpleConnection(), |
|
176 iPresenceData ); |
|
177 |
|
178 iWatcher = CPresencePluginWatcher::NewL( |
|
179 *this, |
|
180 *iSession->SimpleConnection(), |
|
181 iPresenceData ); |
|
182 |
|
183 iGroups = CPresencePluginGroups::NewL( |
|
184 *this, iSubscribedBuddys, iPresenceData ); |
|
185 |
|
186 iPluginWinfo = CPresencePluginWinfo::NewL( |
|
187 *this, *(iSession->SimpleConnection() )); |
|
188 |
|
189 } |
|
190 |
|
191 // --------------------------------------------------------------------------- |
|
192 // CPresencePluginConnection::~CPresencePluginConnection() |
|
193 // --------------------------------------------------------------------------- |
|
194 // |
|
195 CPresencePluginConnection::~CPresencePluginConnection() |
|
196 { |
|
197 DP_SDA("CPresencePluginConnection::~CPresencePluginConnection"); |
|
198 |
|
199 delete iSipPresentity; |
|
200 iSipPresentity = NULL; |
|
201 |
|
202 delete iPluginWinfo; |
|
203 iPluginWinfo = NULL; |
|
204 |
|
205 delete iWatcher; |
|
206 iWatcher = NULL; |
|
207 |
|
208 delete iPublisher; |
|
209 iPublisher = NULL; |
|
210 |
|
211 delete iAuth; |
|
212 iAuth = NULL; |
|
213 |
|
214 delete iGroups; |
|
215 iGroups = NULL; |
|
216 |
|
217 delete iSession; |
|
218 iSession = NULL; |
|
219 |
|
220 delete iImFeatures; |
|
221 REComSession::FinalClose(); |
|
222 |
|
223 delete iSubscribedBuddys; |
|
224 delete iPresenceData; |
|
225 |
|
226 delete iETag; |
|
227 iETag = NULL; |
|
228 DP_SDA("CPresencePluginConnection::~CPresencePluginConnection end"); |
|
229 } |
|
230 |
|
231 // --------------------------------------------------------------------------- |
|
232 // CPresencePluginConnection::PrimeHost |
|
233 // --------------------------------------------------------------------------- |
|
234 // |
|
235 void CPresencePluginConnection::PrimeHost( |
|
236 MXIMPProtocolConnectionHost& aHost ) |
|
237 { |
|
238 DP_SDA("CPresencePluginConnection::PrimeHost"); |
|
239 iConnectionHost = &aHost; |
|
240 iAuth->SetDataHost( |
|
241 iConnectionHost->ProtocolPresenceDataHost().AuthorizationDataHost() ); |
|
242 } |
|
243 |
|
244 // --------------------------------------------------------------------------- |
|
245 // CPresencePluginConnection::GetOnlineBuddyGroup() |
|
246 // --------------------------------------------------------------------------- |
|
247 // |
|
248 CPresencePluginVirtualGroup* CPresencePluginConnection::SubscribedContacts( ) |
|
249 { |
|
250 return iSubscribedBuddys; |
|
251 } |
|
252 |
|
253 // --------------------------------------------------------------------------- |
|
254 // CPresencePluginConnection::GetSessionStatus() |
|
255 // --------------------------------------------------------------------------- |
|
256 // |
|
257 TBool CPresencePluginConnection::GetSessionStatus( ) |
|
258 { |
|
259 return iSession->ConnectionStatus(); |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------------------------- |
|
263 // CPresencePluginConnection::TupleIdGet() |
|
264 // --------------------------------------------------------------------------- |
|
265 // |
|
266 TInt CPresencePluginConnection::GetTupleId() const |
|
267 { |
|
268 DP_SDA("CPresencePluginConnection::TupleIdGet"); |
|
269 return iOwnTupleId; |
|
270 } |
|
271 |
|
272 // --------------------------------------------------------------------------- |
|
273 // CPresencePluginConnection::GetEtag() |
|
274 // --------------------------------------------------------------------------- |
|
275 // |
|
276 const TDesC8& CPresencePluginConnection::GetETag() const |
|
277 { |
|
278 DP_SDA("CPresencePluginConnection::GetETag"); |
|
279 |
|
280 if( !iETag ) |
|
281 { |
|
282 DP_SDA2("CPresencePluginConnection::GetETag empty ??? %S", iConnectionArray->GetConnectionEtag() ); |
|
283 return KNullDesC8(); |
|
284 } |
|
285 |
|
286 return *iETag; |
|
287 } |
|
288 |
|
289 // --------------------------------------------------------------------------- |
|
290 // CPresencePluginConnection::SetETag() |
|
291 // --------------------------------------------------------------------------- |
|
292 // |
|
293 void CPresencePluginConnection::SetETag( const TDesC8& aETag ) |
|
294 { |
|
295 DP_SDA("CPresencePluginConnection::SetETag"); |
|
296 delete iETag; |
|
297 iETag = NULL; |
|
298 |
|
299 TRAP_IGNORE( ( iETag = aETag.AllocL() ) ); |
|
300 //Add etag also in connectionArray |
|
301 iConnectionArray->SetConnectionETag( *iETag ); |
|
302 } |
|
303 |
|
304 // --------------------------------------------------------------------------- |
|
305 // CPresencePluginConnection::SetConnectionArray() |
|
306 // --------------------------------------------------------------------------- |
|
307 // |
|
308 void CPresencePluginConnection::SetConnectionArray( |
|
309 CPresenceConnectionInfo* aArray ) |
|
310 { |
|
311 DP_SDA("CPresencePluginConnection::SetConnectionArray"); |
|
312 iConnectionArray = aArray; |
|
313 iConnectionArray->SetConnectionStatus( EActive ); |
|
314 } |
|
315 |
|
316 // --------------------------------------------------------------------------- |
|
317 // CPresencePluginConnection::GetConnectionArray() |
|
318 // --------------------------------------------------------------------------- |
|
319 // |
|
320 CPresenceConnectionInfo* CPresencePluginConnection::GetConnectionArray( ) |
|
321 { |
|
322 DP_SDA("CPresencePluginConnection::GetConnectionArray"); |
|
323 return iConnectionArray; |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------------------------- |
|
327 // CPresencePluginConnection::TupleIdGet() |
|
328 // --------------------------------------------------------------------------- |
|
329 // |
|
330 TInt32 CPresencePluginConnection::GetPresenceSetId() const |
|
331 { |
|
332 DP_SDA("CPresencePluginConnection::GetPresenceSetId"); |
|
333 return iSession->GetPresenceSetId(); |
|
334 } |
|
335 |
|
336 // --------------------------------------------------------------------------- |
|
337 // CPresencePluginConnection::TupleIdGet() |
|
338 // --------------------------------------------------------------------------- |
|
339 // |
|
340 void CPresencePluginConnection::SetTupleId( const TInt aTupleId ) |
|
341 { |
|
342 DP_SDA("CPresencePluginConnection::TupleIdSet"); |
|
343 iOwnTupleId = aTupleId; |
|
344 } |
|
345 |
|
346 // --------------------------------------------------------------------------- |
|
347 // CPresencePluginConnection::GetStopPublishState() |
|
348 // --------------------------------------------------------------------------- |
|
349 // |
|
350 TBool CPresencePluginConnection::GetStopPublishState() |
|
351 { |
|
352 DP_SDA2("::GetStopPublishState = %d", (TInt)iStopPublishState ); |
|
353 return iStopPublishState; |
|
354 } |
|
355 |
|
356 // --------------------------------------------------------------------------- |
|
357 // CPresencePluginConnection::SetStopPublishState() |
|
358 // --------------------------------------------------------------------------- |
|
359 // |
|
360 void CPresencePluginConnection::SetStopPublishState( TBool aState ) |
|
361 { |
|
362 DP_SDA2("SetStopPublishState : aState = %d ", (TInt)aState ); |
|
363 iStopPublishState = aState; |
|
364 } |
|
365 |
|
366 // --------------------------------------------------------------------------- |
|
367 // CPresencePluginConnection::PresenceWatching |
|
368 // --------------------------------------------------------------------------- |
|
369 // |
|
370 MProtocolPresenceDataHost& CPresencePluginConnection::ProtocolPresenceHost() |
|
371 { |
|
372 DP_SDA("CPresencePluginConnection::ProtocolPresenceHost"); |
|
373 return iConnectionHost->ProtocolPresenceDataHost(); |
|
374 } |
|
375 |
|
376 // --------------------------------------------------------------------------- |
|
377 // CPresencePluginConnection::PresenceWatching |
|
378 // --------------------------------------------------------------------------- |
|
379 // |
|
380 MProtocolPresenceWatching& CPresencePluginConnection::PresenceWatching() |
|
381 { |
|
382 DP_SDA("CPresencePluginConnection::PresenceWatching"); |
|
383 return *iWatcher; |
|
384 } |
|
385 |
|
386 // --------------------------------------------------------------------------- |
|
387 // CPresencePluginConnection::PresencePublishing |
|
388 // --------------------------------------------------------------------------- |
|
389 // |
|
390 MProtocolPresencePublishing& CPresencePluginConnection::PresencePublishing() |
|
391 { |
|
392 return *iPublisher; |
|
393 } |
|
394 |
|
395 // --------------------------------------------------------------------------- |
|
396 // CPresencePluginConnection::PresentityGroups |
|
397 // --------------------------------------------------------------------------- |
|
398 // |
|
399 MProtocolPresentityGroups& CPresencePluginConnection::PresentityGroups() |
|
400 { |
|
401 return *iGroups; |
|
402 } |
|
403 |
|
404 // --------------------------------------------------------------------------- |
|
405 // CPresencePluginConnection::PresenceAuthorization |
|
406 // --------------------------------------------------------------------------- |
|
407 // |
|
408 MProtocolPresenceAuthorization& |
|
409 CPresencePluginConnection::PresenceAuthorization() |
|
410 { |
|
411 DP_SDA2("CPresencePluginConnection::PresenceAuthorization %x", iAuth); |
|
412 return *iAuth; |
|
413 } |
|
414 |
|
415 // --------------------------------------------------------------------------- |
|
416 // CPresencePluginConnection::InternalPresenceAuthorization |
|
417 // --------------------------------------------------------------------------- |
|
418 // |
|
419 CPresencePluginAuthorization& |
|
420 CPresencePluginConnection::InternalPresenceAuthorization() |
|
421 { |
|
422 DP_SDA2("CPresencePluginConnection::InternalPresenceAuthorization %x", iAuth); |
|
423 return *iAuth; |
|
424 } |
|
425 |
|
426 // --------------------------------------------------------------------------- |
|
427 // CPresencePluginConnection::OpenSessionL |
|
428 // --------------------------------------------------------------------------- |
|
429 // |
|
430 void CPresencePluginConnection::OpenSessionL( |
|
431 const MXIMPContextClientInfo& /*aClientCtxInfo*/, |
|
432 TXIMPRequestId aReqId ) |
|
433 { |
|
434 DP_SDA("CPresencePluginConnection::OpenSessionL"); |
|
435 iGrantListSubs = ETrue; |
|
436 iTerminatedCall = EFalse; |
|
437 iXIMPId = aReqId; |
|
438 iSession->OpenSessionL(); |
|
439 } |
|
440 |
|
441 // --------------------------------------------------------------------------- |
|
442 // CPresencePluginConnection::OpenSessionL |
|
443 // --------------------------------------------------------------------------- |
|
444 // |
|
445 void CPresencePluginConnection::OpenSessionL( const TInt& /*aSettingsId*/, |
|
446 TXIMPRequestId aReqId ) |
|
447 { |
|
448 DP_SDA("CPresencePluginConnection::OpenSessionL 2 "); |
|
449 iXIMPId = aReqId; |
|
450 iGrantListSubs = ETrue; |
|
451 iTerminatedCall = EFalse; |
|
452 iSession->OpenSessionL( ); |
|
453 } |
|
454 |
|
455 // --------------------------------------------------------------------------- |
|
456 // CPresencePluginConnection::CloseSession |
|
457 // --------------------------------------------------------------------------- |
|
458 // |
|
459 void CPresencePluginConnection::CloseSession( |
|
460 const MXIMPContextClientInfo& /*aContextClient*/, |
|
461 TXIMPRequestId aReqId ) |
|
462 { |
|
463 DP_SDA("CPresencePluginConnection::CloseSession begin"); |
|
464 iConnectionArray->DecreaseClientCount(); |
|
465 iXIMPId = aReqId; |
|
466 |
|
467 //If last client closesSession call |
|
468 if( KErrNone == iConnectionArray->ClientCount() && |
|
469 (EActive == iConnectionArray->GetConnectionStatus()) ) |
|
470 { |
|
471 iGrantListSubs = EFalse; |
|
472 //Start stopPublish request |
|
473 DeRegister(); |
|
474 } |
|
475 |
|
476 //Allways complete Ximp request |
|
477 if ( !iStopPublishCall ) |
|
478 { |
|
479 DP_SDA("stopPublish is not called"); |
|
480 CompleteReq( iXIMPId, KErrNone ); |
|
481 } |
|
482 |
|
483 DP_SDA("CPresencePluginConnection::CloseSession end"); |
|
484 } |
|
485 |
|
486 // --------------------------------------------------------------------------- |
|
487 // CPresencePluginConnection::GetSupportedFeaturesL |
|
488 // --------------------------------------------------------------------------- |
|
489 // |
|
490 void CPresencePluginConnection::GetSupportedFeaturesL( |
|
491 CDesC8Array& aFeatures ) const |
|
492 { |
|
493 DP_SDA("CPresencePluginConnection::GetSupportedFeaturesL"); |
|
494 // first empty the whole array |
|
495 aFeatures.Reset(); |
|
496 using namespace NXIMPFeature::Presence; |
|
497 aFeatures.AppendL( KPublish ); |
|
498 aFeatures.AppendL( KSubscribe ); |
|
499 aFeatures.AppendL( KUnsubscribe ); |
|
500 aFeatures.AppendL( KAddContact ); |
|
501 aFeatures.AppendL( KDeleteContact ); |
|
502 aFeatures.AppendL( KFetch ); |
|
503 aFeatures.AppendL( KBlock ); |
|
504 aFeatures.AppendL( KUnBlock ); |
|
505 |
|
506 if( iImFeatures ) |
|
507 { |
|
508 using namespace NXIMPFeature::InstantMessage; |
|
509 aFeatures.AppendL( KInstantMessage ); |
|
510 } |
|
511 } |
|
512 |
|
513 //***************************************************************************** |
|
514 //* FROM MPresencePluginConnectionObs |
|
515 //***************************************************************************** |
|
516 // --------------------------------------------------------------------------- |
|
517 // CPresencePluginConnection::CompleteReq() |
|
518 // --------------------------------------------------------------------------- |
|
519 // |
|
520 void CPresencePluginConnection::CompleteReq( TReqType aType, TInt aStatus ) |
|
521 { |
|
522 DP_SDA("CPresencePluginConnection::CompleteReq"); |
|
523 // Return immediately if PrimeHost() is not called. |
|
524 if ( !iConnectionHost ) |
|
525 { |
|
526 DP_SDA("CPresencePluginConnection::CompleteReq !iConnectionHost"); |
|
527 iXIMPId = TXIMPRequestId(); |
|
528 return; |
|
529 } |
|
530 |
|
531 switch ( aType ) |
|
532 { |
|
533 case EOpenSess: |
|
534 { |
|
535 DP_SDA("CPresencePluginConnection::CompleteReq EOpenSess"); |
|
536 iConnectionHost->HandleRequestCompleted( iXIMPId, aStatus ); |
|
537 iXIMPId = TXIMPRequestId(); |
|
538 //Set connection status to connection Array |
|
539 iConnectionArray->SetConnectionStatus( EActive ); |
|
540 } |
|
541 break; |
|
542 case ECloseSess: |
|
543 { |
|
544 DP_SDA("CPresencePluginConnection::CompleteReq ECloseSess"); |
|
545 iConnectionArray->DecreaseClientCount(); |
|
546 CompleteReq( iXIMPId, aStatus ); |
|
547 iConnectionArray->SetConnectionStatus( ENotActive ); |
|
548 } |
|
549 break; |
|
550 default: |
|
551 DP_SDA("CPresencePluginConnection::CompleteReq DEFAULT"); |
|
552 break; |
|
553 }; |
|
554 DP_SDA("CPresencePluginConnection::CompleteReq end"); |
|
555 } |
|
556 |
|
557 // --------------------------------------------------------------------------- |
|
558 // CPresencePluginConnection::CompleteReq() |
|
559 // --------------------------------------------------------------------------- |
|
560 // |
|
561 void CPresencePluginConnection::CompleteReq( |
|
562 TXIMPRequestId aReqId, |
|
563 TInt aStatus ) |
|
564 { |
|
565 DP_SDA2("CPresencePluginConnection::CompleteReq status %d", aStatus); |
|
566 // Return immediately if PrimeHost() is not called. |
|
567 if ( !iConnectionHost ) |
|
568 { |
|
569 DP_SDA("CPresencePluginConnection::CompleteReq return"); |
|
570 return; |
|
571 } |
|
572 DP_SDA("CPresencePluginConnection::CompleteReq complete"); |
|
573 iConnectionHost->HandleRequestCompleted( aReqId, aStatus ); |
|
574 } |
|
575 |
|
576 // --------------------------------------------------------------------------- |
|
577 // CPresencePluginConnection::ObjectFactory() |
|
578 // --------------------------------------------------------------------------- |
|
579 // |
|
580 MXIMPObjectFactory& CPresencePluginConnection::ObjectFactory() |
|
581 { |
|
582 DP_SDA("CPresencePluginConnection::ObjectFactory"); |
|
583 return iConnectionHost->ObjectFactory(); |
|
584 } |
|
585 |
|
586 // --------------------------------------------------------------------------- |
|
587 // CPresencePluginConnection::Host |
|
588 // --------------------------------------------------------------------------- |
|
589 // |
|
590 MXIMPProtocolConnectionHost* CPresencePluginConnection::Host() |
|
591 { |
|
592 DP_SDA("CPresencePluginConnection::Host"); |
|
593 return iConnectionHost; |
|
594 } |
|
595 |
|
596 // --------------------------------------------------------------------------- |
|
597 // CPresencePluginConnection:CurrentDomain |
|
598 // --------------------------------------------------------------------------- |
|
599 // |
|
600 TPtrC16 CPresencePluginConnection::CurrentDomain() |
|
601 { |
|
602 return iSession->CurrentDomain(); |
|
603 } |
|
604 |
|
605 // --------------------------------------------------------------------------- |
|
606 // CPresencePluginConnection::CurrentSipPresentit8() |
|
607 // --------------------------------------------------------------------------- |
|
608 // |
|
609 TPtrC8 CPresencePluginConnection::CurrentSipPresentity8() |
|
610 { |
|
611 return iSession->CurrentSipPresentity(); |
|
612 } |
|
613 |
|
614 // --------------------------------------------------------------------------- |
|
615 // CPresencePluginConnection:XdmUtilsL |
|
616 // --------------------------------------------------------------------------- |
|
617 // |
|
618 CPresencePluginXdmUtils* CPresencePluginConnection::XdmUtilsL() |
|
619 { |
|
620 DP_SDA("CPresencePluginConnection::XdmUtilsL"); |
|
621 return iSession->XdmUtilsL(); |
|
622 } |
|
623 |
|
624 // --------------------------------------------------------------------------- |
|
625 // CPresencePluginConnection::WinfoHandlerL() |
|
626 // --------------------------------------------------------------------------- |
|
627 // |
|
628 CPresencePluginWinfo* CPresencePluginConnection::WinfoHandlerL() |
|
629 { |
|
630 DP_SDA("CPresencePluginConnection::WinfoHandlerL"); |
|
631 if ( !iPluginWinfo ) |
|
632 { |
|
633 iPluginWinfo = CPresencePluginWinfo::NewL( |
|
634 *this, *(iSession->SimpleConnection() )); |
|
635 } |
|
636 |
|
637 iPluginWinfo->SetHost( iConnectionHost ); |
|
638 return iPluginWinfo; |
|
639 } |
|
640 |
|
641 // --------------------------------------------------------------------------- |
|
642 // CPresencePluginConnection::WatcherHandlerL() |
|
643 // --------------------------------------------------------------------------- |
|
644 // |
|
645 CPresencePluginWatcher* CPresencePluginConnection::WatcherHandlerL() |
|
646 { |
|
647 DP_SDA("CPresencePluginConnection::WatcherHandlerL"); |
|
648 if ( !iWatcher ) |
|
649 { |
|
650 DP_SDA("CPresencePluginConnection::WatcherHandlerL: if ( !iWatcher )"); |
|
651 iWatcher = CPresencePluginWatcher::NewL( |
|
652 *this, |
|
653 *iSession->SimpleConnection(), |
|
654 iPresenceData ); |
|
655 } |
|
656 return iWatcher; |
|
657 } |
|
658 // --------------------------------------------------------------------------- |
|
659 // CPresencePluginConnection::WinfoTerminatedL() |
|
660 // --------------------------------------------------------------------------- |
|
661 // |
|
662 void CPresencePluginConnection::WinfoTerminatedL( TInt aReason ) |
|
663 { |
|
664 DP_SDA("CPresencePluginConnection::WinfoTerminatedL"); |
|
665 // Pass the information to iAuth and iPublisher, |
|
666 // so that they can call XIMP Plugin Data Host callbacks. |
|
667 iAuth->WinfoTerminatedL( aReason ); |
|
668 iPublisher->WinfoTerminatedL( aReason ); |
|
669 } |
|
670 |
|
671 // --------------------------------------------------------------------------- |
|
672 // CPresencePluginConnection::WinfoNotification() |
|
673 // --------------------------------------------------------------------------- |
|
674 // |
|
675 void CPresencePluginConnection::WinfoNotification( MSimpleWinfo& aWinfo ) |
|
676 { |
|
677 DP_SDA("CPresencePluginConnection::WinfoNotification"); |
|
678 TRAP_IGNORE( iPublisher->WinfoNotificationL( aWinfo )); |
|
679 TRAP_IGNORE( iAuth->WinfoNotificationL( aWinfo )); |
|
680 } |
|
681 |
|
682 // --------------------------------------------------------------------------- |
|
683 // CPresencePluginConnection::GetInterface() |
|
684 // --------------------------------------------------------------------------- |
|
685 // |
|
686 TAny* CPresencePluginConnection::GetInterface( |
|
687 TInt32 aInterfaceId, |
|
688 TIfGetOps aOptions ) |
|
689 { |
|
690 DP_SDA("CPresencePluginConnection::GetInterface()"); |
|
691 if ( aInterfaceId == GetInterfaceId() ) |
|
692 { |
|
693 DP_SDA("CPresencePluginConnection::GetInterface()if "); |
|
694 // caller wants this interface |
|
695 return this; |
|
696 } |
|
697 if ( aOptions == MXIMPBase::EPanicIfUnknown ) |
|
698 { |
|
699 DP_SDA("CPresencePluginConnection::GetInterface() panic"); |
|
700 User::Panic( KPluginName, KErrExtensionNotSupported ); |
|
701 } |
|
702 return NULL; |
|
703 } |
|
704 |
|
705 // --------------------------------------------------------------------------- |
|
706 // CPresencePluginConnection::GetInterface() |
|
707 // --------------------------------------------------------------------------- |
|
708 // |
|
709 const TAny* CPresencePluginConnection::GetInterface( |
|
710 TInt32 aInterfaceId, |
|
711 TIfGetOps aOptions ) const |
|
712 { |
|
713 DP_SDA("CPresencePluginConnection::GetInterface() const "); |
|
714 if ( aInterfaceId == GetInterfaceId() ) |
|
715 { |
|
716 DP_SDA("CPresencePluginConnection::GetInterface()2 "); |
|
717 // caller wants this interface |
|
718 return const_cast<CPresencePluginConnection*>(this); |
|
719 } |
|
720 if ( aOptions == MXIMPBase::EPanicIfUnknown ) |
|
721 { |
|
722 DP_SDA("CPresencePluginConnection::GetInterface()panic 2"); |
|
723 User::Panic( KPluginName, KErrExtensionNotSupported ); |
|
724 } |
|
725 return NULL; |
|
726 } |
|
727 |
|
728 // --------------------------------------------------------------------------- |
|
729 // CPresencePluginConnection::GetInterfaceId() |
|
730 // --------------------------------------------------------------------------- |
|
731 // |
|
732 TInt32 CPresencePluginConnection::GetInterfaceId() const |
|
733 { |
|
734 DP_SDA("CPresencePluginConnection::GetInterfaceId() const "); |
|
735 return MXIMPProtocolConnection::KInterfaceId; |
|
736 } |
|
737 |
|
738 // --------------------------------------------------------------------------- |
|
739 // CPresencePluginConnection::ProtocolPresenceFeatures() |
|
740 // --------------------------------------------------------------------------- |
|
741 // |
|
742 MProtocolPresenceFeatures& CPresencePluginConnection:: |
|
743 ProtocolPresenceFeatures() |
|
744 { |
|
745 DP_SDA("CPresencePluginConnection::ProtocolPresenceFeatures() "); |
|
746 return *this; |
|
747 } |
|
748 |
|
749 // --------------------------------------------------------------------------- |
|
750 // CPresencePluginConnection::PresenceObjectFactory() |
|
751 // --------------------------------------------------------------------------- |
|
752 // |
|
753 MPresenceObjectFactory& CPresencePluginConnection::PresenceObjectFactoryOwn() |
|
754 { |
|
755 DP_SDA("CPresencePluginConnection::PresenceObjectFactoryOwn() "); |
|
756 return iConnectionHost-> |
|
757 ProtocolPresenceDataHost().PresenceObjectFactory(); |
|
758 } |
|
759 |
|
760 // --------------------------------------------------------------------------- |
|
761 // CPresencePluginConnection::GrandListState() |
|
762 // --------------------------------------------------------------------------- |
|
763 // |
|
764 TBool CPresencePluginConnection::GrandListState( ) |
|
765 { |
|
766 DP_SDA2("GrandListState : iGrantListSubs = %d", (TInt)iGrantListSubs ); |
|
767 return iGrantListSubs; |
|
768 } |
|
769 |
|
770 // --------------------------------------------------------------------------- |
|
771 // CPresencePluginConnection::IsStopPublishCalled() |
|
772 // --------------------------------------------------------------------------- |
|
773 // |
|
774 TBool CPresencePluginConnection::IsStopPublishCalled( ) |
|
775 { |
|
776 DP_SDA("CPresencePluginConnection::IsStopPublishCalled"); |
|
777 return iStopPublishCall; |
|
778 } |
|
779 |
|
780 // --------------------------------------------------------------------------- |
|
781 // CPresencePluginConnection::TerminateConnectionL() |
|
782 // --------------------------------------------------------------------------- |
|
783 // |
|
784 void CPresencePluginConnection::TerminateConnectionL( ) |
|
785 { |
|
786 DP_SDA("CPresencePluginConnection::TerminateConnectionL"); |
|
787 iConnectionHost->HandleConnectionTerminated( NULL ); |
|
788 iConnectionArray->SetConnectionStatus( ETerminated ); |
|
789 DP_SDA("CPresencePluginConnection::TerminateConnectionL Done"); |
|
790 } |
|
791 |
|
792 // --------------------------------------------------------------------------- |
|
793 // CPresencePluginConnection::DeRegister() |
|
794 // --------------------------------------------------------------------------- |
|
795 // |
|
796 void CPresencePluginConnection::DeRegister( ) |
|
797 { |
|
798 DP_SDA("CPresencePluginConnection::Deregister"); |
|
799 |
|
800 DP_SDA(" -> CloseSession, delete permanent pres data"); |
|
801 TRAP_IGNORE( iPresenceData->DeletePresenceVariablesL( ServiceId() ) ); |
|
802 |
|
803 DP_SDA("CloseSession call stopPublish"); |
|
804 TRAP_IGNORE( iPublisher->StopPublishL( iStatus ) ); |
|
805 iStopPublishCall = ETrue; |
|
806 SetActive(); |
|
807 DP_SDA("CPresencePluginConnection::Deregister Done"); |
|
808 } |
|
809 |
|
810 // --------------------------------------------------------------------------- |
|
811 // CPresencePluginConnection::CreateImFeaturesPlugin() |
|
812 // --------------------------------------------------------------------------- |
|
813 // |
|
814 void CPresencePluginConnection::CreateImFeaturesPluginL( ) |
|
815 { |
|
816 if ( !iImFeatures ) |
|
817 { |
|
818 DP_SDA("Creating SimpleImPlugin"); |
|
819 |
|
820 CSimpleImFeatures::TSimpleImPluginInitParams imPluginInitParams( |
|
821 *this, |
|
822 *iSession->SimpleConnection(), |
|
823 iSession->ServiceId() ); |
|
824 |
|
825 iImFeatures = static_cast<CSimpleImFeatures*> ( |
|
826 CProtocolImFeatures::NewL( TUid::Uid(KImplUidSimpleImPlugin), |
|
827 &imPluginInitParams ) ); |
|
828 |
|
829 DP_SDA("Creating SimpleImPlugin done"); |
|
830 } |
|
831 } |
|
832 |
|
833 // --------------------------------------------------------------------------- |
|
834 // CPresencePluginConnection::DeleteImFeaturesPlugin() |
|
835 // --------------------------------------------------------------------------- |
|
836 // |
|
837 void CPresencePluginConnection::DeleteImFeaturesPlugin( ) |
|
838 { |
|
839 if ( iImFeatures ) |
|
840 { |
|
841 DP_SDA("Deleting SimpleImPlugin"); |
|
842 |
|
843 delete iImFeatures; |
|
844 iImFeatures = NULL; |
|
845 REComSession::FinalClose(); |
|
846 |
|
847 DP_SDA("Deleting SimpleImPlugin done"); |
|
848 } |
|
849 } |
|
850 |
|
851 // --------------------------------------------------------------------------- |
|
852 // CPresencePluginPublisher::DoCancel() |
|
853 // --------------------------------------------------------------------------- |
|
854 // |
|
855 void CPresencePluginConnection::DoCancel( ) |
|
856 { |
|
857 DP_SDA("CPresencePluginConnection::DoCancel CANCEL"); |
|
858 } |
|
859 |
|
860 // --------------------------------------------------------------------------- |
|
861 // CPresencePluginSession::RunL() |
|
862 // --------------------------------------------------------------------------- |
|
863 // |
|
864 void CPresencePluginConnection::RunL( ) |
|
865 { |
|
866 DP_SDA("CPresencePluginConnection::RunL"); |
|
867 TInt status = iStatus.Int(); |
|
868 DP_SDA2("CPresencePluginConnection::RunL status %d", status ); |
|
869 |
|
870 if( !status && iStopPublishCall ) |
|
871 { |
|
872 DP_SDA("CPresencePluginConnection::RunL complete"); |
|
873 CompleteReq( iXIMPId, KErrNone ); |
|
874 DP_SDA("CPresencePluginConnection::RunL --> Delete im plugin"); |
|
875 DeleteImFeaturesPlugin(); |
|
876 } |
|
877 |
|
878 } |
|
879 |
|
880 // --------------------------------------------------------------------------- |
|
881 // CPresencePluginSession::RunError |
|
882 // --------------------------------------------------------------------------- |
|
883 // |
|
884 TInt CPresencePluginConnection::RunError( TInt /*aError*/ ) |
|
885 { |
|
886 DP_SDA("CPresencePluginConnection::RunError"); |
|
887 return KErrNone; |
|
888 } |
|
889 |
|
890 // --------------------------------------------------------------------------- |
|
891 // CPresencePluginConnection::GroupsL() |
|
892 // --------------------------------------------------------------------------- |
|
893 // |
|
894 CPresencePluginGroups& CPresencePluginConnection::GroupsL() |
|
895 { |
|
896 User::LeaveIfNull( iGroups ); |
|
897 return *iGroups; |
|
898 } |
|
899 |
|
900 // --------------------------------------------------------------------------- |
|
901 // CPresencePluginConnection::ServiceId() |
|
902 // --------------------------------------------------------------------------- |
|
903 // |
|
904 TInt& CPresencePluginConnection::ServiceId() |
|
905 { |
|
906 return iSession->ServiceId(); |
|
907 } |
|
908 |
|
909 // --------------------------------------------------------------------------- |
|
910 // CPresencePluginConnection::GetProtocolInterface() |
|
911 // --------------------------------------------------------------------------- |
|
912 // |
|
913 TAny* CPresencePluginConnection::GetProtocolInterface( TInt aInterfaceId ) |
|
914 { |
|
915 DP_SDA("CPresencePluginConnection::GetProtocolInterface"); |
|
916 |
|
917 if( aInterfaceId == CProtocolImFeatures::KInterfaceId ) |
|
918 { |
|
919 TInt err( KErrNone ); |
|
920 |
|
921 if ( !iImFeatures ) |
|
922 { |
|
923 DP_SDA(" --> Create im features plugin"); |
|
924 TRAP( err, CreateImFeaturesPluginL() ); |
|
925 } |
|
926 |
|
927 if ( !err ) |
|
928 { |
|
929 DP_SDA(" --> get interface"); |
|
930 |
|
931 return iImFeatures->GetInterface( |
|
932 aInterfaceId, MXIMPBase::EPanicIfUnknown ); |
|
933 } |
|
934 else |
|
935 { |
|
936 DP_SDA(" --> Creating im features plugin failed"); |
|
937 return NULL; |
|
938 } |
|
939 } |
|
940 else |
|
941 { |
|
942 return NULL; |
|
943 } |
|
944 } |
|
945 |
|
946 // End of file |
|