29
|
1 |
/* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
* All rights reserved.
|
|
3 |
* This component and the accompanying materials are made available
|
|
4 |
* under the terms of "Eclipse Public License v1.0"
|
|
5 |
* which accompanies this distribution, and is available
|
|
6 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
* Initial Contributors:
|
|
8 |
* Nokia Corporation - initial contribution.
|
|
9 |
*
|
|
10 |
* Contributors:
|
|
11 |
*
|
|
12 |
* Description: Execute command for blocking contact
|
|
13 |
*
|
|
14 |
*/
|
|
15 |
|
|
16 |
// INCLUDE FILES
|
|
17 |
#include "cvimpstcmdblockcontact.h"
|
|
18 |
|
|
19 |
#include "vimpstcmd.hrh"
|
|
20 |
#include "mvimpstcmdobserver.h"
|
|
21 |
|
|
22 |
#include "uiservicetabtracer.h"
|
|
23 |
|
|
24 |
#include <e32def.h>
|
|
25 |
#include "mvimpstengine.h"
|
|
26 |
#include "cvimpststoragemanagerfactory.h"
|
|
27 |
#include "mvimpststorageserviceview.h"
|
|
28 |
|
|
29 |
#include "mvimpstenginesubservice.h"
|
|
30 |
#include "mvimpstenginepresencesubservice.h"
|
|
31 |
#include "tvimpstconsts.h"
|
|
32 |
#include "mvimpstprocessarray.h"
|
|
33 |
// Constants
|
|
34 |
|
|
35 |
// --------------------------------------------------------------------------
|
|
36 |
// CVIMPSTCmdBlockContact::CVIMPSTCmdBlockContact
|
|
37 |
// --------------------------------------------------------------------------
|
|
38 |
//
|
|
39 |
CVIMPSTCmdBlockContact::CVIMPSTCmdBlockContact(
|
|
40 |
const TInt aCommandId , const TDesC& aContactId,
|
|
41 |
MVIMPSTProcessArray& aArrayProcess,
|
|
42 |
MVIMPSTEngine& aEngine) :
|
|
43 |
iCommandId( aCommandId ),
|
|
44 |
iContactId( aContactId ),
|
|
45 |
iProcessArray( aArrayProcess ),
|
|
46 |
iEngine(aEngine)
|
|
47 |
{
|
|
48 |
}
|
|
49 |
|
|
50 |
// --------------------------------------------------------------------------
|
|
51 |
// CVIMPSTCmdBlockContact::~CVIMPSTCmdBlockContact
|
|
52 |
// --------------------------------------------------------------------------
|
|
53 |
//
|
|
54 |
CVIMPSTCmdBlockContact::~CVIMPSTCmdBlockContact()
|
|
55 |
{
|
|
56 |
|
|
57 |
}
|
|
58 |
|
|
59 |
// --------------------------------------------------------------------------
|
|
60 |
// CVIMPSTCmdBlockContact::NewL
|
|
61 |
// --------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
CVIMPSTCmdBlockContact* CVIMPSTCmdBlockContact::NewL(
|
|
64 |
const TInt aCommandId, const TDesC& aContactId,
|
|
65 |
MVIMPSTProcessArray& aArrayProcess,
|
|
66 |
MVIMPSTEngine& aEngine)
|
|
67 |
{
|
|
68 |
CVIMPSTCmdBlockContact* self = new (ELeave ) CVIMPSTCmdBlockContact( aCommandId ,aContactId, aArrayProcess ,aEngine);
|
|
69 |
self->ConstructL(); //use contsurctL if necessary
|
|
70 |
return self;
|
|
71 |
}
|
|
72 |
// --------------------------------------------------------------------------
|
|
73 |
// CVIMPSTCmdBlockContact::ConstructL
|
|
74 |
// --------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
void CVIMPSTCmdBlockContact::ConstructL()
|
|
77 |
{
|
|
78 |
iError = KErrNotFound;
|
|
79 |
}
|
|
80 |
|
|
81 |
// --------------------------------------------------------------------------
|
|
82 |
// CVIMPSTCmdBlockContact::ExecuteLD
|
|
83 |
// --------------------------------------------------------------------------
|
|
84 |
//
|
|
85 |
void CVIMPSTCmdBlockContact::ExecuteLD()
|
|
86 |
{
|
|
87 |
TRACER_AUTO;
|
|
88 |
//push to the cleanupstack
|
|
89 |
CleanupStack::PushL( this );
|
|
90 |
iError = KErrGeneral;
|
|
91 |
if(iContactId.Length())
|
|
92 |
{
|
|
93 |
//Get Presence SubService
|
|
94 |
MVIMPSTEngineSubService* subService =
|
|
95 |
(iEngine.SubService(TVIMPSTEnums::EPresence));
|
|
96 |
if (subService && iEngine.IsBlockSupportedL())
|
|
97 |
{
|
|
98 |
MVIMPSTEnginePresenceSubService& presence =
|
|
99 |
MVIMPSTEnginePresenceSubService::Cast (*subService);
|
|
100 |
iError = presence.AddToBlockListL(iContactId);
|
|
101 |
TRACE("iError: %d", iError);
|
|
102 |
}
|
|
103 |
}
|
|
104 |
|
|
105 |
if( iError == KErrNone )
|
|
106 |
{
|
|
107 |
iProcessArray.RemoveFromUnknonOrInvitationListL( iContactId ,ETrue );
|
|
108 |
}
|
|
109 |
if(iObserver)
|
|
110 |
{
|
|
111 |
iObserver->CommandFinishedL(*this);
|
|
112 |
}
|
|
113 |
CleanupStack::PopAndDestroy();
|
|
114 |
|
|
115 |
}
|
|
116 |
|
|
117 |
|
|
118 |
// --------------------------------------------------------------------------
|
|
119 |
// CVIMPSTCmdBlockContact::AddObserver
|
|
120 |
// --------------------------------------------------------------------------
|
|
121 |
//
|
|
122 |
void CVIMPSTCmdBlockContact::AddObserver( MVIMPSTCmdObserver& aObserver )
|
|
123 |
{
|
|
124 |
// store the observer to notify the command completion
|
|
125 |
iObserver = &aObserver;
|
|
126 |
}
|
|
127 |
|
|
128 |
|
|
129 |
// --------------------------------------------------------------------------
|
|
130 |
// CVIMPSTCmdBlockContact::CommandId
|
|
131 |
// --------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
TInt CVIMPSTCmdBlockContact::CommandId() const
|
|
134 |
{
|
|
135 |
return iCommandId;
|
|
136 |
}
|
|
137 |
|
|
138 |
// --------------------------------------------------------------------------
|
|
139 |
// CVIMPSTCmdBlockContact::Result
|
|
140 |
// --------------------------------------------------------------------------
|
|
141 |
//
|
|
142 |
TInt CVIMPSTCmdBlockContact::Result() const
|
|
143 |
{
|
|
144 |
//return valid data regd the command operation
|
|
145 |
return iError;
|
|
146 |
}
|
|
147 |
|
|
148 |
// End of File
|