|
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: Presentity group content unsubscribe operator |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <ximpprotocolconnection.h> |
|
20 #include <protocolpresentitygroups.h> |
|
21 #include <protocolpresencefeatures.h> |
|
22 |
|
23 #include "operationunsubscribegroupcontent.h" |
|
24 #include "ximpobjecthelpers.h" |
|
25 #include "presencedatacacheimp.h" |
|
26 #include "ximppanics.h" |
|
27 #include "operationsynthesisesubscriptionevent.h" |
|
28 #include "ximpidentityimp.h" |
|
29 #include "ximphost.h" |
|
30 #include "ximpstatusimp.h" |
|
31 #include "ximppsccontextimp.h" |
|
32 #include "protocolpresencedatahostimp.h" |
|
33 |
|
34 #include "ximptrace.h" |
|
35 // ============================ MEMBER FUNCTIONS ============================= |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // COperationUnsubscribeGroupContent::COperationUnsubscribeGroupContent() |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 EXPORT_C COperationUnsubscribeGroupContent::COperationUnsubscribeGroupContent() |
|
42 { |
|
43 } |
|
44 |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // COperationUnsubscribeGroupContent::~COperationUnsubscribeGroupContent() |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 COperationUnsubscribeGroupContent::~COperationUnsubscribeGroupContent() |
|
51 { |
|
52 if( iSubItem ) |
|
53 { |
|
54 iSubItem->Close(); |
|
55 } |
|
56 delete iGroupId; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // COperationUnsubscribeGroupContent::ConstructL() |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 void COperationUnsubscribeGroupContent::ConstructL( const TDesC8& aParamPck ) |
|
64 { |
|
65 iGroupId = CXIMPIdentityImp::NewLC(); |
|
66 CleanupStack::Pop( iGroupId ); |
|
67 TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, aParamPck ); |
|
68 } |
|
69 |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // COperationUnsubscribeGroupContent::ProcessL() |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 void COperationUnsubscribeGroupContent::ProcessL() |
|
76 { |
|
77 TRACE(_L("COperationUnsubscribeGroupContent::ProcessL()" ) ); |
|
78 CXIMPOperationBase::ProcessL(); |
|
79 |
|
80 CGroupContentSubscriptionItem& subItem = |
|
81 iMyHost->PresenceDataAccess().PresenceDataCache().GroupContentSubscriptionItemLC( *iGroupId ); |
|
82 CleanupStack::Pop(); // subItem |
|
83 iSubItem = &subItem; |
|
84 |
|
85 iSubscriptionStatus = iSubItem->SubscriptionStatus( iContext ); |
|
86 MProtocolPresentityGroups& presentityGroups = iMyHost->GetConnection().ProtocolPresenceFeatures().PresentityGroups(); |
|
87 |
|
88 switch( iSubscriptionStatus ) |
|
89 { |
|
90 case CGroupContentSubscriptionItem::ESubscribedForCtxOnly: |
|
91 { |
|
92 presentityGroups.DoUnsubscribePresentityGroupContentL( *iGroupId, iReqId ); |
|
93 break; |
|
94 } |
|
95 |
|
96 case CGroupContentSubscriptionItem::ENotSubscribedAtAll: |
|
97 case CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers: |
|
98 case CGroupContentSubscriptionItem::ESubscribedForOtherCtxOnly: |
|
99 { |
|
100 iMyHost->FakeCompleteRequest( iReqId, KErrNone ); |
|
101 break; |
|
102 } |
|
103 |
|
104 XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); |
|
105 } |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // COperationUnsubscribeGroupContent::RequestCompleted() |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 void COperationUnsubscribeGroupContent::RequestCompletedL() |
|
113 { |
|
114 TRACE(_L("COperationUnsubscribeGroupContent::RequestCompletedL()" ) ); |
|
115 CXIMPOperationBase::RequestCompletedL(); |
|
116 |
|
117 if( iStatusObj->ResultCode() == KErrNone ) |
|
118 { |
|
119 switch( iSubscriptionStatus ) |
|
120 { |
|
121 case CGroupContentSubscriptionItem::ESubscribedForCtxOnly: |
|
122 case CGroupContentSubscriptionItem::ESubscribedForCtxAndOthers: |
|
123 { |
|
124 iSubItem->RemoveSubscriber( iContext ); |
|
125 break; |
|
126 } |
|
127 case CGroupContentSubscriptionItem::ENotSubscribedAtAll: |
|
128 case CGroupContentSubscriptionItem::ESubscribedForOtherCtxOnly: |
|
129 { |
|
130 break; |
|
131 } |
|
132 |
|
133 XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); |
|
134 } |
|
135 |
|
136 SynthesiseEventL(); |
|
137 } |
|
138 } |
|
139 |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 // COperationUnsubscribeGroupContent::Type() |
|
143 // --------------------------------------------------------------------------- |
|
144 // |
|
145 TInt |
|
146 COperationUnsubscribeGroupContent::Type() const |
|
147 { |
|
148 return NPresenceOps::EPrUnsubscribeGroupContent; |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // COperationUnsubscribeGroupContent::SynthesiseEventL() |
|
153 // --------------------------------------------------------------------------- |
|
154 // |
|
155 void COperationUnsubscribeGroupContent::SynthesiseEventL() |
|
156 { |
|
157 COperationSynthesiseSubscriptionEvent* synthOp = |
|
158 new ( ELeave ) COperationSynthesiseSubscriptionEvent( |
|
159 COperationSynthesiseSubscriptionEvent::EPresentityGroupContent, ETrue ); |
|
160 CleanupStack::PushL( synthOp ); |
|
161 synthOp->BaseConstructL( TXIMPRequestId(), iContext ); |
|
162 synthOp->ConstructL( *iGroupId ); |
|
163 iMyHost->AddNewOperationL( *synthOp ); |
|
164 CleanupStack::Pop( synthOp ); |
|
165 } |
|
166 |
|
167 |
|
168 |
|
169 // End of file |