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