|
1 // Copyright (c) 2004-2009 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 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // ???01 : Start |
|
15 // Move to own file something like |
|
16 // "\messaging\terstframework\testactionutils\src\CmtfTestActionUtilsImapScripts.cpp" |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 */ |
|
23 |
|
24 #include "CMtfTestActionUtilsImapScripts.h" |
|
25 |
|
26 #include <imapset.h> |
|
27 #include <smtpset.h> |
|
28 #include <iapprefs.h> |
|
29 |
|
30 #include "CMtfTestActionUtilsConfigFileParser.h" |
|
31 #include "CMtfTestActionUtilsConfigFileMachineName.h" |
|
32 |
|
33 #include "CMtfTestCase.h" |
|
34 #include "CMtfTestActionParameters.h" |
|
35 |
|
36 // Imap Settings |
|
37 |
|
38 _LIT(KCfgImapServerAddress, "ImapServerAddress"); //* |
|
39 _LIT(KEmailAddressExtension, "EmailAddressExtension"); |
|
40 _LIT(KCfgImapLoginName, "ImapLoginName"); //* |
|
41 _LIT(KCfgImapPassword, "ImapPassword"); //* |
|
42 _LIT(KCfgImapPort, "ImapPort"); //* |
|
43 _LIT(KCfgImapSecureSockets, "ImapSecureSockets"); //* |
|
44 _LIT(KCfgImapSSLWrapper, "ImapSSLWrapper"); //* |
|
45 //_LIT(KCfgImapVersion, "ImapVersion"); // Does not actually exists is hardcoded. |
|
46 _LIT(KCfgImapFolderPath, "ImapFolderPath"); //* errors question. |
|
47 _LIT(KCfgImapPathSeperator, "ImapPathSeperator"); //* |
|
48 _LIT(KCfgImapMaxEmailSize, "ImapMaxEmailSize"); //* |
|
49 _LIT(KCfgImapGetMailOptions, "ImapGetMailOptions"); //* |
|
50 _LIT(KCfgImapInboxSynchronisationLimit, "ImapInboxSynchronisationLimit"); //* |
|
51 _LIT(KCfgImapMailboxSynchronisationLimit, "ImapMailSynchronisationLimit"); //* |
|
52 |
|
53 _LIT(KCfgImapAutoSendOnConnect, "ImapAutoSendOnConnect" ); //* |
|
54 _LIT(KCfgImapDeleteEmailsWhenDisconnecting, "ImapDeleteEmailsWhenDisconnecting" ); //* |
|
55 _LIT(KCfgImapAcknowledgeReceipts, "ImapAcknowledgeReceipts" ); //* |
|
56 _LIT(KCfgImapDisconnectedUserMode, "ImapDisconnectedUserMode" ); //* |
|
57 _LIT(KCfgImapSynchronise, "ImapSynchronise" ); //* Constants Added |
|
58 _LIT(KCfgImapSubscribe, "ImapSubscribe" ); //* Constants Added. |
|
59 _LIT(KCfgImapUpdatingSeenFlags, "ImapUpdatingSeenFlags" ); //* |
|
60 _LIT(KCfgImapSyncRate, "ImapSyncRate" ); //* |
|
61 _LIT(KCfgImapFetchSize, "ImapFetchSize" ); //* |
|
62 _LIT(KCfgImapIdle, "ImapIdle" ); //* |
|
63 _LIT(KCfgImapIdleTimeout, "ImapIdleTimeout" ); //* |
|
64 _LIT(KCfgImapPartialMailOptions, "ImapPartialMailOptions" ); //* |
|
65 _LIT(KCfgImapBodyTextSizeLimit, "ImapBodyTextSizeLimit" ); //* |
|
66 _LIT(KCfgImapAttachmentSizeLimit, "ImapAttachmentSizeLimit" ); //* |
|
67 |
|
68 |
|
69 _LIT(KCfgImapIapList , "ImapIapList" ); |
|
70 |
|
71 |
|
72 // SMTP settings |
|
73 |
|
74 |
|
75 _LIT(KCfgSmtpServerAddress, "SmtpServerAddress"); //* |
|
76 _LIT(KCfgSmtpEmailAddress, "SmtpEmailAddress"); //* |
|
77 _LIT(KCfgSmtpBodyEncoding, "SmtpBodyEncoding"); //* |
|
78 _LIT(KCfgSmtpReceiptAddress, "SmtpReceiptAddress"); //* |
|
79 _LIT(KCfgSmtpRequestReceipts, "SmtpRequestReceipts"); //* |
|
80 _LIT(KCfgSmtpSendMessageOption, "SmtpSendMessageOption"); //* Constants Added |
|
81 _LIT(KCfgSmtpSetPort, "SmtpSetPort"); //* |
|
82 _LIT(KCfgSmtpEmailAlias, "SmtpEmailAlias"); //* |
|
83 _LIT(KCfgSmtpDefaultMsgCharSet, "SmtpMsgCharSet"); //* |
|
84 _LIT(KCfgSmtpSetReplyToAddress, "SmtpSetReplyToAddress"); //* |
|
85 _LIT(KCfgSmtpSetAddVCardToEmail, "SmtpSetAddVCardToEmail"); //* |
|
86 _LIT(KCfgSmtpSetAddSignatureToEmail, "SmtpSetAddSignatureToEmail"); //* |
|
87 _LIT(KCfgSmtpSetSendCopyToSelf, "SmtpSetSendCopyToSelf"); //* |
|
88 _LIT(KCfgSmtpSetLoginName, "SmtpSetLoginName"); //* |
|
89 _LIT(KCfgSmtpSetPassword, "SmtpSetPassword"); //* |
|
90 _LIT(KCfgSmtpSetSMTPAuth, "SmtpSetSMTPAuth"); //* |
|
91 _LIT(KCfgSmtpSetInboxLoginDetails, "SmtpSetInboxLoginDetails"); //* |
|
92 |
|
93 |
|
94 _LIT(KCfgSmtpSecureSockets, "SmtpSetSecureSockets"); //* |
|
95 _LIT(KCfgSmtpSSLWrapper, "SmtpSetSSLWrapper"); //* |
|
96 |
|
97 _LIT(KCfgSmtpIapList , "SmtpIapList" ); |
|
98 |
|
99 |
|
100 |
|
101 void CMtfTestActionUtilsImapScripts::ReadIAPAndAddL( CMtfTestCase& aTestCase, |
|
102 CMtfTestActionUtilsConfigFileParser* aScriptFileParser , |
|
103 const TDesC& aParamListName , CImIAPPreferences& aIapPref ) |
|
104 { |
|
105 TPtrC stringPtr; |
|
106 TPtrC baseString; |
|
107 |
|
108 if( aScriptFileParser->GetFieldAsString(aParamListName, stringPtr ) == KErrNone ) |
|
109 { |
|
110 |
|
111 TInt start=0; |
|
112 TInt end=stringPtr.Length(); |
|
113 |
|
114 while ( GetString( stringPtr , start, end , baseString ) ) |
|
115 { |
|
116 _ReadIAPAndAddL( aTestCase, aScriptFileParser, baseString, aIapPref ); |
|
117 } |
|
118 |
|
119 } |
|
120 |
|
121 } |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 TBool CMtfTestActionUtilsImapScripts::GetString( const TDesC& aStringPtr , TInt& aStart, TInt aEnd , TPtrC& aBaseString ) |
|
127 { |
|
128 TBool ret=EFalse; |
|
129 |
|
130 if (aStart==aEnd) |
|
131 { |
|
132 return EFalse; |
|
133 } |
|
134 |
|
135 TInt currPos=aStart; |
|
136 |
|
137 |
|
138 // strip out any starting spaces. |
|
139 while (currPos<aEnd ) |
|
140 { |
|
141 if ( aStringPtr[currPos] == ' ' || aStringPtr[currPos] == '\t' ) |
|
142 { |
|
143 currPos++; |
|
144 } |
|
145 else |
|
146 { |
|
147 break; |
|
148 } |
|
149 } |
|
150 TInt startTmp=currPos; |
|
151 |
|
152 while (currPos<aEnd ) |
|
153 { |
|
154 if ( aStringPtr[currPos] == ' ' || aStringPtr[currPos] == '\t' ) |
|
155 { |
|
156 break; |
|
157 } |
|
158 else |
|
159 { |
|
160 currPos++; |
|
161 ret=ETrue; |
|
162 } |
|
163 } |
|
164 |
|
165 if (ret) |
|
166 { // We have a string. |
|
167 aBaseString.Set( aStringPtr.Mid( startTmp, currPos-startTmp) ); |
|
168 } |
|
169 |
|
170 aStart=currPos; |
|
171 |
|
172 return ret; |
|
173 } |
|
174 |
|
175 |
|
176 void CMtfTestActionUtilsImapScripts::_ReadIAPAndAddL( CMtfTestCase& aTestCase, |
|
177 CMtfTestActionUtilsConfigFileParser* aScriptFileParser , |
|
178 const TDesC& aFieldName , CImIAPPreferences& aIapPref ) |
|
179 { |
|
180 |
|
181 TPtrC stringPtr; |
|
182 TInt intTmp; |
|
183 |
|
184 TImIAPChoice iapChoice; |
|
185 iapChoice.iIAP = 0; |
|
186 iapChoice.iDialogPref = ECommDbDialogPrefUnknown; |
|
187 |
|
188 TInt index=0; |
|
189 TBool modified=EFalse; |
|
190 |
|
191 HBufC* buf = HBufC::NewLC(100); |
|
192 |
|
193 buf->Des() = aFieldName; |
|
194 buf->Des().Append( _L("_ImapIAP") ); |
|
195 |
|
196 |
|
197 if(aScriptFileParser->GetFieldAsInteger(buf->Des(), intTmp) == KErrNone) |
|
198 { |
|
199 iapChoice.iIAP = intTmp; |
|
200 modified=ETrue; |
|
201 } |
|
202 |
|
203 |
|
204 buf->Des() = aFieldName; |
|
205 buf->Des().Append( _L("_ImapCommDbDialogPref") ); |
|
206 if(aScriptFileParser->GetFieldAsString(buf->Des(), stringPtr) == KErrNone) |
|
207 { |
|
208 TCommDbDialogPref setCommDbDialogPref = ObtainValueParameterL<TCommDbDialogPref>(aTestCase, stringPtr); |
|
209 iapChoice.iDialogPref= setCommDbDialogPref; |
|
210 modified=ETrue; |
|
211 } |
|
212 |
|
213 |
|
214 buf->Des() = aFieldName; |
|
215 buf->Des().Append( _L("_ImapIAPIndex") ); |
|
216 if(aScriptFileParser->GetFieldAsInteger(buf->Des(), intTmp) == KErrNone) |
|
217 { |
|
218 index = intTmp; |
|
219 modified=ETrue; |
|
220 } |
|
221 |
|
222 if (modified) |
|
223 { // Note only want to set the values if they are specified. Otherwise leave well alone. |
|
224 // Really should specify iapChoice.iIAP and iapChoice.iDialogPref at the same time. |
|
225 aIapPref.AddIAPL(iapChoice ,index ); |
|
226 } |
|
227 |
|
228 CleanupStack::PopAndDestroy(buf); |
|
229 |
|
230 } |
|
231 |
|
232 |
|
233 void CMtfTestActionUtilsImapScripts::ReadImapSettingsFromConfigurationFileL(CMtfTestCase& aTestCase, const TDesC& aSettingsFile, |
|
234 CImImap4Settings& aImapSet, CImIAPPreferences& aImapIapPref, |
|
235 CImSmtpSettings& aSmtpSet, CImIAPPreferences& aSmtpIapPref) |
|
236 { |
|
237 CMtfTestActionUtilsConfigFileParser* scriptFileParser = CMtfTestActionUtilsConfigFileParser::NewL(aSettingsFile); |
|
238 CleanupStack::PushL(scriptFileParser); |
|
239 |
|
240 TPtrC8 string8Ptr; |
|
241 TPtrC stringPtr; |
|
242 TInt intTmp; |
|
243 |
|
244 |
|
245 // Read in CImImap4Settings. |
|
246 |
|
247 if(scriptFileParser->GetFieldAsString(KCfgImapServerAddress, stringPtr) == KErrNone) |
|
248 { |
|
249 aImapSet.SetServerAddressL(stringPtr); |
|
250 } |
|
251 |
|
252 CMtfTestActionUtilsConfigFileMachineName* machineNameFile = NULL; |
|
253 |
|
254 TPtrC emailAddressExtension; |
|
255 if (scriptFileParser->GetFieldAsString(KEmailAddressExtension, emailAddressExtension) == KErrNone) |
|
256 { |
|
257 machineNameFile = CMtfTestActionUtilsConfigFileMachineName::NewLC(emailAddressExtension); |
|
258 } |
|
259 else |
|
260 { |
|
261 machineNameFile = CMtfTestActionUtilsConfigFileMachineName::NewLC(stringPtr); |
|
262 } |
|
263 |
|
264 TPtrC8 machineName(machineNameFile->MachineName()); |
|
265 |
|
266 if(scriptFileParser->GetFieldAsString8(KCfgImapLoginName, string8Ptr) == KErrNone) |
|
267 { |
|
268 aImapSet.SetLoginNameL(string8Ptr); |
|
269 } |
|
270 else |
|
271 { |
|
272 aImapSet.SetLoginNameL(machineName); |
|
273 } |
|
274 |
|
275 if(scriptFileParser->GetFieldAsString8(KCfgImapPassword, string8Ptr) == KErrNone) |
|
276 { |
|
277 aImapSet.SetPasswordL(string8Ptr); |
|
278 } |
|
279 else |
|
280 { |
|
281 aImapSet.SetPasswordL(machineName); |
|
282 } |
|
283 |
|
284 if(scriptFileParser->GetFieldAsInteger(KCfgImapPort, intTmp) == KErrNone) |
|
285 { |
|
286 aImapSet.SetPort(intTmp); |
|
287 } |
|
288 |
|
289 if(scriptFileParser->GetFieldAsInteger(KCfgImapSecureSockets, intTmp) == KErrNone) |
|
290 { |
|
291 aImapSet.SetSecureSockets( (TBool) intTmp ); |
|
292 } |
|
293 |
|
294 if(scriptFileParser->GetFieldAsInteger(KCfgImapSSLWrapper, intTmp ) == KErrNone) |
|
295 { |
|
296 aImapSet.SetSSLWrapper( (TBool) intTmp ); |
|
297 } |
|
298 |
|
299 |
|
300 // Note CImImap4Settings::SetVersion() although in the documentation does not actually exist. |
|
301 |
|
302 |
|
303 if(scriptFileParser->GetFieldAsString8(KCfgImapFolderPath, string8Ptr) == KErrNone) |
|
304 { |
|
305 aImapSet.SetFolderPathL(string8Ptr); |
|
306 } |
|
307 |
|
308 |
|
309 if(scriptFileParser->GetFieldAsString8(KCfgImapPathSeperator, string8Ptr) == KErrNone) |
|
310 { |
|
311 if ( string8Ptr.Length() == 1 ) |
|
312 { |
|
313 aImapSet.SetPathSeparator( string8Ptr[0] ); |
|
314 } |
|
315 else |
|
316 { // Path seperator must be a single char. |
|
317 aTestCase.ERR_PRINTF1(_L("Path seperator must be a single char")); |
|
318 aTestCase.SetTestStepResult(EFail); |
|
319 } |
|
320 } |
|
321 |
|
322 |
|
323 if(scriptFileParser->GetFieldAsInteger(KCfgImapMaxEmailSize, intTmp) == KErrNone) |
|
324 { |
|
325 aImapSet.SetMaxEmailSize(intTmp); |
|
326 } |
|
327 |
|
328 |
|
329 //???? Check input of constants works. |
|
330 if(scriptFileParser->GetFieldAsString(KCfgImapGetMailOptions, stringPtr) == KErrNone) |
|
331 { |
|
332 TImap4GetMailOptions setGetMailOptions = ObtainValueParameterL<TImap4GetMailOptions>(aTestCase, stringPtr); |
|
333 aImapSet.SetGetMailOptions(setGetMailOptions); |
|
334 } |
|
335 |
|
336 |
|
337 |
|
338 if(scriptFileParser->GetFieldAsInteger(KCfgImapInboxSynchronisationLimit, intTmp) == KErrNone) |
|
339 { |
|
340 aImapSet.SetInboxSynchronisationLimit(intTmp); |
|
341 } |
|
342 |
|
343 if(scriptFileParser->GetFieldAsInteger(KCfgImapMailboxSynchronisationLimit, intTmp) == KErrNone) |
|
344 { |
|
345 aImapSet.SetMailboxSynchronisationLimit(intTmp); |
|
346 } |
|
347 |
|
348 if(scriptFileParser->GetFieldAsInteger(KCfgImapAutoSendOnConnect, intTmp) == KErrNone) |
|
349 { |
|
350 aImapSet.SetAutoSendOnConnect( (TBool) intTmp ); |
|
351 } |
|
352 |
|
353 if(scriptFileParser->GetFieldAsInteger(KCfgImapDeleteEmailsWhenDisconnecting, intTmp) == KErrNone) |
|
354 { |
|
355 aImapSet.SetDeleteEmailsWhenDisconnecting( (TBool) intTmp ); |
|
356 } |
|
357 |
|
358 if(scriptFileParser->GetFieldAsInteger(KCfgImapAcknowledgeReceipts, intTmp) == KErrNone) |
|
359 { |
|
360 aImapSet.SetAcknowledgeReceipts( (TBool) intTmp ); |
|
361 } |
|
362 |
|
363 |
|
364 |
|
365 if(scriptFileParser->GetFieldAsInteger(KCfgImapDisconnectedUserMode, intTmp) == KErrNone) |
|
366 { |
|
367 aImapSet.SetDisconnectedUserMode( (TBool) intTmp ); |
|
368 } |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 if(scriptFileParser->GetFieldAsString(KCfgImapSynchronise, stringPtr) == KErrNone) |
|
374 { |
|
375 TFolderSyncType setFolderSyncType = ObtainValueParameterL<TFolderSyncType>(aTestCase, stringPtr); |
|
376 aImapSet.SetSynchronise(setFolderSyncType); |
|
377 } |
|
378 |
|
379 |
|
380 if(scriptFileParser->GetFieldAsString(KCfgImapSubscribe, stringPtr) == KErrNone) |
|
381 { |
|
382 TFolderSubscribeType setFolderSubscribeType = ObtainValueParameterL<TFolderSubscribeType>(aTestCase, stringPtr); |
|
383 aImapSet.SetSubscribe(setFolderSubscribeType); |
|
384 } |
|
385 |
|
386 |
|
387 if(scriptFileParser->GetFieldAsInteger(KCfgImapUpdatingSeenFlags, intTmp) == KErrNone) |
|
388 { |
|
389 aImapSet.SetUpdatingSeenFlags( (TBool) intTmp ); |
|
390 } |
|
391 |
|
392 |
|
393 if(scriptFileParser->GetFieldAsInteger(KCfgImapSyncRate, intTmp) == KErrNone) |
|
394 { |
|
395 aImapSet.SetSyncRateL(intTmp); |
|
396 } |
|
397 |
|
398 |
|
399 if(scriptFileParser->GetFieldAsInteger(KCfgImapFetchSize, intTmp) == KErrNone) |
|
400 { |
|
401 aImapSet.SetFetchSizeL(intTmp); |
|
402 } |
|
403 |
|
404 |
|
405 if(scriptFileParser->GetFieldAsInteger(KCfgImapIdle, intTmp) == KErrNone) |
|
406 { |
|
407 aImapSet.SetImapIdle( (TBool) intTmp ); |
|
408 } |
|
409 |
|
410 |
|
411 if(scriptFileParser->GetFieldAsInteger(KCfgImapIdleTimeout, intTmp) == KErrNone) |
|
412 { |
|
413 aImapSet.SetImapIdleTimeoutL(intTmp); |
|
414 } |
|
415 |
|
416 if(scriptFileParser->GetFieldAsString(KCfgImapPartialMailOptions, stringPtr) == KErrNone) |
|
417 { |
|
418 TImImap4PartialMailOptions setImap4PartialMailOptions = ObtainValueParameterL<TImImap4PartialMailOptions>(aTestCase, stringPtr); |
|
419 aImapSet.SetPartialMailOptionsL(setImap4PartialMailOptions); |
|
420 } |
|
421 |
|
422 if(scriptFileParser->GetFieldAsInteger(KCfgImapBodyTextSizeLimit, intTmp) == KErrNone) |
|
423 { |
|
424 aImapSet.SetBodyTextSizeLimitL(intTmp); |
|
425 } |
|
426 |
|
427 |
|
428 if(scriptFileParser->GetFieldAsInteger(KCfgImapAttachmentSizeLimit, intTmp) == KErrNone) |
|
429 { |
|
430 aImapSet.SetAttachmentSizeLimitL(intTmp); |
|
431 } |
|
432 |
|
433 |
|
434 scriptFileParser->GetFieldAsString(KCfgImapIapList, stringPtr); |
|
435 |
|
436 ReadIAPAndAddL( aTestCase, scriptFileParser, KCfgImapIapList, aImapIapPref ); |
|
437 |
|
438 // Read in CImSmtpSettings. |
|
439 |
|
440 if(scriptFileParser->GetFieldAsString(KCfgSmtpServerAddress, stringPtr) == KErrNone) |
|
441 { |
|
442 aSmtpSet.SetServerAddressL(stringPtr); |
|
443 } |
|
444 |
|
445 TPtrC emailAddr(machineNameFile->MachineNameEmail()); |
|
446 if(scriptFileParser->GetFieldAsString(KCfgSmtpEmailAddress, stringPtr) == KErrNone) |
|
447 { |
|
448 aSmtpSet.SetEmailAddressL(stringPtr); |
|
449 } |
|
450 else |
|
451 { |
|
452 aSmtpSet.SetEmailAddressL(emailAddr); |
|
453 } |
|
454 |
|
455 if(scriptFileParser->GetFieldAsString(KCfgSmtpBodyEncoding, stringPtr) == KErrNone) |
|
456 { |
|
457 TMsgOutboxBodyEncoding setGetMailOptions = ObtainValueParameterL<TMsgOutboxBodyEncoding>(aTestCase, stringPtr); |
|
458 aSmtpSet.SetBodyEncoding(setGetMailOptions); |
|
459 } |
|
460 |
|
461 if(scriptFileParser->GetFieldAsString(KCfgSmtpReceiptAddress, stringPtr) == KErrNone) |
|
462 { |
|
463 aSmtpSet.SetReceiptAddressL(stringPtr); |
|
464 } |
|
465 else |
|
466 { |
|
467 aSmtpSet.SetReceiptAddressL(emailAddr); |
|
468 } |
|
469 |
|
470 if(scriptFileParser->GetFieldAsInteger(KCfgSmtpRequestReceipts, intTmp) == KErrNone) |
|
471 { |
|
472 aSmtpSet.SetRequestReceipts( (TBool) intTmp ); |
|
473 } |
|
474 |
|
475 |
|
476 if(scriptFileParser->GetFieldAsString(KCfgSmtpSendMessageOption, stringPtr) == KErrNone) |
|
477 { |
|
478 TImSMTPSendMessageOption setSendMessageOption = ObtainValueParameterL<TImSMTPSendMessageOption>(aTestCase, stringPtr); |
|
479 aSmtpSet.SetSendMessageOption(setSendMessageOption); |
|
480 } |
|
481 |
|
482 if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetPort, intTmp) == KErrNone) |
|
483 { |
|
484 aSmtpSet.SetPort(intTmp); |
|
485 } |
|
486 |
|
487 |
|
488 if(scriptFileParser->GetFieldAsString(KCfgSmtpEmailAlias, stringPtr) == KErrNone) |
|
489 { |
|
490 aSmtpSet.SetEmailAliasL(stringPtr); |
|
491 } |
|
492 |
|
493 |
|
494 if(scriptFileParser->GetFieldAsInteger(KCfgSmtpDefaultMsgCharSet, intTmp) == KErrNone) |
|
495 { |
|
496 TUid tmp = { intTmp }; |
|
497 aSmtpSet.SetDefaultMsgCharSet( tmp ); |
|
498 } |
|
499 |
|
500 // CImSmtpSettings::SetVersion() does not exist. |
|
501 |
|
502 |
|
503 if(scriptFileParser->GetFieldAsString(KCfgSmtpSetReplyToAddress, stringPtr) == KErrNone) |
|
504 { |
|
505 aSmtpSet.SetReplyToAddressL(stringPtr); |
|
506 } |
|
507 else |
|
508 { |
|
509 aSmtpSet.SetReplyToAddressL(emailAddr); |
|
510 } |
|
511 |
|
512 if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetAddVCardToEmail, intTmp) == KErrNone) |
|
513 { |
|
514 aSmtpSet.SetAddVCardToEmail( (TBool) intTmp ); |
|
515 } |
|
516 |
|
517 if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetAddSignatureToEmail, intTmp) == KErrNone) |
|
518 { |
|
519 aSmtpSet.SetAddSignatureToEmail( (TBool) intTmp ); |
|
520 } |
|
521 |
|
522 |
|
523 if(scriptFileParser->GetFieldAsString(KCfgSmtpSetSendCopyToSelf, stringPtr) == KErrNone) |
|
524 { |
|
525 TImSMTPSendCopyToSelf setSMTPSendCopyToSelf = ObtainValueParameterL<TImSMTPSendCopyToSelf>(aTestCase, stringPtr); |
|
526 aSmtpSet.SetSendCopyToSelf(setSMTPSendCopyToSelf); |
|
527 } |
|
528 |
|
529 if(scriptFileParser->GetFieldAsString8(KCfgSmtpSetLoginName, string8Ptr) == KErrNone) |
|
530 { |
|
531 aSmtpSet.SetLoginNameL(string8Ptr); |
|
532 } |
|
533 else |
|
534 { |
|
535 aSmtpSet.SetLoginNameL(machineName); |
|
536 } |
|
537 |
|
538 if(scriptFileParser->GetFieldAsString8(KCfgSmtpSetPassword, string8Ptr) == KErrNone) |
|
539 { |
|
540 aSmtpSet.SetPasswordL(string8Ptr); |
|
541 } |
|
542 else |
|
543 { |
|
544 aSmtpSet.SetPasswordL(machineName); |
|
545 } |
|
546 |
|
547 if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetSMTPAuth, intTmp) == KErrNone) |
|
548 { |
|
549 aSmtpSet.SetSMTPAuth( (TBool) intTmp ); |
|
550 } |
|
551 |
|
552 |
|
553 if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSetInboxLoginDetails, intTmp) == KErrNone) |
|
554 { |
|
555 aSmtpSet.SetInboxLoginDetails( (TBool) intTmp ); |
|
556 } |
|
557 |
|
558 if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSecureSockets, intTmp) == KErrNone) |
|
559 { |
|
560 aSmtpSet.SetSecureSockets( (TBool) intTmp ); |
|
561 } |
|
562 |
|
563 |
|
564 if(scriptFileParser->GetFieldAsInteger(KCfgSmtpSSLWrapper, intTmp) == KErrNone) |
|
565 { |
|
566 aSmtpSet.SetSSLWrapper( (TBool) intTmp ); |
|
567 } |
|
568 |
|
569 ReadIAPAndAddL( aTestCase, scriptFileParser, KCfgSmtpIapList, aSmtpIapPref ); |
|
570 |
|
571 //Pop and destroy scriptfileParser and machineNameFile |
|
572 CleanupStack::PopAndDestroy(2,scriptFileParser); |
|
573 } |
|
574 |
|
575 |
|
576 |
|
577 TBool CMtfTestActionUtilsImapScripts::CompareIapPrefs(CImIAPPreferences& prefs1, CImIAPPreferences& prefs2) |
|
578 { |
|
579 // Compare version |
|
580 if (prefs1.Version() != prefs2.Version()) |
|
581 { |
|
582 return EFalse; |
|
583 } |
|
584 |
|
585 // Compare number of IAPs stored |
|
586 TInt numIAPs1 = prefs1.NumberOfIAPs(); |
|
587 |
|
588 if (numIAPs1 != prefs2.NumberOfIAPs()) |
|
589 { |
|
590 return EFalse; |
|
591 } |
|
592 |
|
593 // Compare individual IAPs |
|
594 for (TInt i = 0; i < numIAPs1; i++) |
|
595 { |
|
596 if (prefs1.IAPPreference(i).iIAP != prefs2.IAPPreference(i).iIAP || |
|
597 prefs1.IAPPreference(i).iDialogPref != prefs2.IAPPreference(i).iDialogPref) |
|
598 { |
|
599 return EFalse; |
|
600 } |
|
601 } |
|
602 |
|
603 return ETrue; |
|
604 |
|
605 } |
|
606 |