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 "async_send_message.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 <cmsvattachment.h> |
19 | 28 |
#include "messagingservice.h" |
29 |
#include "messageheader.h" |
|
30 |
#include "async.h" |
|
31 |
||
32 |
||
33 |
// EXTERNAL DATA STRUCTURES |
|
34 |
//extern ?external_data; |
|
35 |
||
36 |
// EXTERNAL FUNCTION PROTOTYPES |
|
37 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
38 |
||
39 |
// CONSTANTS |
|
40 |
//const ?type ?constant_var = ?constant; |
|
41 |
||
42 |
// MACROS |
|
43 |
//#define ?macro ?macro_def |
|
44 |
||
45 |
// LOCAL CONSTANTS AND MACROS |
|
46 |
//const ?type ?constant_var = ?constant; |
|
47 |
//#define ?macro_name ?macro_def |
|
48 |
||
49 |
// MODULE DATA STRUCTURES |
|
50 |
//enum ?declaration |
|
51 |
//typedef ?declaration |
|
52 |
||
53 |
// LOCAL FUNCTION PROTOTYPES |
|
54 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
55 |
||
56 |
// FORWARD DECLARATIONS |
|
57 |
//class ?FORWARD_CLASSNAME; |
|
58 |
||
59 |
// ============================= LOCAL FUNCTIONS =============================== |
|
60 |
||
61 |
// ----------------------------------------------------------------------------- |
|
62 |
// ?function_name ?description. |
|
63 |
// ?description |
|
64 |
// Returns: ?value_1: ?description |
|
65 |
// ?value_n: ?description_line1 |
|
66 |
// ?description_line2 |
|
67 |
// ----------------------------------------------------------------------------- |
|
68 |
// |
|
69 |
/* |
|
70 |
?type ?function_name( |
|
71 |
?arg_type arg, // ?description |
|
72 |
?arg_type arg) // ?description |
|
73 |
{ |
|
74 |
||
75 |
?code // ?comment |
|
76 |
||
77 |
// ?comment |
|
78 |
?code |
|
79 |
} |
|
80 |
*/ |
|
81 |
||
82 |
// ============================ MEMBER FUNCTIONS =============================== |
|
83 |
||
84 |
// ----------------------------------------------------------------------------- |
|
85 |
// Casync_send_message::Delete |
|
86 |
// Delete here all resources allocated and opened from test methods. |
|
87 |
// Called from destructor. |
|
88 |
// ----------------------------------------------------------------------------- |
|
89 |
// |
|
90 |
void Casync_send_message::Delete() |
|
91 |
{ |
|
92 |
||
93 |
} |
|
94 |
||
95 |
// ----------------------------------------------------------------------------- |
|
96 |
// Casync_send_message::RunMethodL |
|
97 |
// Run specified method. Contains also table of test mothods and their names. |
|
98 |
// ----------------------------------------------------------------------------- |
|
99 |
// |
|
100 |
TInt Casync_send_message::RunMethodL( |
|
101 |
CStifItemParser& aItem ) |
|
102 |
{ |
|
103 |
||
104 |
static TStifFunctionInfo const KFunctions[] = |
|
105 |
{ |
|
106 |
// Copy this line for every implemented function. |
|
107 |
// First string is the function name used in TestScripter script file. |
|
108 |
// Second is the actual implementation member function. |
|
109 |
ENTRY( "test_1", Casync_send_message::Test1L ), |
|
110 |
||
111 |
}; |
|
112 |
||
113 |
const TInt count = sizeof( KFunctions ) / |
|
114 |
sizeof( TStifFunctionInfo ); |
|
115 |
||
116 |
return RunInternalL( KFunctions, count, aItem ); |
|
117 |
||
118 |
} |
|
119 |
||
120 |
// ----------------------------------------------------------------------------- |
|
121 |
// Casync_send_message::ExampleL |
|
122 |
// Example test method function. |
|
123 |
// (other items were commented in a header). |
|
124 |
// ----------------------------------------------------------------------------- |
|
125 |
// |
|
126 |
||
127 |
TInt iResult; |
|
128 |
||
129 |
TInt Casync_send_message::fromarray_func(CStifItemParser& aItem,TPtrC& fromarray) |
|
130 |
{ |
|
131 |
TInt err = aItem.GetNextString(fromarray); |
|
132 |
if(err) |
|
133 |
{ |
|
134 |
//iLog->Log(_L("Failed to Get from array")); |
|
135 |
return KErrGeneral; |
|
136 |
}; |
|
137 |
return KErrNone; |
|
138 |
} |
|
139 |
||
140 |
||
141 |
TInt Casync_send_message::messtype_func(CStifItemParser& aItem,TPtrC& messtype) |
|
142 |
{ |
|
143 |
TInt err = aItem.GetNextString(messtype); |
|
144 |
if(err) |
|
145 |
{ |
|
146 |
//iLog->Log(_L("Failed to Get message type")); |
|
147 |
return KErrGeneral; |
|
148 |
}; |
|
149 |
return KErrNone; |
|
150 |
} |
|
151 |
||
152 |
TInt Casync_send_message::subject_func(CStifItemParser& aItem,TPtrC& subj) |
|
153 |
{ |
|
154 |
TInt err = aItem.GetNextString(subj); |
|
155 |
if(err) |
|
156 |
{ |
|
157 |
//iLog->Log(_L("Failed to Get subject")); |
|
158 |
return KErrGeneral; |
|
159 |
}; |
|
160 |
return KErrNone; |
|
161 |
} |
|
162 |
||
163 |
||
164 |
TInt Casync_send_message::attach_func(CStifItemParser& aItem,TPtrC& attachm) |
|
165 |
{ |
|
166 |
TInt err = aItem.GetNextString(attachm); |
|
167 |
if(err) |
|
168 |
{ |
|
169 |
//iLog->Log(_L("Failed to Get attachments path")); |
|
170 |
return KErrGeneral; |
|
171 |
}; |
|
172 |
return KErrNone; |
|
173 |
} |
|
174 |
||
175 |
TInt Casync_send_message::attachtype_func(CStifItemParser& aItem,TPtrC& attachfiletype) |
|
176 |
{ |
|
177 |
TInt err = aItem.GetNextString(attachfiletype); |
|
178 |
if(err) |
|
179 |
{ |
|
180 |
//iLog->Log(_L("Failed to Get attachments type")); |
|
181 |
return KErrGeneral; |
|
182 |
}; |
|
183 |
return KErrNone; |
|
184 |
} |
|
185 |
||
186 |
||
187 |
TInt Casync_send_message::template_func(CStifItemParser& aItem,TInt& templateid) |
|
188 |
{ |
|
189 |
TInt err = aItem.GetNextInt(templateid); |
|
190 |
if(err) |
|
191 |
{ |
|
192 |
//iLog->Log(_L("Failed to Get template id")); |
|
193 |
return KErrGeneral; |
|
194 |
}; |
|
195 |
return KErrNone; |
|
196 |
} |
|
197 |
||
198 |
||
199 |
TInt Casync_send_message::editor_func(CStifItemParser& aItem,TInt& editorl) |
|
200 |
{ |
|
201 |
TInt err = aItem.GetNextInt(editorl); |
|
202 |
if(err) |
|
203 |
{ |
|
204 |
//iLog->Log(_L("Failed to Get launch flag for editor")); |
|
205 |
return KErrGeneral; |
|
206 |
}; |
|
207 |
return KErrNone; |
|
208 |
} |
|
209 |
TInt Casync_send_message::messageid_func(CStifItemParser& aItem,TInt& id) |
|
210 |
{ |
|
211 |
TInt err = aItem.GetNextInt(id); |
|
212 |
if(err) |
|
213 |
{ |
|
214 |
//iLog->Log(_L("Failed to Get message id")); |
|
215 |
return KErrGeneral; |
|
216 |
}; |
|
217 |
return KErrNone; |
|
218 |
} |
|
219 |
||
220 |
TInt Casync_send_message::body_func(CStifItemParser& aItem,TPtrC& body) |
|
221 |
{ |
|
222 |
TInt err = aItem.GetNextString(body); |
|
223 |
if(err) |
|
224 |
{ |
|
225 |
//iLog->Log(_L("Failed to Get subject")); |
|
226 |
return KErrGeneral; |
|
227 |
}; |
|
228 |
return KErrNone; |
|
229 |
} |
|
230 |
||
231 |
TInt Casync_send_message::sender_func(CStifItemParser& aItem,TPtrC& sender) |
|
232 |
{ |
|
233 |
TInt err = aItem.GetNextString(sender); |
|
234 |
if(err) |
|
235 |
{ |
|
236 |
//iLog->Log(_L("Failed to Get sender")); |
|
237 |
return KErrGeneral; |
|
238 |
}; |
|
239 |
return KErrNone; |
|
240 |
} |
|
241 |
||
242 |
TInt Casync_send_message::rec_func(CStifItemParser& aItem,TPtrC& recarray) |
|
243 |
{ |
|
244 |
TInt err = aItem.GetNextString(recarray); |
|
245 |
if(err) |
|
246 |
{ |
|
247 |
//iLog->Log(_L("Failed to Get recarray")); |
|
248 |
return KErrGeneral; |
|
249 |
}; |
|
250 |
return KErrNone; |
|
251 |
} |
|
252 |
||
253 |
TInt Casync_send_message::flag_func(CStifItemParser& aItem,TInt& flag) |
|
254 |
{ |
|
255 |
TInt err = aItem.GetNextInt(flag); |
|
256 |
if(err) |
|
257 |
{ |
|
258 |
//iLog->Log(_L("Failed to Get flag id")); |
|
259 |
return KErrGeneral; |
|
260 |
}; |
|
261 |
return KErrNone; |
|
262 |
} |
|
263 |
||
264 |
||
265 |
||
266 |
||
267 |
Cheader_test* Cheader_test::NewL() |
|
268 |
{ |
|
269 |
Cheader_test* self = new(ELeave)Cheader_test(); |
|
270 |
self->ConstructL(); |
|
271 |
return self; |
|
272 |
} |
|
273 |
||
274 |
||
275 |
Cheader_test::~Cheader_test() |
|
276 |
{ |
|
277 |
Cancel(); |
|
278 |
||
279 |
if(iWaitSchedular->IsStarted()) |
|
280 |
iWaitSchedular->AsyncStop(); |
|
281 |
||
282 |
if(iMessagingService) |
|
283 |
delete iMessagingService; |
|
284 |
||
285 |
if(iWaitSchedular) |
|
286 |
delete iWaitSchedular; |
|
287 |
} |
|
288 |
||
289 |
||
290 |
void Cheader_test::ConstructL() |
|
291 |
{ |
|
292 |
CActiveScheduler::Add(this); |
|
293 |
iMessagingService = CMessagingService::NewL(); |
|
294 |
iWaitSchedular = new(ELeave) CActiveSchedulerWait(); |
|
295 |
} |
|
296 |
||
297 |
||
298 |
Cheader_test::Cheader_test() : |
|
299 |
CActive(EPriorityStandard) |
|
300 |
{ |
|
301 |
} |
|
302 |
||
303 |
||
304 |
void Cheader_test::DoCancel() |
|
305 |
{ |
|
306 |
||
307 |
} |
|
308 |
||
309 |
||
310 |
void Cheader_test::RunL() |
|
311 |
{ |
|
312 |
TestFunc(); |
|
313 |
} |
|
314 |
||
315 |
||
316 |
void Cheader_test::Start() |
|
317 |
{ |
|
318 |
SetActive(); |
|
319 |
TRequestStatus* temp = &iStatus; |
|
320 |
User::RequestComplete(temp, KErrNone); |
|
321 |
iWaitSchedular->Start(); |
|
322 |
} |
|
323 |
||
324 |
||
325 |
||
326 |
void Cheader_test::set(CSendMessageParams* pi) |
|
327 |
{ |
|
328 |
v = pi; |
|
329 |
} |
|
330 |
||
331 |
CSendMessageParams* Cheader_test::get(void) |
|
332 |
{ |
|
333 |
return v; |
|
334 |
} |
|
335 |
||
336 |
void Cheader_test::NotifyResultL(TInt aErrCode, TAny* aResult) |
|
337 |
{ |
|
338 |
||
339 |
if(aErrCode == KErrNone) |
|
340 |
{ |
|
341 |
||
342 |
if(exflag == 1) |
|
343 |
{ |
|
344 |
User::Leave(-9); |
|
345 |
} |
|
346 |
||
347 |
/* #if defined(__WINSCW__) || defined(__WINS__) |
|
348 |
||
349 |
TBool test = TRUE; |
|
350 |
CMessagingService* service = (CMessagingService*)CMessagingService::NewL(); |
|
351 |
||
352 |
CFilterParamInfo* filter = CFilterParamInfo::NewL(); |
|
353 |
||
354 |
TMsvSorting sort = EMsvSortByDateReverse; |
|
355 |
filter->SetSortType(sort); // sort by date reverse |
|
356 |
||
357 |
CMsvEntrySelection* array = NULL ; |
|
358 |
||
359 |
TRAPD(err,service->GetIdListL(filter,0,NULL ,array)); |
|
360 |
||
361 |
TInt index = 0; |
|
362 |
||
363 |
CMessageHeader* headers = NULL; |
|
364 |
service->GetNextHeaderL(filter, array, index, NULL, headers); |
|
365 |
_LIT(Kblanksms,"\x2029"); |
|
366 |
_LIT(Kblankmms,""); |
|
367 |
||
368 |
if(headers) |
|
369 |
{ |
|
370 |
||
371 |
TPtrC subject = headers->Subject(); |
|
372 |
TPtrC from = headers->From(); |
|
373 |
||
374 |
TPtrC sub,fr; |
|
375 |
||
376 |
if( ((subject == Kblanksms)||(subject == Kblankmms)||(subject.FindF(b)!= KErrNotFound)) && (r[0] == from)) // compare message subject |
|
377 |
{ |
|
378 |
test = TRUE; |
|
379 |
} |
|
380 |
else |
|
381 |
{ |
|
382 |
test = FALSE; |
|
383 |
} |
|
384 |
delete headers; |
|
385 |
} |
|
386 |
else |
|
387 |
{ |
|
388 |
test = FALSE; |
|
389 |
}*/ |
|
390 |
||
391 |
||
392 |
/* for(TInt i=0;i<attcnt;i++) |
|
393 |
{ |
|
394 |
CMessageAttachInfo* obj = detail->iAttachEntries->At(i); |
|
395 |
obj->iFile.Close(); |
|
396 |
} */ |
|
397 |
||
398 |
/* delete array; |
|
399 |
delete filter; |
|
400 |
delete service; |
|
401 |
||
402 |
if(test == TRUE) |
|
403 |
iResult = KErrNone; |
|
404 |
else |
|
405 |
iResult = KErrGeneral; |
|
406 |
||
407 |
#else*/ |
|
408 |
||
409 |
iResult = KErrNone; |
|
410 |
||
411 |
// #endif |
|
412 |
} |
|
413 |
else |
|
414 |
{ |
|
415 |
if(aErrCode == -9) |
|
416 |
{ |
|
417 |
iResult = KErrNone; |
|
418 |
User::Leave(-9); |
|
419 |
} |
|
420 |
if(aErrCode == pick2) |
|
421 |
iResult = KErrNone; |
|
422 |
else |
|
423 |
iResult = KErrGeneral; |
|
424 |
||
425 |
} |
|
426 |
||
427 |
iWaitSchedular->AsyncStop(); |
|
428 |
} |
|
429 |
||
430 |
int memorycleanflag = 0; |
|
431 |
||
432 |
void Cheader_test::TestFunc() |
|
433 |
{ |
|
434 |
||
435 |
CSendMessageParams* arg = get(); |
|
436 |
||
437 |
TRAPD(err, iMessagingService->SendMessageL(arg ,this)); |
|
438 |
||
439 |
if(err!=0) |
|
440 |
{ |
|
441 |
memorycleanflag = 1; |
|
442 |
iResult = KErrNone; |
|
443 |
iWaitSchedular->AsyncStop(); |
|
444 |
} |
|
445 |
||
446 |
if(canflag == 1) |
|
447 |
{ |
|
448 |
TInt c1 = iMessagingService->Cancel(1); |
|
449 |
iMessagingService->Cancel(0); |
|
450 |
} |
|
451 |
||
452 |
} |
|
453 |
||
454 |
||
455 |
||
456 |
||
457 |
TInt Casync_send_message::Test1L( CStifItemParser& aItem ) |
|
458 |
{ |
|
459 |
||
460 |
||
461 |
TPtrC fromarray,messtype,subj,attachfiletype,attachm,body,sender,recarray; |
|
462 |
TInt templateid,editorl,flag,flag1,flag2,count1=0; |
|
463 |
||
464 |
||
465 |
CSendMessageParams* send = CSendMessageParams::NewL(); |
|
466 |
||
467 |
||
468 |
TInt err1 = fromarray_func(aItem,fromarray); |
|
469 |
if(err1) |
|
470 |
{ |
|
471 |
return KErrGeneral; |
|
472 |
} |
|
473 |
||
474 |
_LIT(Knull,"NULL"); |
|
475 |
if(fromarray.CompareF(Knull)) |
|
476 |
{ |
|
477 |
_LIT(Kfin,"AddrEnd"); |
|
478 |
while(fromarray != Kfin) |
|
479 |
{ |
|
480 |
count1++; |
|
481 |
send->AddRecipientL(fromarray,EMsvRecipientTo); // recipient array |
|
482 |
err1 = fromarray_func(aItem,fromarray); |
|
483 |
if(err1) |
|
484 |
{ |
|
485 |
return KErrGeneral; |
|
486 |
} |
|
487 |
} |
|
488 |
} |
|
489 |
else |
|
490 |
{ |
|
491 |
// send.iRecipientArray = NULL; |
|
492 |
} |
|
493 |
||
494 |
||
495 |
||
496 |
err1 = messtype_func(aItem,messtype); |
|
497 |
if(err1) |
|
498 |
{ |
|
499 |
return KErrGeneral; |
|
500 |
} |
|
501 |
||
502 |
if(messtype.CompareF(Knull)) |
|
503 |
{ |
|
504 |
send->SetMessageTypeL(messtype); // type of message |
|
505 |
} |
|
506 |
else |
|
507 |
{ |
|
508 |
// send->SetMessageTypeL = NULL; |
|
509 |
} |
|
510 |
||
511 |
||
512 |
||
513 |
err1 = subject_func(aItem,subj); |
|
514 |
if(err1) |
|
515 |
{ |
|
516 |
return KErrGeneral; |
|
517 |
} |
|
518 |
||
519 |
if(subj.CompareF(Knull)) |
|
520 |
{ |
|
521 |
send->SetSubjectL(subj); // subject |
|
522 |
} |
|
523 |
else |
|
524 |
{ |
|
525 |
// send->SetSubjectL = NULL; |
|
526 |
} |
|
527 |
||
528 |
||
529 |
||
530 |
err1 = body_func(aItem,body); |
|
531 |
if(err1) |
|
532 |
{ |
|
533 |
return KErrGeneral; |
|
534 |
} |
|
535 |
||
536 |
if(body.CompareF(Knull)) |
|
537 |
{ |
|
538 |
send->SetBodyTextL(body); // body of message |
|
539 |
} |
|
540 |
else |
|
541 |
{ |
|
542 |
// send->SetBodyTextL = NULL; |
|
543 |
} |
|
544 |
||
545 |
||
546 |
||
547 |
err1 = flag_func(aItem,flag); |
|
548 |
if(err1) |
|
549 |
{ |
|
550 |
return KErrGeneral; |
|
551 |
} |
|
552 |
TInt att_cnt = flag; |
|
553 |
if(flag!=0) // any attachments |
|
554 |
{ |
|
555 |
||
556 |
for(int i=0;i<flag;i++) |
|
557 |
{ |
|
558 |
err1 = attach_func(aItem,attachm); |
|
559 |
if(err1) |
|
560 |
{ |
|
561 |
return KErrGeneral; |
|
562 |
} |
|
563 |
err1 = attachtype_func(aItem,attachfiletype); |
|
564 |
if(err1) |
|
565 |
{ |
|
566 |
return KErrGeneral; |
|
567 |
} |
|
568 |
_LIT(Kbl,"NULL"); |
|
569 |
CMsvAttachment::TMsvAttachmentType attachtype = CMsvAttachment::EMsvFile; |
|
570 |
CMsvAttachment* element = CMsvAttachment::NewL(attachtype); |
|
571 |
if(attachm != Kbl) |
|
572 |
{ |
|
573 |
element->SetAttachmentNameL(attachm); // attachment path |
|
574 |
} |
|
575 |
if(attachfiletype != Kbl) |
|
576 |
{ |
|
577 |
TBuf8<30> mimetype ; |
|
578 |
mimetype.Copy(attachfiletype); |
|
579 |
element->SetMimeTypeL(mimetype); // attachment mime type |
|
580 |
} |
|
581 |
send->AddAttachmentL(element); |
|
582 |
} |
|
583 |
||
584 |
} |
|
585 |
else |
|
586 |
{ |
|
587 |
// send->AddAttachmentL = NULL; |
|
588 |
} |
|
589 |
||
590 |
||
591 |
||
592 |
err1 = template_func(aItem,templateid); |
|
593 |
if(err1) |
|
594 |
{ |
|
595 |
return KErrGeneral; |
|
596 |
} |
|
597 |
||
598 |
if(templateid == 1) |
|
599 |
{ |
|
600 |
CMessagingService* mservice = (CMessagingService*)CMessagingService::NewL(); |
|
601 |
CleanupStack::PushL(mservice); |
|
602 |
CFilterParamInfo* mfilter = CFilterParamInfo::NewL(); |
|
603 |
CMsvEntrySelection* marray = NULL ; |
|
604 |
TRAPD(err,mservice->GetIdListL(mfilter,0,NULL ,marray)); |
|
605 |
TInt index = 0; |
|
606 |
CMessageHeader* headerarr = NULL; |
|
607 |
mservice->GetNextHeaderL(mfilter, marray, index, NULL, headerarr); |
|
608 |
TMsvId message_id; |
|
609 |
headerarr->GetMessageId(message_id); |
|
610 |
send->SetTemplateId(message_id); |
|
611 |
delete headerarr; |
|
612 |
delete marray; |
|
613 |
delete mfilter; |
|
614 |
CleanupStack::PopAndDestroy(mservice); |
|
615 |
} |
|
616 |
else if(templateid == 2) |
|
617 |
{ |
|
618 |
CMessagingService* mservice = (CMessagingService*)CMessagingService::NewL(); |
|
619 |
CleanupStack::PushL(mservice); |
|
620 |
CFilterParamInfo* mfilter = CFilterParamInfo::NewL(); |
|
621 |
CMsvEntrySelection* marray = NULL ; |
|
622 |
TRAPD(err,mservice->GetIdListL(mfilter,0,NULL ,marray)); |
|
623 |
TInt index = 0; |
|
624 |
_LIT(Kwron,"wr"); |
|
625 |
for(;;) |
|
626 |
{ |
|
627 |
CMessageHeader* headerarr = NULL; |
|
628 |
mservice->GetNextHeaderL(mfilter, marray, index, NULL, headerarr); |
|
629 |
if(headerarr) |
|
630 |
{ |
|
631 |
TPtrC subn = headerarr->Subject(); |
|
632 |
TMsvId message_id; |
|
633 |
headerarr->GetMessageId(message_id); |
|
634 |
if((subn.FindF(Kwron))!=KErrNotFound) |
|
635 |
{ |
|
636 |
send->SetTemplateId(message_id); |
|
637 |
} |
|
638 |
delete headerarr; |
|
639 |
} |
|
640 |
else |
|
641 |
break; |
|
642 |
} |
|
643 |
delete marray; |
|
644 |
delete mfilter; |
|
645 |
CleanupStack::PopAndDestroy(mservice); |
|
646 |
} |
|
647 |
else if(templateid == 3) |
|
648 |
{ |
|
649 |
CMessagingService* mservice = (CMessagingService*)CMessagingService::NewL(); |
|
650 |
CleanupStack::PushL(mservice); |
|
651 |
CFilterParamInfo* mfilter = CFilterParamInfo::NewL(); |
|
652 |
CMsvEntrySelection* marray = NULL ; |
|
653 |
TRAPD(err,mservice->GetIdListL(mfilter,0,NULL ,marray)); |
|
654 |
TInt index = 0; |
|
655 |
for(;;) |
|
656 |
{ |
|
657 |
CMessageHeader* headerarr = NULL; |
|
658 |
mservice->GetNextHeaderL(mfilter, marray, index, NULL, headerarr); |
|
659 |
_LIT(Kwron1,"nok"); |
|
660 |
_LIT(Kwron2,"hi"); |
|
661 |
TBool flg; |
|
662 |
if(headerarr) |
|
663 |
{ |
|
664 |
TPtrC subn = headerarr->Subject(); |
|
665 |
headerarr->GetAttachFlag(flg); |
|
666 |
TMsvId message_id; |
|
667 |
headerarr->GetMessageId(message_id); |
|
668 |
if(((subn.FindF(Kwron1))==KErrNotFound)&&((subn.FindF(Kwron2))==KErrNotFound)&&(flg!=0)) |
|
669 |
{ |
|
670 |
send->SetTemplateId(message_id); |
|
671 |
} |
|
672 |
delete headerarr; |
|
673 |
} |
|
674 |
else |
|
675 |
break; |
|
676 |
} |
|
677 |
delete marray; |
|
678 |
delete mfilter; |
|
679 |
CleanupStack::PopAndDestroy(mservice); |
|
680 |
} |
|
681 |
else |
|
682 |
{ |
|
683 |
send->SetTemplateId(templateid); // template id |
|
684 |
} |
|
685 |
||
686 |
||
687 |
err1 = editor_func(aItem,editorl); |
|
688 |
if(err1) |
|
689 |
{ |
|
690 |
return KErrGeneral; |
|
691 |
} |
|
692 |
send->SetLaunchEditor(editorl); // launch editor or not |
|
693 |
||
694 |
||
695 |
||
696 |
Cheader_test* test = Cheader_test::NewL(); |
|
697 |
||
698 |
test->set(send); |
|
699 |
test->attcnt = att_cnt; |
|
700 |
||
701 |
err1 = flag_func(aItem,flag1); // +ve or -ve test case |
|
702 |
if(err1) |
|
703 |
{ |
|
704 |
return KErrGeneral; |
|
705 |
} |
|
706 |
||
707 |
if(flag1 == 0) |
|
708 |
{ |
|
709 |
err1 = body_func(aItem,body); // get bodytxt from cfg |
|
710 |
if(err1) |
|
711 |
{ |
|
712 |
return KErrGeneral; |
|
713 |
} |
|
714 |
test->b.Set(body); |
|
715 |
||
716 |
for(int i=0;i<count1;i++) |
|
717 |
{ |
|
718 |
err1 = rec_func(aItem,recarray); // get recarray from cfg |
|
719 |
if(err1) |
|
720 |
{ |
|
721 |
return KErrGeneral; |
|
722 |
} |
|
723 |
test->r[i].Set(recarray); |
|
724 |
} |
|
725 |
||
726 |
||
727 |
} |
|
728 |
else |
|
729 |
{ |
|
730 |
err1 = flag_func(aItem,flag2); // get err code from cfg |
|
731 |
if(err1) |
|
732 |
{ |
|
733 |
return KErrGeneral; |
|
734 |
} |
|
735 |
if(flag2 == -3) |
|
736 |
{ |
|
737 |
test->canflag = 1; |
|
738 |
} |
|
739 |
if(flag2 == -9) |
|
740 |
{ |
|
741 |
test->exflag = 1; |
|
742 |
} |
|
743 |
test->pick2 = flag2; |
|
744 |
} |
|
745 |
||
746 |
||
747 |
test->Start(); |
|
748 |
||
749 |
||
750 |
||
751 |
if( ( (templateid!=0) && (templateid!=1)&& (templateid!=3)&& (templateid!=2) ) || (memorycleanflag !=0) ) |
|
752 |
{ |
|
753 |
delete test; |
|
754 |
} |
|
755 |
TInt ret = iResult; |
|
756 |
return ret; |
|
757 |
||
758 |
||
759 |
||
760 |
||
761 |
} |
|
762 |
||
763 |
// ----------------------------------------------------------------------------- |
|
764 |
// Casync_send_message::?member_function |
|
765 |
// ?implementation_description |
|
766 |
// (other items were commented in a header). |
|
767 |
// ----------------------------------------------------------------------------- |
|
768 |
// |
|
769 |
/* |
|
770 |
TInt Casync_send_message::?member_function( |
|
771 |
CItemParser& aItem ) |
|
772 |
{ |
|
773 |
||
774 |
?code |
|
775 |
||
776 |
} |
|
777 |
*/ |
|
778 |
||
779 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
780 |
// None |
|
781 |
||
782 |
// End of File |