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