65
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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 the License "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: Implementation of CPushContentHandlerBase.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
|
|
22 |
#include "CPushContentHandlerBase.h"
|
|
23 |
#include "PushMtmUtil.h"
|
|
24 |
#include "PushMtmSettings.h"
|
|
25 |
#include "PushInitiatorList.h"
|
|
26 |
#include "PushInitiator.h"
|
|
27 |
#include "PushMtmCommands.hrh"
|
|
28 |
#include "PushMtmLog.h"
|
|
29 |
#include "PushMtmUiDef.h"
|
|
30 |
#include "StringResourceReader.h"
|
|
31 |
#include "PushContentHandlerPanic.h"
|
|
32 |
#include <PushEntry.h>
|
|
33 |
#include <push/pushmessage.h>
|
|
34 |
#include <msvstd.h>
|
|
35 |
#include <mtclreg.h>
|
|
36 |
#include <mtclbase.h>
|
|
37 |
#include <data_caging_path_literals.hrh>
|
|
38 |
#include <f32file.h>
|
|
39 |
|
|
40 |
// ================= MEMBER FUNCTIONS =======================
|
|
41 |
|
|
42 |
// ---------------------------------------------------------
|
|
43 |
// CPushContentHandlerBase::CPushContentHandlerBase
|
|
44 |
// ---------------------------------------------------------
|
|
45 |
//
|
|
46 |
CPushContentHandlerBase::CPushContentHandlerBase()
|
|
47 |
: CContentHandlerBase()
|
|
48 |
{
|
|
49 |
}
|
|
50 |
|
|
51 |
// ---------------------------------------------------------
|
|
52 |
// CPushContentHandlerBase::ConstructL
|
|
53 |
// ---------------------------------------------------------
|
|
54 |
//
|
|
55 |
void CPushContentHandlerBase::ConstructL()
|
|
56 |
{
|
|
57 |
iMsvSession = CMsvSession::OpenSyncL( *this );
|
|
58 |
PUSHLOG_WRITE("CPushContentHandlerBase iMsvSession OK")
|
|
59 |
iWapPushUtils = CPushMtmUtil::NewL( *iMsvSession );
|
|
60 |
PUSHLOG_WRITE("CPushContentHandlerBase iWapPushUtils OK")
|
|
61 |
iMtmSettings = CPushMtmSettings::NewL();
|
|
62 |
PUSHLOG_WRITE("CPushContentHandlerBase iMtmSettings OK")
|
|
63 |
|
|
64 |
// Add resource file reader.
|
|
65 |
TParse* fileParser = new (ELeave) TParse;
|
|
66 |
CleanupStack::PushL( fileParser );
|
|
67 |
fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL );
|
|
68 |
iStrRscReader = new (ELeave) CStringResourceReader
|
|
69 |
( iMsvSession->FileSession(), fileParser->FullName() );
|
|
70 |
CleanupStack::PopAndDestroy( fileParser ); // fileParser
|
|
71 |
fileParser = NULL;
|
|
72 |
PUSHLOG_WRITE("CPushContentHandlerBase iStrRscReader OK")
|
|
73 |
|
|
74 |
CActiveScheduler::Add( this );
|
|
75 |
}
|
|
76 |
|
|
77 |
// ---------------------------------------------------------
|
|
78 |
// CPushContentHandlerBase::~CPushContentHandlerBase
|
|
79 |
// ---------------------------------------------------------
|
|
80 |
//
|
|
81 |
CPushContentHandlerBase::~CPushContentHandlerBase()
|
|
82 |
{
|
|
83 |
PUSHLOG_ENTERFN("CPushContentHandlerBase::~CPushContentHandlerBase")
|
|
84 |
|
|
85 |
// Call Cancel() in derived classes!
|
|
86 |
delete iStrRscReader; // Must be deleted before iMsvSession.
|
|
87 |
delete iMtmSettings; // It has to be deleted before iMsvSession, because
|
|
88 |
// it uses iMsvSession->FileSession().
|
|
89 |
delete iWapPushUtils;
|
|
90 |
delete iMsvSession;
|
|
91 |
|
|
92 |
PUSHLOG_LEAVEFN("CPushContentHandlerBase::~CPushContentHandlerBase")
|
|
93 |
}
|
|
94 |
|
|
95 |
// ---------------------------------------------------------
|
|
96 |
// CPushContentHandlerBase::DoCollectGarbageL
|
|
97 |
// ---------------------------------------------------------
|
|
98 |
//
|
|
99 |
void CPushContentHandlerBase::DoCollectGarbageL()
|
|
100 |
{
|
|
101 |
PUSHLOG_ENTERFN("CPushContentHandlerBase::DoCollectGarbageL")
|
|
102 |
|
|
103 |
CClientMtmRegistry* clientReg = CClientMtmRegistry::NewL( *iMsvSession );
|
|
104 |
CleanupStack::PushL( clientReg );
|
|
105 |
PUSHLOG_WRITE("CPushContentHandlerBase clientReg OK")
|
|
106 |
CBaseMtm* pushMtm = clientReg->NewMtmL( KUidMtmWapPush );
|
|
107 |
CleanupStack::PushL( pushMtm );
|
|
108 |
PUSHLOG_WRITE("CPushContentHandlerBase pushMtm OK")
|
|
109 |
CMsvEntrySelection* dummySel = new (ELeave) CMsvEntrySelection;
|
|
110 |
CleanupStack::PushL( dummySel );
|
|
111 |
TBuf8<1> dummyPar;
|
|
112 |
|
|
113 |
pushMtm->InvokeSyncFunctionL( EPushMtmCmdCollectGarbage,
|
|
114 |
*dummySel, dummyPar );
|
|
115 |
|
|
116 |
CleanupStack::PopAndDestroy( 3, clientReg );
|
|
117 |
// dummySel, pushMtm, clientReg
|
|
118 |
|
|
119 |
PUSHLOG_LEAVEFN("CPushContentHandlerBase::DoCollectGarbageL")
|
|
120 |
}
|
|
121 |
|
|
122 |
// ---------------------------------------------------------
|
|
123 |
// CPushContentHandlerBase::FilterPushMsgL
|
|
124 |
// ---------------------------------------------------------
|
|
125 |
//
|
|
126 |
TBool CPushContentHandlerBase::FilterPushMsgL()
|
|
127 |
{
|
|
128 |
PUSHLOG_ENTERFN("CPushContentHandlerBase::FilterPushMsgL")
|
|
129 |
|
|
130 |
TBool msgAccepted = ETrue;
|
|
131 |
|
|
132 |
if ( iMtmSettings->ServiceReception() == EFalse )
|
|
133 |
{
|
|
134 |
// Discard message.
|
|
135 |
msgAccepted = EFalse;
|
|
136 |
PUSHLOG_WRITE(" ServiceReception OFF")
|
|
137 |
}
|
|
138 |
|
|
139 |
PUSHLOG_WRITE_FORMAT(" msgAccepted <%d>",msgAccepted)
|
|
140 |
PUSHLOG_LEAVEFN("CPushContentHandlerBase::FilterPushMsgL")
|
|
141 |
return msgAccepted;
|
|
142 |
}
|
|
143 |
|
|
144 |
// ---------------------------------------------------------
|
|
145 |
// CPushContentHandlerBase::HandleSessionEventL
|
|
146 |
// ---------------------------------------------------------
|
|
147 |
//
|
|
148 |
void CPushContentHandlerBase::HandleSessionEventL
|
|
149 |
(
|
|
150 |
TMsvSessionEvent /*aEvent*/,
|
|
151 |
TAny* /*aArg1*/,
|
|
152 |
TAny* /*aArg2*/,
|
|
153 |
TAny* /*aArg3*/
|
|
154 |
)
|
|
155 |
{
|
|
156 |
}
|