author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 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: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <StifTestInterface.h> |
19 | 25 |
#include <msvids.h> |
26 |
////#include <senduiconsts.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
27 |
#include <liwcommon.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
28 |
#include<liwservicehandler.h> |
19 | 29 |
|
30 |
#include "messagingservicehandler.h" |
|
31 |
||
32 |
#include "tchangestatustest.h" |
|
33 |
||
34 |
// ----------------------------------------------------------------------------- |
|
35 |
// CTChangeStatusTest::Delete |
|
36 |
// Delete here all resources allocated and opened from test methods. |
|
37 |
// Called from destructor. |
|
38 |
// ----------------------------------------------------------------------------- |
|
39 |
// |
|
40 |
void CTChangeStatusTest::Delete() |
|
41 |
{ |
|
42 |
||
43 |
} |
|
44 |
||
45 |
// ----------------------------------------------------------------------------- |
|
46 |
// CTChangeStatusTest::RunMethodL |
|
47 |
// Run specified method. Contains also table of test mothods and their names. |
|
48 |
// ----------------------------------------------------------------------------- |
|
49 |
// |
|
50 |
TInt CTChangeStatusTest::RunMethodL( |
|
51 |
CStifItemParser& aItem ) |
|
52 |
{ |
|
53 |
||
54 |
static TStifFunctionInfo const KFunctions[] = |
|
55 |
{ |
|
56 |
||
57 |
ENTRY( "ChangeStatusSms", CTChangeStatusTest::ChangeStatusSms), |
|
58 |
ENTRY( "ChangeStatusMms", CTChangeStatusTest::ChangeStatusMms), |
|
59 |
ENTRY( "ChangeStatusInvalid", CTChangeStatusTest::ChangeStatusInvalid), |
|
60 |
||
61 |
}; |
|
62 |
||
63 |
const TInt count = sizeof( KFunctions ) / |
|
64 |
sizeof( TStifFunctionInfo ); |
|
65 |
||
66 |
return RunInternalL( KFunctions, count, aItem ); |
|
67 |
||
68 |
} |
|
69 |
||
70 |
_LIT8(KTestInterface, "IMessaging"); |
|
71 |
_LIT8(KTestContent,"Service.Messaging"); |
|
72 |
_LIT8(KCmd,"ChangeStatus"); |
|
73 |
_LIT8(KMsgId,"MessageId"); |
|
74 |
_LIT8(KStatus,"Status"); |
|
75 |
_LIT8(KErrorCode,"ErrorCode"); |
|
76 |
||
77 |
||
78 |
_LIT8(KCmdGetHeaderList, "GetList"); |
|
79 |
||
80 |
_LIT8(KFilter,"Filter"); |
|
81 |
_LIT8(KSenderList,"SenderList"); |
|
82 |
_LIT8(KSortOrder, "SortOrder" ); |
|
83 |
_LIT8(KMessageList, "MessageList" ); |
|
84 |
||
85 |
_LIT8(KMessageId,"MessageId"); |
|
86 |
||
87 |
_LIT8(KMap,"Status"); |
|
88 |
_LIT8(KMtmList, "MessageTypeList" ); |
|
89 |
_LIT8(KUnreadFlag, "Unread"); |
|
90 |
||
91 |
_LIT(KMsgTypeSMS, "SMS"); |
|
92 |
_LIT(KMsgTypeMMS, "MMS"); |
|
93 |
_LIT(KMsgStatusUnread, "Unread"); |
|
94 |
_LIT(KMsgStatusRead, "Read"); |
|
95 |
||
96 |
TInt CTChangeStatusTest::ChangeStatusInvalid(CStifItemParser& /*aItem*/) |
|
97 |
{ |
|
98 |
__UHEAP_MARK; |
|
99 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
100 |
CleanupStack::PushL(iServiceHandler); |
|
101 |
CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); |
|
102 |
CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); |
|
103 |
||
104 |
TInt err = KErrNone; |
|
105 |
||
106 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent); |
|
107 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
108 |
||
109 |
RCriteriaArray a; |
|
110 |
a.AppendL(crit); |
|
111 |
||
112 |
iServiceHandler->AttachL(a); |
|
113 |
||
114 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); |
|
115 |
||
116 |
delete crit; |
|
117 |
a.Reset(); |
|
118 |
||
119 |
TInt pos = 0; |
|
120 |
MLiwInterface* interface = NULL; |
|
121 |
outparam->FindFirst( pos, KTestInterface ); |
|
122 |
if(pos != KErrNotFound) |
|
123 |
{ |
|
124 |
interface = (*outparam)[pos].Value().AsInterface(); |
|
125 |
} |
|
126 |
||
127 |
outparam->Reset(); |
|
128 |
inparam->Reset(); |
|
129 |
if(interface) |
|
130 |
{ |
|
131 |
TLiwGenericParam msgid; |
|
132 |
TLiwVariant msgidvalue; |
|
133 |
TLiwGenericParam msgflag; |
|
134 |
TLiwVariant flagval; |
|
135 |
||
136 |
msgidvalue.Set(-1); |
|
137 |
msgid.SetNameAndValueL(KMsgId,msgidvalue); |
|
138 |
||
139 |
||
140 |
flagval.Set((TDesC)KMsgStatusUnread); |
|
141 |
msgflag.SetNameAndValueL(KStatus,flagval); |
|
142 |
||
143 |
||
144 |
||
145 |
inparam->AppendL(msgid); |
|
146 |
||
147 |
inparam->AppendL(msgflag); |
|
148 |
||
149 |
msgid.Reset(); |
|
150 |
msgidvalue.Reset(); |
|
151 |
msgflag.Reset(); |
|
152 |
flagval.Reset(); |
|
153 |
||
154 |
TRAP(err, interface->ExecuteCmdL(KCmd,*inparam,*outparam)); |
|
155 |
||
156 |
TInt32 returnerr = 0; |
|
157 |
pos = 0; |
|
158 |
outparam->FindFirst( pos, KErrorCode ); |
|
159 |
if(pos != KErrNotFound) |
|
160 |
{ |
|
161 |
if( (*outparam)[pos].Value().AsTInt32() != KErrNone ) |
|
162 |
err = (TInt)((*outparam)[pos].Value().AsTInt32()); |
|
163 |
} |
|
164 |
||
165 |
interface->Close(); |
|
166 |
outparam->Reset(); |
|
167 |
inparam->Reset(); |
|
168 |
} |
|
169 |
||
170 |
CleanupStack::PopAndDestroy(iServiceHandler); |
|
171 |
||
172 |
__UHEAP_MARKEND; |
|
173 |
||
174 |
if (err != KErrNone) |
|
175 |
return KErrNone; |
|
176 |
else |
|
177 |
return KErrGeneral; |
|
178 |
} |
|
179 |
||
180 |
||
181 |
||
182 |
TInt CTChangeStatusTest::ChangeStatusSms(CStifItemParser& /*aItem*/) |
|
183 |
{ |
|
184 |
__UHEAP_MARK; |
|
185 |
TInt result = KErrNone; |
|
186 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
187 |
CleanupStack::PushL(iServiceHandler); |
|
188 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
189 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
190 |
||
191 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent); |
|
192 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
193 |
||
194 |
RCriteriaArray a; |
|
195 |
a.AppendL(crit); |
|
196 |
||
197 |
iServiceHandler->AttachL(a); |
|
198 |
||
199 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
200 |
||
201 |
a.Reset(); |
|
202 |
delete crit; |
|
203 |
||
204 |
TInt pos = 0; |
|
205 |
MLiwInterface* interface = NULL; |
|
206 |
outParamList->FindFirst(pos,KTestInterface ); |
|
207 |
if(pos != KErrNotFound) |
|
208 |
{ |
|
209 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
210 |
} |
|
211 |
||
212 |
outParamList->Reset(); |
|
213 |
inParamList->Reset(); |
|
214 |
||
215 |
if( interface ) |
|
216 |
{ |
|
217 |
pos =0; |
|
218 |
TLiwVariant content(_L("Inbox")); |
|
219 |
TLiwGenericParam elem ; |
|
220 |
elem.SetNameAndValueL(_L8("Type"),content); |
|
221 |
inParamList->AppendL(elem); |
|
222 |
content.Reset(); |
|
223 |
elem.Reset(); |
|
224 |
||
225 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
226 |
CleanupStack::PushL(map); |
|
227 |
||
228 |
CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); |
|
229 |
CleanupStack::PushL(mtmtypelist); |
|
230 |
||
231 |
||
232 |
TLiwVariant smsmtm(KMsgTypeSMS); // how the user wud gv this param |
|
233 |
mtmtypelist->AppendL(smsmtm); |
|
234 |
smsmtm.Reset(); |
|
235 |
||
236 |
TLiwVariant add1(mtmtypelist); |
|
237 |
||
238 |
map->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added |
|
239 |
mtmtypelist->DecRef(); |
|
240 |
CleanupStack::Pop(mtmtypelist); |
|
241 |
add1.Reset(); |
|
242 |
||
243 |
||
244 |
TLiwVariant filterparam(map); |
|
245 |
TLiwGenericParam element ; |
|
246 |
element.SetNameAndValueL(_L8("Filter"),filterparam); |
|
247 |
filterparam.Reset(); |
|
248 |
||
249 |
||
250 |
inParamList->AppendL(element); |
|
251 |
element.Reset(); |
|
252 |
||
253 |
map->DecRef(); |
|
254 |
CleanupStack::Pop(map); |
|
255 |
||
256 |
||
257 |
TInt err = 0; |
|
258 |
TRAP(err,interface->ExecuteCmdL( KCmdGetHeaderList ,*inParamList ,*outParamList)); |
|
259 |
pos = 0 ; |
|
260 |
||
261 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
262 |
||
263 |
TInt32 testmessageid = 0; |
|
264 |
TBool messageunread = ETrue; |
|
265 |
||
266 |
if(output) |
|
267 |
{ |
|
268 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
269 |
||
270 |
if(iterlist) |
|
271 |
{ |
|
272 |
TLiwVariant data; |
|
273 |
if(iterlist->NextL(data)) |
|
274 |
{ |
|
275 |
const CLiwMap* Map = data.AsMap(); |
|
276 |
if ( Map ) |
|
277 |
{ |
|
278 |
TLiwVariant messageid; |
|
279 |
Map->FindL(_L8("MessageId"),messageid); |
|
280 |
testmessageid = messageid.AsTInt32(); |
|
281 |
messageid.Reset(); |
|
282 |
||
283 |
TLiwVariant unread; |
|
284 |
Map->FindL(KUnreadFlag,unread); |
|
285 |
messageunread = unread.AsTBool(); |
|
286 |
unread.Reset(); |
|
287 |
} |
|
288 |
} |
|
289 |
data.Reset(); |
|
290 |
} |
|
291 |
} |
|
292 |
inParamList->Reset(); |
|
293 |
outParamList->Reset(); |
|
294 |
||
295 |
if(testmessageid > 0) |
|
296 |
{ |
|
297 |
TLiwGenericParam msgid; |
|
298 |
TLiwVariant msgidvalue; |
|
299 |
TLiwGenericParam msgflag; |
|
300 |
||
301 |
msgidvalue.Set(TInt32(testmessageid)); |
|
302 |
msgid.SetNameAndValueL(KMsgId,msgidvalue); |
|
303 |
inParamList->AppendL(msgid); |
|
304 |
msgidvalue.Reset(); |
|
305 |
msgid.Reset(); |
|
306 |
||
307 |
if ( messageunread ) |
|
308 |
msgflag.SetNameAndValueL(KStatus,TLiwVariant(KMsgStatusRead)); |
|
309 |
else |
|
310 |
msgflag.SetNameAndValueL(KStatus,TLiwVariant(KMsgStatusUnread)); |
|
311 |
||
312 |
inParamList->AppendL(msgflag); |
|
313 |
||
314 |
msgflag.Reset(); |
|
315 |
||
316 |
interface->ExecuteCmdL(KCmd,*inParamList,*outParamList); |
|
317 |
||
318 |
inParamList->Reset(); |
|
319 |
outParamList->Reset(); |
|
320 |
||
321 |
TLiwVariant content(_L("Inbox")); |
|
322 |
TLiwGenericParam elem ; |
|
323 |
elem.SetNameAndValueL(_L8("Type"),content); |
|
324 |
inParamList->AppendL(elem); |
|
325 |
content.Reset(); |
|
326 |
elem.Reset(); |
|
327 |
||
328 |
||
329 |
CLiwDefaultMap* filtermap = CLiwDefaultMap::NewL(); |
|
330 |
CleanupStack::PushL(filtermap); |
|
331 |
||
332 |
TLiwVariant filterid( testmessageid ); |
|
333 |
filtermap->InsertL(KMessageId, filterid); // Mtmtype is added |
|
334 |
filterid.Reset(); |
|
335 |
||
336 |
||
337 |
TLiwVariant filterparam(filtermap); |
|
338 |
TLiwGenericParam element ; |
|
339 |
element.SetNameAndValueL(_L8("Filter"),filterparam); |
|
340 |
filterparam.Reset(); |
|
341 |
||
342 |
inParamList->AppendL(element); |
|
343 |
element.Reset(); |
|
344 |
||
345 |
filtermap->DecRef(); |
|
346 |
CleanupStack::Pop(filtermap); |
|
347 |
||
348 |
||
349 |
TInt err = 0; |
|
350 |
TRAP(err,interface->ExecuteCmdL( KCmdGetHeaderList ,*inParamList ,*outParamList)); |
|
351 |
pos = 0 ; |
|
352 |
||
353 |
||
354 |
const TLiwGenericParam* finaloutput = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
355 |
||
356 |
if ( finaloutput ) |
|
357 |
{ |
|
358 |
CLiwIterable* iterlist = finaloutput->Value().AsIterable(); |
|
359 |
||
360 |
if(iterlist) |
|
361 |
{ |
|
362 |
TLiwVariant data; |
|
363 |
if ( iterlist->NextL(data) ) |
|
364 |
{ |
|
365 |
const CLiwMap* Map = data.AsMap(); |
|
366 |
||
367 |
if ( Map ) |
|
368 |
{ |
|
369 |
TLiwVariant messageid; |
|
370 |
Map->FindL(_L8("MessageId"),messageid); |
|
371 |
TMsvId newtestmessageid = messageid.AsTInt32(); |
|
372 |
messageid.Reset(); |
|
373 |
||
374 |
TLiwVariant unread; |
|
375 |
Map->FindL(KUnreadFlag,unread); |
|
376 |
TBool newmessageunread = unread.AsTBool(); |
|
377 |
unread.Reset(); |
|
378 |
||
379 |
if (( messageunread != newmessageunread) && (testmessageid == newtestmessageid )) |
|
380 |
result = KErrNone; |
|
381 |
else |
|
382 |
result = KErrGeneral; |
|
383 |
} |
|
384 |
} |
|
385 |
data.Reset(); |
|
386 |
} |
|
387 |
} |
|
388 |
||
389 |
inParamList->Reset(); |
|
390 |
outParamList->Reset(); |
|
391 |
} |
|
392 |
||
393 |
} |
|
394 |
||
395 |
interface->Close(); |
|
396 |
||
397 |
CleanupStack::PopAndDestroy( iServiceHandler ); |
|
398 |
||
399 |
__UHEAP_MARKEND; |
|
400 |
||
401 |
return result; |
|
402 |
||
403 |
} |
|
404 |
||
405 |
||
406 |
||
407 |
||
408 |
TInt CTChangeStatusTest::ChangeStatusMms(CStifItemParser& /*aItem*/) |
|
409 |
{ |
|
410 |
__UHEAP_MARK; |
|
411 |
TInt result = KErrNone; |
|
412 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
413 |
CleanupStack::PushL(iServiceHandler); |
|
414 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
415 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
416 |
||
417 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent); |
|
418 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
419 |
||
420 |
RCriteriaArray a; |
|
421 |
a.AppendL(crit); |
|
422 |
||
423 |
iServiceHandler->AttachL(a); |
|
424 |
||
425 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
426 |
||
427 |
a.Reset(); |
|
428 |
delete crit; |
|
429 |
||
430 |
TInt pos = 0; |
|
431 |
MLiwInterface* interface = NULL; |
|
432 |
outParamList->FindFirst(pos,KTestInterface ); |
|
433 |
if(pos != KErrNotFound) |
|
434 |
{ |
|
435 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
436 |
} |
|
437 |
||
438 |
outParamList->Reset(); |
|
439 |
inParamList->Reset(); |
|
440 |
||
441 |
if( interface ) |
|
442 |
{ |
|
443 |
pos =0; |
|
444 |
TLiwVariant content(_L("Inbox")); |
|
445 |
TLiwGenericParam elem ; |
|
446 |
elem.SetNameAndValueL(_L8("Type"),content); |
|
447 |
inParamList->AppendL(elem); |
|
448 |
content.Reset(); |
|
449 |
elem.Reset(); |
|
450 |
||
451 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
452 |
CleanupStack::PushL(map); |
|
453 |
||
454 |
CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); |
|
455 |
CleanupStack::PushL(mtmtypelist); |
|
456 |
||
457 |
||
458 |
TLiwVariant smsmtm(KMsgTypeMMS); // how the user wud gv this param |
|
459 |
mtmtypelist->AppendL(smsmtm); |
|
460 |
smsmtm.Reset(); |
|
461 |
||
462 |
TLiwVariant add1(mtmtypelist); |
|
463 |
||
464 |
map->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added |
|
465 |
mtmtypelist->DecRef(); |
|
466 |
CleanupStack::Pop(mtmtypelist); |
|
467 |
add1.Reset(); |
|
468 |
||
469 |
||
470 |
TLiwVariant filterparam(map); |
|
471 |
TLiwGenericParam element ; |
|
472 |
element.SetNameAndValueL(_L8("Filter"),filterparam); |
|
473 |
filterparam.Reset(); |
|
474 |
||
475 |
||
476 |
inParamList->AppendL(element); |
|
477 |
element.Reset(); |
|
478 |
||
479 |
map->DecRef(); |
|
480 |
CleanupStack::Pop(map); |
|
481 |
||
482 |
||
483 |
TInt err = 0; |
|
484 |
TRAP(err,interface->ExecuteCmdL( KCmdGetHeaderList ,*inParamList ,*outParamList)); |
|
485 |
pos = 0 ; |
|
486 |
||
487 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
488 |
||
489 |
TInt32 testmessageid = 0; |
|
490 |
TBool messageunread = ETrue; |
|
491 |
||
492 |
if(output) |
|
493 |
{ |
|
494 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
495 |
||
496 |
if(iterlist) |
|
497 |
{ |
|
498 |
TLiwVariant data; |
|
499 |
if(iterlist->NextL(data)) |
|
500 |
{ |
|
501 |
const CLiwMap* Map = data.AsMap(); |
|
502 |
if ( Map ) |
|
503 |
{ |
|
504 |
TLiwVariant messageid; |
|
505 |
Map->FindL(_L8("MessageId"),messageid); |
|
506 |
testmessageid = (TInt)messageid.AsTInt32(); |
|
507 |
messageid.Reset(); |
|
508 |
||
509 |
TLiwVariant unread; |
|
510 |
Map->FindL(KUnreadFlag,unread); |
|
511 |
messageunread = unread.AsTBool(); |
|
512 |
unread.Reset(); |
|
513 |
} |
|
514 |
} |
|
515 |
data.Reset(); |
|
516 |
} |
|
517 |
} |
|
518 |
inParamList->Reset(); |
|
519 |
outParamList->Reset(); |
|
520 |
||
521 |
if(testmessageid > 0) |
|
522 |
{ |
|
523 |
TLiwGenericParam msgid; |
|
524 |
TLiwVariant msgidvalue; |
|
525 |
TLiwGenericParam msgflag; |
|
526 |
||
527 |
msgidvalue.Set(TInt32(testmessageid)); |
|
528 |
msgid.SetNameAndValueL(KMsgId,msgidvalue); |
|
529 |
inParamList->AppendL(msgid); |
|
530 |
msgidvalue.Reset(); |
|
531 |
msgid.Reset(); |
|
532 |
||
533 |
if ( messageunread ) |
|
534 |
msgflag.SetNameAndValueL(KStatus,TLiwVariant(KMsgStatusRead)); |
|
535 |
else |
|
536 |
msgflag.SetNameAndValueL(KStatus,TLiwVariant(KMsgStatusUnread)); |
|
537 |
||
538 |
inParamList->AppendL(msgflag); |
|
539 |
||
540 |
msgflag.Reset(); |
|
541 |
||
542 |
interface->ExecuteCmdL(KCmd,*inParamList,*outParamList); |
|
543 |
||
544 |
inParamList->Reset(); |
|
545 |
outParamList->Reset(); |
|
546 |
||
547 |
TLiwVariant content(_L("Inbox")); |
|
548 |
TLiwGenericParam elem ; |
|
549 |
elem.SetNameAndValueL(_L8("Type"),content); |
|
550 |
inParamList->AppendL(elem); |
|
551 |
content.Reset(); |
|
552 |
elem.Reset(); |
|
553 |
||
554 |
||
555 |
CLiwDefaultMap* filtermap = CLiwDefaultMap::NewL(); |
|
556 |
CleanupStack::PushL(filtermap); |
|
557 |
||
558 |
TLiwVariant filterid( testmessageid ); |
|
559 |
filtermap->InsertL(KMessageId, filterid); // Mtmtype is added |
|
560 |
filterid.Reset(); |
|
561 |
||
562 |
||
563 |
TLiwVariant filterparam(filtermap); |
|
564 |
TLiwGenericParam element ; |
|
565 |
element.SetNameAndValueL(_L8("Filter"),filterparam); |
|
566 |
filterparam.Reset(); |
|
567 |
||
568 |
inParamList->AppendL(element); |
|
569 |
element.Reset(); |
|
570 |
||
571 |
filtermap->DecRef(); |
|
572 |
CleanupStack::Pop(filtermap); |
|
573 |
||
574 |
||
575 |
TInt err = 0; |
|
576 |
TRAP(err,interface->ExecuteCmdL( KCmdGetHeaderList ,*inParamList ,*outParamList)); |
|
577 |
pos = 0 ; |
|
578 |
||
579 |
||
580 |
const TLiwGenericParam* finaloutput = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
581 |
||
582 |
if ( finaloutput ) |
|
583 |
{ |
|
584 |
CLiwIterable* iterlist = finaloutput->Value().AsIterable(); |
|
585 |
||
586 |
if(iterlist) |
|
587 |
{ |
|
588 |
TLiwVariant data; |
|
589 |
if ( iterlist->NextL(data) ) |
|
590 |
{ |
|
591 |
const CLiwMap* Map = data.AsMap(); |
|
592 |
||
593 |
if ( Map ) |
|
594 |
{ |
|
595 |
TLiwVariant messageid; |
|
596 |
Map->FindL(_L8("MessageId"),messageid); |
|
597 |
TMsvId newtestmessageid = (TInt)messageid.AsTInt32(); |
|
598 |
messageid.Reset(); |
|
599 |
||
600 |
TLiwVariant unread; |
|
601 |
Map->FindL(KUnreadFlag,unread); |
|
602 |
TBool newmessageunread = unread.AsTBool(); |
|
603 |
unread.Reset(); |
|
604 |
||
605 |
if (( messageunread != newmessageunread) && (testmessageid == newtestmessageid )) |
|
606 |
result = KErrNone; |
|
607 |
else |
|
608 |
result = KErrGeneral; |
|
609 |
} |
|
610 |
} |
|
611 |
data.Reset(); |
|
612 |
} |
|
613 |
} |
|
614 |
||
615 |
inParamList->Reset(); |
|
616 |
outParamList->Reset(); |
|
617 |
} |
|
618 |
||
619 |
} |
|
620 |
||
621 |
interface->Close(); |
|
622 |
||
623 |
CleanupStack::PopAndDestroy( iServiceHandler ); |
|
624 |
||
625 |
__UHEAP_MARKEND; |
|
626 |
||
627 |
return result; |
|
628 |
||
629 |
} |
|
630 |
||
631 |
||
632 |
||
633 |