|
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: Withdraw presence from presentity group members operation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <ximpprotocolconnection.h> |
|
20 #include <protocolpresenceauthorization.h> |
|
21 #include <protocolpresencefeatures.h> |
|
22 |
|
23 #include "operationwithdrawpresencefrompresentitygroupmembers.h" |
|
24 #include "ximpidentityimp.h" |
|
25 #include "ximpobjecthelpers.h" |
|
26 #include "presencedatacacheimp.h" |
|
27 #include "presenceinfofilterimp.h" |
|
28 #include "ximphost.h" |
|
29 #include "ximpstatusimp.h" |
|
30 #include "ximppsccontextimp.h" |
|
31 #include "ximppanics.h" |
|
32 #include "protocolpresencedatahostimp.h" |
|
33 |
|
34 #include "ximptrace.h" |
|
35 // ============================ MEMBER FUNCTIONS ============================= |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // COperationWithdrawPresenceFromPresentityGroupMembers::COperationWithdrawPresenceFromPresentityGroupMembers() |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 EXPORT_C COperationWithdrawPresenceFromPresentityGroupMembers::COperationWithdrawPresenceFromPresentityGroupMembers() |
|
42 { |
|
43 } |
|
44 |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // COperationWithdrawPresenceFromPresentityGroupMembers::~COperationWithdrawPresenceFromPresentityGroupMembers() |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 COperationWithdrawPresenceFromPresentityGroupMembers::~COperationWithdrawPresenceFromPresentityGroupMembers() |
|
51 { |
|
52 delete iGroupId; |
|
53 |
|
54 if( iConfItem ) |
|
55 { |
|
56 iConfItem->Close(); |
|
57 } |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // COperationWithdrawPresenceFromPresentityGroupMembers::ConstructL() |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 void COperationWithdrawPresenceFromPresentityGroupMembers::ConstructL( const TDesC8& aParamPck ) |
|
65 { |
|
66 iGroupId = CXIMPIdentityImp::NewLC(); |
|
67 CleanupStack::Pop( iGroupId ); |
|
68 TXIMPObjectPacker< CXIMPIdentityImp >::UnPackL( *iGroupId, aParamPck ); |
|
69 } |
|
70 |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // COperationWithdrawPresenceFromPresentityGroupMembers::ProcessL() |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void COperationWithdrawPresenceFromPresentityGroupMembers::ProcessL() |
|
77 { |
|
78 TRACE(_L("COperationWithdrawPresenceFromPresentityGroupMembers::ProcessL()" ) ); |
|
79 CXIMPOperationBase::ProcessL(); |
|
80 |
|
81 CGroupMembersPresenceConfigurationItem& confItem = |
|
82 iMyHost->PresenceDataAccess().PresenceDataCache().GroupMembersPresenceConfigurationItemLC( *iGroupId ); |
|
83 CleanupStack::Pop(); // subItem |
|
84 iConfItem = &confItem; |
|
85 |
|
86 iConfigurationStatus = iConfItem->ConfigurationStatus( iContext ); |
|
87 |
|
88 MProtocolPresenceAuthorization& authorization = iMyHost->GetConnection().ProtocolPresenceFeatures().PresenceAuthorization(); |
|
89 |
|
90 iContext->SetPresenceInfoFilterL( MXIMPPscContext::EGrantPresenceToGroupMemberFilter, |
|
91 NULL, iGroupId ); |
|
92 |
|
93 switch( iConfigurationStatus ) |
|
94 { |
|
95 case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxOnly: |
|
96 { |
|
97 authorization.DoWithdrawPresenceGrantFromPresentityGroupMembersL( *iGroupId, iReqId ); |
|
98 iConfItem->RemoveConfigurator( iContext ); |
|
99 break; |
|
100 } |
|
101 |
|
102 case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxAndOthers: |
|
103 { |
|
104 CPresenceInfoFilterImp* pifWithoutCtx = |
|
105 iConfItem->CollectConfigurationPifWithoutCtxL( iContext ); |
|
106 CleanupStack::PushL( pifWithoutCtx ); |
|
107 |
|
108 if ( iConfItem->ConfigurationPif().Contains( *pifWithoutCtx ) ) |
|
109 { |
|
110 authorization.DoUpdatePresenceGrantPifForPresentityGroupMembersL( *iGroupId, *pifWithoutCtx, iReqId ); |
|
111 } |
|
112 else |
|
113 { |
|
114 iMyHost->FakeCompleteRequest( iReqId, KErrNone ); |
|
115 } |
|
116 |
|
117 CleanupStack::PopAndDestroy( pifWithoutCtx ); |
|
118 break; |
|
119 } |
|
120 |
|
121 case CGroupMembersPresenceConfigurationItem::ENotSubscribedAtAll: |
|
122 { |
|
123 // OPAA-73BCS8 |
|
124 authorization.DoWithdrawPresenceGrantFromPresentityGroupMembersL( *iGroupId, iReqId ); |
|
125 break; |
|
126 } |
|
127 case CGroupMembersPresenceConfigurationItem::ESubscribedForOtherCtxOnly: |
|
128 { |
|
129 iMyHost->FakeCompleteRequest( iReqId, KErrNone ); |
|
130 break; |
|
131 } |
|
132 |
|
133 XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); |
|
134 } |
|
135 } |
|
136 |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // COperationWithdrawPresenceFromPresentityGroupMembers::RequestCompleted() |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 void COperationWithdrawPresenceFromPresentityGroupMembers::RequestCompletedL() |
|
143 { |
|
144 TRACE(_L("COperationWithdrawPresenceFromPresentityGroupMembers::RequestCompletedL()" ) ); |
|
145 CXIMPOperationBase::RequestCompletedL(); |
|
146 |
|
147 if( iStatusObj->ResultCode() == KErrNone ) |
|
148 { |
|
149 switch( iConfigurationStatus ) |
|
150 { |
|
151 case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxOnly: |
|
152 case CGroupMembersPresenceConfigurationItem::ESubscribedForCtxAndOthers: |
|
153 { |
|
154 iConfItem->RemoveConfigurator( iContext ); |
|
155 break; |
|
156 } |
|
157 |
|
158 case CGroupMembersPresenceConfigurationItem::ENotSubscribedAtAll: |
|
159 case CGroupMembersPresenceConfigurationItem::ESubscribedForOtherCtxOnly: |
|
160 { |
|
161 break; |
|
162 } |
|
163 |
|
164 XIMP_DEFAULT_CASE_UNSUPPORTED( NXIMPPrivPanic::EInvalidSubscriptionStatus ); |
|
165 } |
|
166 SynthesiseEventL(); |
|
167 } |
|
168 } |
|
169 |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // COperationWithdrawPresenceFromPresentityGroupMembers::Type() |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 TInt |
|
176 COperationWithdrawPresenceFromPresentityGroupMembers::Type() const |
|
177 { |
|
178 return NPresenceOps::EPrWithdrawPresenceFromPresentityGroupMembers; |
|
179 } |
|
180 |
|
181 // --------------------------------------------------------------------------- |
|
182 // COperationWithdrawPresenceFromPresentityGroupMembers::SynthesiseEventL() |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 void COperationWithdrawPresenceFromPresentityGroupMembers::SynthesiseEventL() |
|
186 { |
|
187 } |
|
188 |
|
189 |
|
190 |
|
191 // End of file |