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