|
1 // Copyright (c) 1998-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 // |
|
15 |
|
16 #include "IMAPSET.H" |
|
17 #include <nifvar.h> // For KLinkLayerOpen |
|
18 |
|
19 |
|
20 GLREF_C TPtrC8 LimitStringSize(const TPtrC8& aString, TInt aMaxSize); |
|
21 |
|
22 |
|
23 EXPORT_C CImImap4Settings::CImImap4Settings() |
|
24 /** |
|
25 Allocates and creates a new CImImap4Settings object initialised to |
|
26 default values. |
|
27 */ |
|
28 { |
|
29 Reset(); |
|
30 } |
|
31 |
|
32 |
|
33 EXPORT_C CImImap4Settings::~CImImap4Settings() |
|
34 /** |
|
35 Destructor. |
|
36 */ |
|
37 { |
|
38 Reset(); |
|
39 |
|
40 delete iExtension; |
|
41 iExtension = NULL; |
|
42 } |
|
43 |
|
44 |
|
45 EXPORT_C void CImImap4Settings::Reset() |
|
46 /** |
|
47 Resets the settings to their default values. |
|
48 */ |
|
49 { |
|
50 CImBaseEmailSettings::Reset(); |
|
51 |
|
52 SetPort(KIMAPDefaultPortNumber); |
|
53 SetImapIdle(ETrue); |
|
54 |
|
55 iInboxSyncLimit=KImImapSynchroniseAll; |
|
56 iMailboxSyncLimit=KImImapSynchroniseAll; |
|
57 iMaxEmailSize = KMaxTInt; |
|
58 |
|
59 iPathSeparator='\0'; |
|
60 |
|
61 iSynchroniseStrategy=EUseRemote; |
|
62 iSubscriptionStrategy=EUpdateNeither; |
|
63 |
|
64 if (Extension()) |
|
65 { |
|
66 delete Extension()->iLoginName; |
|
67 Extension()->iLoginName=NULL; |
|
68 |
|
69 delete Extension()->iPassword; |
|
70 Extension()->iPassword = NULL; |
|
71 |
|
72 delete Extension()->iFolderPath; |
|
73 Extension()->iFolderPath = NULL; |
|
74 |
|
75 delete Extension()->iTlsSslDomain; |
|
76 Extension()->iTlsSslDomain = NULL; |
|
77 |
|
78 delete Extension()->iSearchString; |
|
79 Extension()->iSearchString = NULL; |
|
80 Extension()->iSyncRate = KImapDefaultInboxSyncRate; |
|
81 Extension()->iImapIdleTimeout = KImapDefaultIdleTimeout; |
|
82 Extension()->iFetchSizeBytes = KImapDefaultFetchSizeBytes; |
|
83 Extension()->iPartialMailOptions = ENoSizeLimits; |
|
84 Extension()->iBodyTextSizeLimit = KMaxTInt; |
|
85 Extension()->iAttachmentSizeLimit = KMaxTInt; |
|
86 } |
|
87 } |
|
88 |
|
89 |
|
90 EXPORT_C const TPtrC8 CImImap4Settings::LoginName() const |
|
91 /** |
|
92 Retrieves the configured login user name (mailbox) of the IMAP4 service. |
|
93 |
|
94 @see |
|
95 SetLoginNameL() |
|
96 |
|
97 @return |
|
98 The user name. |
|
99 */ |
|
100 { |
|
101 if (Extension() && Extension()->iLoginName) |
|
102 return TPtrC8(*(Extension()->iLoginName)); |
|
103 return TPtrC8(); |
|
104 } |
|
105 |
|
106 |
|
107 EXPORT_C const TPtrC8 CImImap4Settings::Password() const |
|
108 /** |
|
109 Retrieves the configured login password that will be sent during |
|
110 authentication with the IMAP4 server. |
|
111 |
|
112 @see |
|
113 SetPasswordL() |
|
114 |
|
115 @return |
|
116 The password. |
|
117 */ |
|
118 { |
|
119 if (Extension() && Extension()->iPassword) |
|
120 return TPtrC8(*(Extension()->iPassword)); |
|
121 return TPtrC8(); |
|
122 } |
|
123 |
|
124 |
|
125 EXPORT_C const TPtrC8 CImImap4Settings::FolderPath() const |
|
126 /** |
|
127 Retrieves the configured path of the IMAP4 mailbox on the server if the user's |
|
128 primary mailbox is not in the Inbox folder. |
|
129 |
|
130 Most of the time this setting will not have to be configured, however this may need |
|
131 to be altered by the user for use with some IMAP4 servers. Refer to RFC 3501 |
|
132 Section 5.1 Mailbox Naming for more information. |
|
133 |
|
134 The default setting is empty. |
|
135 |
|
136 @return |
|
137 The folder path. |
|
138 */ |
|
139 { |
|
140 if (Extension() && Extension()->iFolderPath) |
|
141 return TPtrC8(*(Extension()->iFolderPath)); |
|
142 return TPtrC8(); |
|
143 } |
|
144 |
|
145 /** |
|
146 Gets the search string used to filter which messages are synchronised. |
|
147 |
|
148 For details, see SetSearchStringL(). |
|
149 |
|
150 @return Synchronisation filter string |
|
151 */ |
|
152 EXPORT_C const TPtrC8 CImImap4Settings::SearchString() const |
|
153 { |
|
154 if (Extension() && Extension()->iSearchString) |
|
155 return TPtrC8(*(Extension()->iSearchString)); |
|
156 return TPtrC8(); |
|
157 } |
|
158 |
|
159 /** |
|
160 Sets a search string for the service. |
|
161 |
|
162 This setting allows a filter to be specified that prevents certain e-mail |
|
163 messages from being synchronised onto the device when a client requests a |
|
164 synchronisation. An IMAP Search command is issued to the server to provide a |
|
165 list of messages to be synchronised. |
|
166 |
|
167 Note that when a synchronisation command is given with a search string set: |
|
168 |
|
169 - Mailbox synchronisation limits are ignored. |
|
170 - Existing messages that do not match the search criteria, and that have not had their body fetched, |
|
171 are deleted locally. |
|
172 - If the remote server does not support the filter, or the filter is malformed, |
|
173 the synchronisation command will return an error. |
|
174 |
|
175 To remove a filter, set the search string to KNullDesC. |
|
176 |
|
177 A complete overview of the syntax of search strings is given in section 6.4.4 |
|
178 (SEARCH Command) of RFC 3501. Some valid example search strings are: |
|
179 @code |
|
180 FLAGGED SINCE 1-Feb-1994 NOT FROM "Smith" |
|
181 |
|
182 BODY "some text in the body" |
|
183 @endcode |
|
184 |
|
185 @param aSearchString Synchronisation filter string |
|
186 */ |
|
187 EXPORT_C void CImImap4Settings::SetSearchStringL(const TDesC8& aSearchString) |
|
188 { |
|
189 CheckExtensionExistsL(); |
|
190 HBufC8* newSearchString = aSearchString.AllocL(); |
|
191 delete Extension()->iSearchString; |
|
192 Extension()->iSearchString = newSearchString; |
|
193 } |
|
194 |
|
195 EXPORT_C TText8 CImImap4Settings::PathSeparator() const |
|
196 /** |
|
197 Retrieves the character configured to separate hierarchical mailbox names on |
|
198 the IMAP4 server. Refer to RFC 3501 section 5.1.1 for more information. |
|
199 |
|
200 The default setting an empty null-terminated string. |
|
201 |
|
202 @return |
|
203 The path separator character. |
|
204 */ |
|
205 { |
|
206 return iPathSeparator; |
|
207 } |
|
208 |
|
209 |
|
210 EXPORT_C TFolderSyncType CImImap4Settings::Synchronise() const |
|
211 /** |
|
212 Retrieves the method for synchronising folder information with the server. |
|
213 |
|
214 The default setting is EUseRemote. |
|
215 |
|
216 @see |
|
217 TFolderSyncType |
|
218 |
|
219 @return |
|
220 The folder synchronisation method. |
|
221 */ |
|
222 { |
|
223 return iSynchroniseStrategy; |
|
224 } |
|
225 |
|
226 |
|
227 EXPORT_C TFolderSubscribeType CImImap4Settings::Subscribe() const |
|
228 /** |
|
229 Retrieves the configured method for synchronising IMAP4 subscription information |
|
230 with a server. |
|
231 |
|
232 The default setting is EUpdateNeither. |
|
233 |
|
234 @see |
|
235 TFolderSubscribeType |
|
236 |
|
237 @return |
|
238 The subscription method. |
|
239 */ |
|
240 { |
|
241 return iSubscriptionStrategy; |
|
242 } |
|
243 |
|
244 |
|
245 EXPORT_C void CImImap4Settings::SetLoginNameL(const TDesC8& aLoginName) |
|
246 /** |
|
247 Configures the login user name (mailbox) for the IMAP4 service. |
|
248 |
|
249 @param aLoginName |
|
250 The login user name. A copy of aLoginName is made so if you |
|
251 want to change the user name you must call this method again for the |
|
252 changes to take effect. |
|
253 */ { |
|
254 CheckExtensionExistsL(); |
|
255 HBufC8* newLoginName = aLoginName.AllocL(); |
|
256 delete Extension()->iLoginName; |
|
257 Extension()->iLoginName = newLoginName; |
|
258 } |
|
259 |
|
260 |
|
261 EXPORT_C void CImImap4Settings::SetPasswordL(const TDesC8& aPassword) |
|
262 /** |
|
263 Configures the login password for the IMAP4 service. |
|
264 |
|
265 @param aPassword |
|
266 The login password. A copy of aPassword is made so if you |
|
267 want to change the user name you must call this method again for the |
|
268 changes to take effect. |
|
269 */ |
|
270 { |
|
271 CheckExtensionExistsL(); |
|
272 HBufC8* newPassword = aPassword.AllocL(); |
|
273 delete Extension()->iPassword; |
|
274 Extension()->iPassword = newPassword; |
|
275 } |
|
276 |
|
277 |
|
278 EXPORT_C void CImImap4Settings::SetFolderPathL(const TDesC8& aFolderPath) |
|
279 /** |
|
280 Specifies the path to the IMAP4 mailbox on the server if the user's primary |
|
281 mailbox is not in the Inbox folder. |
|
282 |
|
283 Most of the time this setting will not have to be configured, however this may need |
|
284 to be altered by the user for use with some IMAP4 servers. Refer to RFC 3501 |
|
285 Section 5.1 Mailbox Naming for more information. |
|
286 |
|
287 The default setting is empty. |
|
288 |
|
289 @param aFolderPath |
|
290 The folder path. |
|
291 */ |
|
292 { |
|
293 CheckExtensionExistsL(); |
|
294 HBufC8* newFolderPath = aFolderPath.AllocL(); |
|
295 delete Extension()->iFolderPath; |
|
296 Extension()->iFolderPath = newFolderPath; |
|
297 } |
|
298 |
|
299 |
|
300 EXPORT_C void CImImap4Settings::SetPathSeparator(const TText8 aPathSeparator) |
|
301 /** |
|
302 Specifies the character used to separate hierarchical mailbox names on |
|
303 the IMAP4 server. Refer to RFC 3501 section 5.1.1 for more information. |
|
304 |
|
305 The default setting an empty null-terminated string. |
|
306 |
|
307 @param aPathSeparator |
|
308 The path separator character. |
|
309 */ |
|
310 { |
|
311 iPathSeparator = aPathSeparator; |
|
312 } |
|
313 |
|
314 |
|
315 EXPORT_C void CImImap4Settings::SetSynchronise(const TFolderSyncType aType) |
|
316 /** |
|
317 Sets the method for synchronising folder information with the server. |
|
318 |
|
319 The default setting is EUseRemote. |
|
320 |
|
321 @see |
|
322 TFolderSyncType |
|
323 |
|
324 @param aType |
|
325 The folder synchronisation method. |
|
326 */ |
|
327 { |
|
328 iSynchroniseStrategy = aType; |
|
329 } |
|
330 |
|
331 |
|
332 EXPORT_C void CImImap4Settings::SetSubscribe(const TFolderSubscribeType aType) |
|
333 /** |
|
334 Sets the method for synchronising IMAP4 subscription information with a server. |
|
335 |
|
336 The default setting is EUpdateNeither. |
|
337 |
|
338 @see |
|
339 TFolderSubscribeType |
|
340 |
|
341 @param aType |
|
342 The subscription method. |
|
343 */ |
|
344 { |
|
345 iSubscriptionStrategy = aType; |
|
346 } |
|
347 |
|
348 |
|
349 EXPORT_C TBool CImImap4Settings::DisconnectedUserMode() const |
|
350 /** |
|
351 Checks if disconnected user mode is configured. |
|
352 |
|
353 If disconnected user mode is enabled by calling SetDisconnectedUserMode(), |
|
354 then the IMAP4 client MTM (CImap4ClientMtm) will accept message operations, |
|
355 such as deleting messages from a server, while the user is offline. |
|
356 The operations are stored and executed when the user connects again. |
|
357 |
|
358 @see |
|
359 CImap4ClientMtm |
|
360 |
|
361 @return |
|
362 ETrue if disconnected user mode is enabled. |
|
363 */ |
|
364 { |
|
365 return iFlags & KImap4EmailDisconnectedModeFlag; |
|
366 } |
|
367 |
|
368 |
|
369 EXPORT_C void CImImap4Settings::SetDisconnectedUserMode(TBool aFlag) |
|
370 /** |
|
371 Enables the IMAP4 client MTM (CImap4ClientMtm) to accept message operations |
|
372 while disconnected. |
|
373 |
|
374 If disconnected user mode is enabled the IMAP4 client MTM will accept message |
|
375 operations such as deleting messages from a server, while the user is offline. |
|
376 The operations are stored and executed when the user connects again. |
|
377 |
|
378 @see |
|
379 CImap4ClientMtm |
|
380 |
|
381 @param aFlag |
|
382 Specify ETrue to enable disconnected user mode. |
|
383 Specify EFalse to disable disconnected user mode. |
|
384 */ |
|
385 { |
|
386 iFlags = (iFlags & ~KImap4EmailDisconnectedModeFlag) | (aFlag ? KImap4EmailDisconnectedModeFlag : KImap4EmailSettingsClearFlag); |
|
387 } |
|
388 |
|
389 |
|
390 EXPORT_C TBool CImImap4Settings::AutoSendOnConnect() const |
|
391 /** |
|
392 |
|
393 |
|
394 @return |
|
395 ETrue if configured to send emails after the connection is established, but before |
|
396 authentication with the IMAP4 server. |
|
397 */ |
|
398 { |
|
399 return iFlags & KImap4EmailAutoSendFlag; |
|
400 } |
|
401 |
|
402 |
|
403 EXPORT_C void CImImap4Settings::SetAutoSendOnConnect(TBool aFlag) |
|
404 /** |
|
405 Configures the IMAP4 service to send queued emails associated with the same internet |
|
406 access point to be sent first before logging onto the IMAP4 server. |
|
407 |
|
408 The internet access point for each email service (POP3, IMAP4, SMTP) is configured |
|
409 using CImIAPPreferences. |
|
410 |
|
411 @see |
|
412 CImIAPPreferences |
|
413 |
|
414 @param aFlag |
|
415 Specify ETrue to send emails after the connection is established, but before |
|
416 authentication with the IMAP4 service. |
|
417 Specify EFalse to disable this functionality. |
|
418 */ |
|
419 { |
|
420 iFlags = (iFlags & ~KImap4EmailAutoSendFlag) | (aFlag ? KImap4EmailAutoSendFlag : KImap4EmailSettingsClearFlag); |
|
421 } |
|
422 |
|
423 |
|
424 EXPORT_C TUint CImImap4Settings::MaxEmailSize() const |
|
425 /** |
|
426 Returns the maximum message size in bytes to be downloaded. |
|
427 |
|
428 This value is set by a calling SetMaxEmailSize(). The default setting is |
|
429 KMaxInt. |
|
430 |
|
431 Note that the value of this setting is not used by the IMAP MTM. It can be used |
|
432 by client applications to store a user preference, and used when issuing get |
|
433 commands with CImap4ClientMtm::InvokeAsyncFunctionL(). Such commands take a |
|
434 TImImap4GetMailInfo parameter, which has a iMaxEmailSize setting. |
|
435 |
|
436 @see TImImap4GetMailInfo |
|
437 @see CImImap4GetMail |
|
438 @see CImap4ClientMtm |
|
439 |
|
440 @return The maximum message size in bytes. |
|
441 */ |
|
442 { |
|
443 return iMaxEmailSize; |
|
444 } |
|
445 |
|
446 |
|
447 EXPORT_C void CImImap4Settings::SetMaxEmailSize(const TUint aMaxEmailSize) |
|
448 /** |
|
449 Sets the maximum message size in bytes to be downloaded. |
|
450 |
|
451 The default setting is KMaxInt. |
|
452 |
|
453 Note that the value of this setting is not used by the IMAP MTM. It can be used |
|
454 by client applications to store a user preference, and used when issuing get |
|
455 commands with CImap4ClientMtm::InvokeAsyncFunctionL(). Such commands take a |
|
456 TImImap4GetMailInfo parameter, which has a iMaxEmailSize setting. |
|
457 |
|
458 @see TImImap4GetMailInfo |
|
459 @see CImImap4GetMail |
|
460 @see CImap4ClientMtm |
|
461 |
|
462 @return |
|
463 The maximum message size in bytes. |
|
464 */ |
|
465 { |
|
466 iMaxEmailSize = aMaxEmailSize; |
|
467 } |
|
468 |
|
469 |
|
470 EXPORT_C TBool CImImap4Settings::DeleteEmailsWhenDisconnecting() const |
|
471 /** |
|
472 Checks whether the caller has enabled messages marked to be deleted while offline |
|
473 to be expunged from the server when disconnecting from the next online session. |
|
474 |
|
475 Otherwise they are marked for delete and expunged during the initial |
|
476 synchronisation. |
|
477 |
|
478 To enable this functionality, call SetDeleteEmailsWhenDisconnecting(). |
|
479 |
|
480 @see |
|
481 CImap4ClientMtm |
|
482 |
|
483 @return |
|
484 ETrue if emails are to be deleted during the disconnection phase. |
|
485 */ |
|
486 { |
|
487 return iFlags & KImap4EmailDeleteEmailsWhenDisconnecting; |
|
488 } |
|
489 |
|
490 |
|
491 EXPORT_C void CImImap4Settings::SetDeleteEmailsWhenDisconnecting(TBool aFlag) |
|
492 /** |
|
493 If enabled, messages marked as deleted while offline will be deleted when |
|
494 logging off from the next IMAP4 session. If disabled, messages are deleted |
|
495 when the client synchronises with the server after a connection. |
|
496 |
|
497 Enabling this functionality has the advantage of speeding up synchronisation |
|
498 at the expense of disconnection speed. |
|
499 |
|
500 @see |
|
501 CImap4ClientMtm |
|
502 |
|
503 @param aFlag |
|
504 Specify ETrue to enable. |
|
505 */ |
|
506 { |
|
507 iFlags = (iFlags & ~KImap4EmailDeleteEmailsWhenDisconnecting) | (aFlag ? KImap4EmailDeleteEmailsWhenDisconnecting : KImap4EmailSettingsClearFlag); |
|
508 } |
|
509 |
|
510 |
|
511 EXPORT_C TBool CImImap4Settings::AcknowledgeReceipts() const |
|
512 /** |
|
513 Checks whether the caller has enabled this setting by calling |
|
514 SetAcknowledgeReceipts(). |
|
515 |
|
516 This flag is a convenience setting for Messaging client applications that may |
|
517 wish to store whether or not to send a receipt email message to the sender when the |
|
518 email has been received. The Messaging subsystem does not use this setting, |
|
519 and has to be explicitly commanded by the Messaging client application to |
|
520 send a receipt notification. Messaging applications can use CImHeader to check |
|
521 if a message has a return receipt address. Receipt notification messages can |
|
522 be created using CImEmailOperation, and sent using the SMTP client MTM. |
|
523 |
|
524 @see CImHeader |
|
525 @see CImEmailOperation |
|
526 @see CSmtpClientMtm |
|
527 |
|
528 @return |
|
529 ETrue if this flag is set. |
|
530 */ |
|
531 { |
|
532 return iFlags & KImap4EmailAcknowledgeReceipts; |
|
533 } |
|
534 |
|
535 |
|
536 EXPORT_C void CImImap4Settings::SetAcknowledgeReceipts(TBool aFlag) |
|
537 /** |
|
538 Sets or resets a flag. |
|
539 |
|
540 This flag is a convenience setting for Messaging client applications that may |
|
541 wish to store whether or not to send a receipt email message to the sender when the |
|
542 email has been received. The Messaging subsystem does not use this setting, |
|
543 and has to be explicitly commanded by the Messaging client application to |
|
544 send a receipt notification. Messaging applications can use CImHeader to check |
|
545 if a message has a return receipt address. Receipt notification messages can be |
|
546 created using CImEmailOperation, and sent using the SMTP client MTM. |
|
547 |
|
548 @see CImHeader |
|
549 @see CImEmailOperation |
|
550 @see CSmtpClientMtm |
|
551 |
|
552 @param aFlag |
|
553 Specify ETrue to set this flag. |
|
554 */ |
|
555 { |
|
556 iFlags = (iFlags & ~KImap4EmailAcknowledgeReceipts) | (aFlag ? KImap4EmailAcknowledgeReceipts : KImap4EmailSettingsClearFlag); |
|
557 } |
|
558 |
|
559 /** |
|
560 Sets the domain name to use during TLS/SSL certificate validation. |
|
561 |
|
562 @param aDomainName Domain name |
|
563 */ |
|
564 EXPORT_C void CImImap4Settings::SetTlsSslDomainL(const TDesC8& aDomainName) |
|
565 { |
|
566 CheckExtensionExistsL(); |
|
567 HBufC8* newTlsSslDomain = aDomainName.AllocL(); |
|
568 delete Extension()->iTlsSslDomain; |
|
569 Extension()->iTlsSslDomain = newTlsSslDomain; |
|
570 } |
|
571 |
|
572 /** |
|
573 Gets the domain name used during TLS/SSL certificate validation. |
|
574 |
|
575 @return Domain name |
|
576 */ |
|
577 EXPORT_C TPtrC8 CImImap4Settings::TlsSslDomain() const |
|
578 { |
|
579 if (Extension() && Extension()->iTlsSslDomain) |
|
580 return TPtrC8(*(Extension()->iTlsSslDomain)); |
|
581 return TPtrC8(); |
|
582 } |
|
583 |
|
584 EXPORT_C TImap4GetMailOptions CImImap4Settings::GetMailOptions() const |
|
585 /** |
|
586 Gets a preference setting for which components of a message (headers, body, |
|
587 attachments) to fetch when getting messages from a remote server. |
|
588 |
|
589 Note that the value of this setting is not used by the IMAP MTM. It can be used |
|
590 by client applications to store a user preference, and used when issuing get |
|
591 commands with CImap4ClientMtm::InvokeAsyncFunctionL(). Such commands take a |
|
592 TImImap4GetMailInfo parameter, which has a TImap4GetMailOptions setting. |
|
593 |
|
594 The setting is specified using SetGetMailOptions(). |
|
595 |
|
596 @see TImImap4GetMailInfo |
|
597 |
|
598 @return Get mail message component preferences |
|
599 */ |
|
600 { |
|
601 return iGetMailOptions; |
|
602 } |
|
603 |
|
604 |
|
605 EXPORT_C void CImImap4Settings::SetGetMailOptions(TImap4GetMailOptions aGetMailOptions) |
|
606 /** |
|
607 Sets a preference setting for which components of a message (headers, body, |
|
608 attachments) to fetch when getting messages from a remote server. |
|
609 |
|
610 Note that the value of this setting is not used by the IMAP MTM. It can be used |
|
611 by client applications to store a user preference, and used when issuing get |
|
612 commands with CImap4ClientMtm::InvokeAsyncFunctionL(). Such commands take a |
|
613 TImImap4GetMailInfo parameter, which has a TImap4GetMailOptions setting. |
|
614 |
|
615 @param aGetMailOptions Get mail message component preferences |
|
616 */ |
|
617 { |
|
618 iGetMailOptions = aGetMailOptions; |
|
619 } |
|
620 |
|
621 |
|
622 EXPORT_C TInt32 CImImap4Settings::InboxSynchronisationLimit() const |
|
623 /** |
|
624 Gets the maximum number of new messages in the Inbox that are synchronised when |
|
625 a synchronisation takes place. |
|
626 |
|
627 This setting is configured by calling SetInboxSynchronisationLimit(). To |
|
628 configure limits for other folders, call SetMailboxSynchronisationLimit(). |
|
629 |
|
630 The default setting is to synchronise all messages in the Inbox folder. |
|
631 |
|
632 @return If -1, all emails will be synchronised; if zero, no emails will |
|
633 be synchronised; if positive, the return value is the maximum number of emails |
|
634 that will be synchronised. |
|
635 */ |
|
636 { |
|
637 return iInboxSyncLimit; |
|
638 } |
|
639 |
|
640 |
|
641 EXPORT_C void CImImap4Settings::SetInboxSynchronisationLimit(const TInt32 aInboxSyncLimit) |
|
642 /** |
|
643 Sets the maximum number of new messages in the Inbox that are synchronised when |
|
644 a synchronisation takes place. |
|
645 |
|
646 The default setting is to synchronise all messages in the Inbox folder. |
|
647 |
|
648 @param aInboxSyncLimit |
|
649 @return If -1, all emails will be synchronised; if zero, no emails will |
|
650 be synchronised; if positive, the parameter specifies the maximum number of emails |
|
651 that will be synchronised. |
|
652 */ |
|
653 { |
|
654 iInboxSyncLimit = aInboxSyncLimit; |
|
655 } |
|
656 |
|
657 |
|
658 EXPORT_C TInt32 CImImap4Settings::MailboxSynchronisationLimit() const |
|
659 /** |
|
660 Gets the maximum number of new messages, for folders other than the Inbox, that |
|
661 are synchronised when a synchronisation takes place. |
|
662 |
|
663 This setting is configured by calling SetMailboxSynchronisationLimit(). To |
|
664 specify synchronisation limits for just the Inbox folder, call |
|
665 SetInboxSynchronisationLimit(). |
|
666 |
|
667 The default setting is to synchronise all messages. |
|
668 |
|
669 @return If -1, all emails will be synchronised; if zero, no emails will |
|
670 be synchronised; if positive, the return value is the maximum number of emails |
|
671 that will be synchronised. |
|
672 */ |
|
673 { |
|
674 return iMailboxSyncLimit; |
|
675 } |
|
676 |
|
677 |
|
678 EXPORT_C void CImImap4Settings::SetMailboxSynchronisationLimit(const TInt32 aMailboxSyncLimit) |
|
679 /** |
|
680 Sets the maximum number of new messages, for folders other than the Inbox, that |
|
681 are synchronised when a synchronisation takes place. |
|
682 |
|
683 The default setting is to synchronise all messages. |
|
684 |
|
685 @param aMailboxSyncLimit |
|
686 @return If -1, all emails will be synchronised; if zero, no emails will |
|
687 be synchronised; if positive, the parameter specifies the maximum number of emails |
|
688 that will be synchronised. |
|
689 */ |
|
690 { |
|
691 iMailboxSyncLimit = aMailboxSyncLimit; |
|
692 } |
|
693 |
|
694 |
|
695 EXPORT_C CImImap4Settings& CImImap4Settings::CopyL(const CImImap4Settings& aCImImap4Settings) |
|
696 /** |
|
697 Copies the configuration settings from another IMAP4 settings object into this object. |
|
698 |
|
699 @param aCImImap4Settings |
|
700 Specifies the object to copy. |
|
701 |
|
702 @return |
|
703 This object after copying. |
|
704 */ |
|
705 { |
|
706 Reset(); |
|
707 CheckExtensionExistsL(); |
|
708 CImBaseEmailSettings::CopyL(aCImImap4Settings); |
|
709 Extension()->iLoginName = aCImImap4Settings.LoginName().AllocL(); |
|
710 Extension()->iPassword = aCImImap4Settings.Password().AllocL(); |
|
711 Extension()->iFolderPath = aCImImap4Settings.FolderPath().AllocL(); |
|
712 Extension()->iTlsSslDomain = aCImImap4Settings.TlsSslDomain().AllocL(); |
|
713 Extension()->iSearchString = aCImImap4Settings.SearchString().AllocL(); |
|
714 Extension()->iSyncRate = aCImImap4Settings.SyncRate(); |
|
715 Extension()->iImapIdleTimeout = aCImImap4Settings.ImapIdleTimeout(); |
|
716 Extension()->iFetchSizeBytes = aCImImap4Settings.FetchSize(); |
|
717 Extension()->iPartialMailOptions=aCImImap4Settings.PartialMailOptions(); |
|
718 Extension()->iBodyTextSizeLimit =aCImImap4Settings.BodyTextSizeLimit(); |
|
719 Extension()->iAttachmentSizeLimit =aCImImap4Settings.AttachmentSizeLimit(); |
|
720 iPathSeparator = aCImImap4Settings.PathSeparator(); |
|
721 iSynchroniseStrategy = aCImImap4Settings.Synchronise(); |
|
722 iSubscriptionStrategy = aCImImap4Settings.Subscribe(); |
|
723 iMaxEmailSize = aCImImap4Settings.iMaxEmailSize; |
|
724 iGetMailOptions = aCImImap4Settings.iGetMailOptions; |
|
725 iInboxSyncLimit = aCImImap4Settings.InboxSynchronisationLimit(); |
|
726 iMailboxSyncLimit = aCImImap4Settings.MailboxSynchronisationLimit(); |
|
727 return (*this); |
|
728 } |
|
729 |
|
730 |
|
731 EXPORT_C TBool CImImap4Settings::operator==(const CImImap4Settings& aCImImap4Settings) const |
|
732 /** |
|
733 Equality operator. |
|
734 |
|
735 @param aCImImap4Settings |
|
736 Specifies the IMAP4 settings object to compare with. |
|
737 |
|
738 @return |
|
739 ETrue if the settings are the same. |
|
740 */ |
|
741 { |
|
742 return ((CImBaseEmailSettings::operator==(aCImImap4Settings)) && |
|
743 (MaxEmailSize() == aCImImap4Settings.iMaxEmailSize) && |
|
744 (GetMailOptions() == aCImImap4Settings.GetMailOptions()) && |
|
745 !LoginName().Compare(aCImImap4Settings.LoginName()) && |
|
746 !Password().Compare(aCImImap4Settings.Password()) && |
|
747 !FolderPath().Compare(aCImImap4Settings.FolderPath()) && |
|
748 !SearchString().Compare(aCImImap4Settings.SearchString()) && |
|
749 (PathSeparator() == aCImImap4Settings.PathSeparator()) && |
|
750 (Synchronise() == aCImImap4Settings.Synchronise()) && |
|
751 (Subscribe() == aCImImap4Settings.Subscribe()) && |
|
752 (InboxSynchronisationLimit()==aCImImap4Settings.InboxSynchronisationLimit()) && |
|
753 (MailboxSynchronisationLimit()==aCImImap4Settings.MailboxSynchronisationLimit()) && |
|
754 (SyncRate()==aCImImap4Settings.SyncRate()) && |
|
755 (ImapIdleTimeout()==aCImImap4Settings.ImapIdleTimeout()) && |
|
756 (FetchSize()==aCImImap4Settings.FetchSize()) && |
|
757 (PartialMailOptions()==aCImImap4Settings.PartialMailOptions()) && |
|
758 (BodyTextSizeLimit()==aCImImap4Settings.BodyTextSizeLimit()) && |
|
759 (AttachmentSizeLimit()==aCImImap4Settings.AttachmentSizeLimit())); |
|
760 } |
|
761 |
|
762 |
|
763 EXPORT_C TBool CImImap4Settings::UpdatingSeenFlags() const |
|
764 /** |
|
765 Retrieves whether the IMAP4 seen flag of new messages will be set on the server only |
|
766 when the message has been marked as read, or when the message has been synchronised. |
|
767 |
|
768 The default setting is EFalse which means that the seen flag will be set on the |
|
769 server when the new message has been synchronised with the client. The messaging |
|
770 application can mark the message as being read (seen) by calling TMsvEntry::SetUnread(). |
|
771 |
|
772 @see TMsvEntry |
|
773 |
|
774 @return |
|
775 Returns ETrue if the seen flag is set on the IMAP4 server only when |
|
776 the message has been marked as read. |
|
777 Returns EFalse if the seen flag is set on the IMAP4 server when the new message |
|
778 is retrieved from the server. |
|
779 */ |
|
780 { |
|
781 return iFlags & KImap4EmailUpdatingSeenFlags; |
|
782 } |
|
783 |
|
784 |
|
785 EXPORT_C void CImImap4Settings::SetUpdatingSeenFlags(TBool aFlag) |
|
786 /** |
|
787 Specifies whether the IMAP4 seen flag of messages will be set on the server only |
|
788 when the message has been marked as read, or when the message has been synchronised. |
|
789 |
|
790 The default setting is EFalse which means that the seen flag will be set on the |
|
791 server when the new message has been synchronised with the client. The messaging |
|
792 application can mark the message as being read (seen) by calling TMsvEntry::SetUnread(). |
|
793 |
|
794 @see TMsvEntry |
|
795 |
|
796 @param aFlag |
|
797 Specify ETrue if the seen flag is to be set on the IMAP4 server during synchronisation |
|
798 only when the message has been marked as read. |
|
799 Specify EFalse if the seen flag is to be set on the IMAP4 server when new messages |
|
800 are retrieved from the server. |
|
801 */ |
|
802 { |
|
803 iFlags = (iFlags & ~KImap4EmailUpdatingSeenFlags) | (aFlag ? KImap4EmailUpdatingSeenFlags : KImap4EmailSettingsClearFlag); |
|
804 } |
|
805 |
|
806 |
|
807 /** |
|
808 Retrieves whether the IMAP IDLE command should be used as defined in RFC2177. |
|
809 |
|
810 The default setting is ETrue which means that the IMAP IDLE command will be used |
|
811 if the server supports it. |
|
812 |
|
813 @return |
|
814 Returns ETrue if the IMAP IDLE command should be used provided the server supports it. |
|
815 Returns EFalse if the IMAP IDLE command should not be used. |
|
816 */ |
|
817 EXPORT_C TBool CImImap4Settings::ImapIdle() const |
|
818 { |
|
819 return iFlags & KImap4EmailIdleFlag; |
|
820 } |
|
821 |
|
822 |
|
823 /** |
|
824 Specifies whether the IMAP IDLE command should be used as defined in RFC2177. |
|
825 |
|
826 The default setting is ETrue which means that the IMAP IDLE command will be used |
|
827 if the server supports it. |
|
828 |
|
829 @param aFlag |
|
830 Specify ETrue if the IMAP IDLE command should be used provided the server supports it. |
|
831 Specify EFalse if the IMAP IDLE command should not be used. |
|
832 */ |
|
833 EXPORT_C void CImImap4Settings::SetImapIdle(TBool aFlag) |
|
834 { |
|
835 iFlags = (iFlags & ~KImap4EmailIdleFlag) | (aFlag ? KImap4EmailIdleFlag : KImap4EmailSettingsClearFlag); |
|
836 } |
|
837 |
|
838 |
|
839 EXPORT_C TInt CImImap4Settings::SyncRate() const |
|
840 /** |
|
841 Retrieves the rate in seconds at which the Inbox is refreshed, sync rate is a non negative value. |
|
842 The default setting is 300 seconds (5 minutes). |
|
843 This setting applies only when the #KIMAP4MTMConnectAndSyncCompleteAfterDisconnect |
|
844 command is used to periodically resynchronise the Inbox. |
|
845 |
|
846 @return |
|
847 The Inbox refresh rate in seconds. A value of zero indicates that the |
|
848 Inbox is not periodically refreshed (synchronised) when connected. |
|
849 */ |
|
850 { |
|
851 if( Extension() ) |
|
852 { |
|
853 return Extension()->iSyncRate; |
|
854 } |
|
855 |
|
856 // Return the default value |
|
857 return KImapDefaultInboxSyncRate; |
|
858 } |
|
859 |
|
860 |
|
861 EXPORT_C void CImImap4Settings::SetSyncRateL(TInt aSyncRate) |
|
862 /** |
|
863 Specifies the rate in seconds at which the Inbox will be refreshed when connected. |
|
864 The default setting is 300 seconds (5 minutes). |
|
865 This setting applies only when the #KIMAP4MTMConnectAndSyncCompleteAfterDisconnect |
|
866 command is used to periodically resynchronise the Inbox. |
|
867 |
|
868 @param aSyncRate The Inbox refresh rate in seconds. A value of zero specifies that |
|
869 the Inbox will not periodically refresh (synchronise) when connected |
|
870 If the value is -ve, it leaves with KErrArgument |
|
871 @leave KErrArgument Argument passed is invalid |
|
872 Other System wide error codes. |
|
873 */ |
|
874 { |
|
875 if(aSyncRate < 0) |
|
876 { |
|
877 User::Leave(KErrArgument); |
|
878 } |
|
879 CheckExtensionExistsL(); |
|
880 Extension()->iSyncRate = aSyncRate; |
|
881 } |
|
882 |
|
883 EXPORT_C TInt32 CImImap4Settings::BodyTextSizeLimit() const |
|
884 /** |
|
885 Retrieves the maximum body text size limit for the partial fetch of message body. |
|
886 If text/plain part + text/html part (alternative part) < body text size limit then |
|
887 fetch text/html part else fetch only text/plain part. |
|
888 |
|
889 The default body text size limit is KMaxTInt. |
|
890 The body text size limit is set by SetBodyTextSizeLimitL(). |
|
891 |
|
892 @return |
|
893 The body text size limit for partial fetch of a message body text. |
|
894 */ |
|
895 { |
|
896 if( Extension() ) |
|
897 { |
|
898 return Extension()->iBodyTextSizeLimit; |
|
899 } |
|
900 |
|
901 // Return the default value |
|
902 return KMaxTInt; |
|
903 } |
|
904 |
|
905 EXPORT_C void CImImap4Settings::SetBodyTextSizeLimitL(TInt32 aBodyTextSizeLimit) |
|
906 /** |
|
907 Specifies the maximum body text size limit for the partial fetch of message body. |
|
908 |
|
909 The default body text size limit is KMaxTInt. |
|
910 |
|
911 Note that the value of this setting is not used by the IMAP MTM. It can be used |
|
912 by client applications to store a user preference, and used when issuing populate |
|
913 commands with CImap4ClientMtm::InvokeAsyncFunctionL(). Such commands take a |
|
914 TImImap4GetPartialMailInfo parameter, which has a iBodyTextSizeLimit setting. |
|
915 |
|
916 @param aBodyTextSizeLimit |
|
917 The body text size limit for partial fetch of a message body text. |
|
918 */ |
|
919 { |
|
920 CheckExtensionExistsL(); |
|
921 Extension()->iBodyTextSizeLimit = aBodyTextSizeLimit; |
|
922 } |
|
923 |
|
924 EXPORT_C TInt32 CImImap4Settings::AttachmentSizeLimit() const |
|
925 /** |
|
926 Retrieves the maximum attachment size limit for the partial fetch of attachments in |
|
927 a message. |
|
928 |
|
929 The default attachment size limit is KMaxTInt. |
|
930 The attachment size limit is set by SetAttachmentSizeLimitL(). |
|
931 |
|
932 @return |
|
933 The maximum attachment size limit for the partial fetch of attachments in a message. |
|
934 */ |
|
935 { |
|
936 if( Extension() ) |
|
937 { |
|
938 return Extension()->iAttachmentSizeLimit; |
|
939 } |
|
940 |
|
941 // Return the default value |
|
942 return KMaxTInt; |
|
943 } |
|
944 |
|
945 |
|
946 EXPORT_C void CImImap4Settings::SetAttachmentSizeLimitL(TInt32 aAttachmentSizeLimit) |
|
947 /** |
|
948 Specifies the maximum attachment size limit for the partial fetch of attachments in |
|
949 a message. |
|
950 |
|
951 The default attachment size limit is KMaxTInt. |
|
952 |
|
953 Note that the value of this setting is not used by the IMAP MTM. It can be used |
|
954 by client applications to store a user preference, and used when issuing populate |
|
955 commands with CImap4ClientMtm::InvokeAsyncFunctionL(). Such commands take a |
|
956 TImImap4GetPartialMailInfo parameter, which has a iAttachmentSizeLimit setting. |
|
957 |
|
958 @param aAttachmentSizeLimit |
|
959 The maximum attachment size limit for the partial fetch of attachments in a message. |
|
960 */ |
|
961 { |
|
962 CheckExtensionExistsL(); |
|
963 Extension()->iAttachmentSizeLimit = aAttachmentSizeLimit; |
|
964 } |
|
965 |
|
966 EXPORT_C TImImap4PartialMailOptions CImImap4Settings::PartialMailOptions() const |
|
967 /** Gets the option for how |
|
968 |
|
969 The specification can be as follows: |
|
970 |
|
971 No limits on the body part, |
|
972 only body text, |
|
973 only attachments, |
|
974 the entire message (both body text and attachment) with size limits on body text and attachment |
|
975 the entire message with total size limit (ECumulative - body text + attachment \<= total size limit) |
|
976 when synchronising with the IMAP4 server. |
|
977 |
|
978 The specification for the body parts to be downloaded is set by SetPartialMailOptionsL(). |
|
979 |
|
980 @see |
|
981 TImImap4PartialMailOptions |
|
982 |
|
983 @return |
|
984 An enumeration specifying how messages will be synchronised. |
|
985 */ |
|
986 { |
|
987 if(Extension()) |
|
988 { |
|
989 return Extension()->iPartialMailOptions; |
|
990 } |
|
991 // Return the default value |
|
992 return ENoSizeLimits; |
|
993 } |
|
994 |
|
995 EXPORT_C void CImImap4Settings::SetPartialMailOptionsL(TImImap4PartialMailOptions aPartialMailOptions) |
|
996 /** |
|
997 Specifies whether no limits on the body parts, only body text, only attachments, |
|
998 the entire message (both body text and attachment) with size limits on body text |
|
999 and attachment or the entire message with total size limit |
|
1000 (ECumulative - body text + attachment \<= Total size limit) |
|
1001 will be downloaded when synchronising with the IMAP4 server. |
|
1002 |
|
1003 Note that the value of this setting is not used by the IMAP MTM. It can be used |
|
1004 by client applications to store a user preference, and used when issuing populate |
|
1005 commands with CImap4ClientMtm::InvokeAsyncFunctionL(). Such commands take a |
|
1006 TImImap4GetPartialMailInfo parameter, which has a iPartialMailOptions setting. |
|
1007 |
|
1008 @see |
|
1009 TImImap4PartialMailOptions |
|
1010 @param aPartialMailOptions |
|
1011 Specifies whether to download whole message without limits, only body text, |
|
1012 only attachments, entire message with body text limit and attachment size limit |
|
1013 or the entire message with total size limit when synchronising with the IMAP4 server. |
|
1014 */ |
|
1015 { |
|
1016 CheckExtensionExistsL(); |
|
1017 Extension()->iPartialMailOptions = aPartialMailOptions; |
|
1018 } |
|
1019 |
|
1020 |
|
1021 /** |
|
1022 Retrieves the IMAP IDLE timeout seconds. |
|
1023 |
|
1024 The default setting is 1740 seconds (29 minutes). |
|
1025 |
|
1026 @return |
|
1027 The IMAP IDLE timeout in seconds. A value of zero specifies that the |
|
1028 IDLE command will not timeout. |
|
1029 */ |
|
1030 EXPORT_C TInt CImImap4Settings::ImapIdleTimeout() const |
|
1031 { |
|
1032 if( Extension() ) |
|
1033 { |
|
1034 return Extension()->iImapIdleTimeout; |
|
1035 } |
|
1036 |
|
1037 // Return the default value |
|
1038 return KImapDefaultIdleTimeout; |
|
1039 } |
|
1040 |
|
1041 |
|
1042 /** |
|
1043 Specifies the IMAP IDLE timeout in seconds. |
|
1044 |
|
1045 The default setting is 1740 seconds (29 minutes). |
|
1046 |
|
1047 @param aIdleTimeout |
|
1048 The IMAP IDLE timeout in seconds. A value of zero specifies that the |
|
1049 IDLE command will not timeout. |
|
1050 */ |
|
1051 EXPORT_C void CImImap4Settings::SetImapIdleTimeoutL(TInt aIdleTimeout) |
|
1052 { |
|
1053 CheckExtensionExistsL(); |
|
1054 Extension()->iImapIdleTimeout = aIdleTimeout; |
|
1055 } |
|
1056 |
|
1057 |
|
1058 /** |
|
1059 Retrieves the IMAP fetch size. |
|
1060 |
|
1061 When downloading large attachments, data is requested (fetched) in increments. |
|
1062 The larger the fetch size, fewer fetch commands are sent to the IMAP4 server. |
|
1063 This speeds up the attachment download rate, but only to a limit. The limit is |
|
1064 network specific. A fetch size that is too large will degrade performance shortly |
|
1065 after downloading an attachment is cancelled, because the fetched data will still |
|
1066 be incomming on the socket after cancellation. |
|
1067 |
|
1068 The default fetch size is 20480 bytes (20 KB). The |
|
1069 default value is optimum for actual connection rates up to 2 Mbps. |
|
1070 |
|
1071 @return |
|
1072 The IMAP fetch size in bytes. |
|
1073 */ |
|
1074 EXPORT_C TUint CImImap4Settings::FetchSize() const |
|
1075 { |
|
1076 TUint fetchSizeBytes = KImapDefaultFetchSizeBytes; |
|
1077 if(Extension()) |
|
1078 fetchSizeBytes = Extension()->iFetchSizeBytes; |
|
1079 |
|
1080 return fetchSizeBytes; |
|
1081 } |
|
1082 |
|
1083 |
|
1084 /** |
|
1085 Specifies the IMAP fetch size in bytes. |
|
1086 |
|
1087 When downloading large attachments, data is requested (fetched) in increments. |
|
1088 The larger the fetch size, fewer fetch commands are sent to the IMAP4 server. |
|
1089 This speeds up the attachment download rate, but only to a limit. The limit is |
|
1090 network specific. A fetch size that is too large will degrade performance shortly |
|
1091 after downloading an attachment is cancelled, because the fetched data will still |
|
1092 be incomming on the socket after cancellation. |
|
1093 |
|
1094 The default fetch size is 20480 bytes (20 KB). The |
|
1095 default value is optimum for actual connection rates up to 2 Mbps. |
|
1096 |
|
1097 @param aFetchSizeBytes |
|
1098 The IMAP fetch size in bytes. |
|
1099 */ |
|
1100 EXPORT_C void CImImap4Settings::SetFetchSizeL(TUint aFetchSizeBytes) |
|
1101 { |
|
1102 CheckExtensionExistsL(); |
|
1103 Extension()->iFetchSizeBytes = aFetchSizeBytes; |
|
1104 } |
|
1105 |
|
1106 /** |
|
1107 Sets a flag to indicate whether to use download rules during account synchronisation. |
|
1108 |
|
1109 @param aFlag |
|
1110 @return None |
|
1111 */ |
|
1112 EXPORT_C void CImImap4Settings::SetUseSyncDownloadRules(TBool aFlag) |
|
1113 { |
|
1114 iFlags = (iFlags & ~KImap4EmailUseSyncDownloadRules) | (aFlag?KImap4EmailUseSyncDownloadRules : EBaseEmailSettingsClearFlag); |
|
1115 } |
|
1116 |
|
1117 /** |
|
1118 Indicates whether to use download rules during account synchronisation. |
|
1119 |
|
1120 @param None |
|
1121 @return Boolean |
|
1122 ETrue if download rules should be used during account synchronisation |
|
1123 */ |
|
1124 EXPORT_C TBool CImImap4Settings::UseSyncDownloadRules() |
|
1125 { |
|
1126 if(iFlags & KImap4EmailUseSyncDownloadRules) |
|
1127 { |
|
1128 return ETrue; |
|
1129 } |
|
1130 else |
|
1131 { |
|
1132 return EFalse; |
|
1133 } |
|
1134 } |
|
1135 |
|
1136 /** |
|
1137 Sets a flag to indicate whether folder tree synchronisation shall be disabled, |
|
1138 during account synchronisation operations. |
|
1139 |
|
1140 @param aFlag |
|
1141 @return None |
|
1142 */ |
|
1143 EXPORT_C void CImImap4Settings::SetFolderSyncDisabled(TBool aFlag) |
|
1144 { |
|
1145 iFlags = (iFlags & ~KImap4EmailSettingsFolderSyncDisabled) | (aFlag?KImap4EmailSettingsFolderSyncDisabled : EBaseEmailSettingsClearFlag); |
|
1146 } |
|
1147 |
|
1148 /** |
|
1149 Indicates whether Folder Synchronisation is disabled during account synchronisation |
|
1150 operations. |
|
1151 |
|
1152 @param None |
|
1153 @return Boolean |
|
1154 ETrue if folder tree synchronisation is disabled during account synchronisation. |
|
1155 */ |
|
1156 EXPORT_C TBool CImImap4Settings::FolderSyncDisabled() |
|
1157 { |
|
1158 if(iFlags & KImap4EmailSettingsFolderSyncDisabled) |
|
1159 { |
|
1160 return ETrue; |
|
1161 } |
|
1162 else |
|
1163 { |
|
1164 return EFalse; |
|
1165 } |
|
1166 } |
|
1167 |
|
1168 EXPORT_C TInt TImap4GenericProgress::ConnectionState() const |
|
1169 /** |
|
1170 Retrieves the stage of the connection process as defined in nifvar.h and csdprog.h |
|
1171 while the service is connecting to the IMAP4 server. |
|
1172 |
|
1173 @return |
|
1174 KLinkLayerOpen if the IMAP4 service has successfully connected, or |
|
1175 KErrNotFound if the IMAP4 service is disconnected, or |
|
1176 the current connection stage (declared in nifvar.h and csdprog.h) while |
|
1177 establishing a connection. |
|
1178 */ |
|
1179 { |
|
1180 |
|
1181 switch(iState) |
|
1182 { |
|
1183 case EConnecting: |
|
1184 // Return the connection state temporarily stored in iMsgsDone |
|
1185 // while connection is in progress |
|
1186 return iMsgsDone; |
|
1187 case EDisconnected: |
|
1188 // If we're definately in a disconnected state, return KErrNotFound |
|
1189 return KErrNotFound; |
|
1190 default: |
|
1191 // If we're in one of the connected states, return KLinkLayerOpen |
|
1192 return KLinkLayerOpen; |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 |
|
1197 EXPORT_C TInt TImap4GenericProgress::ConnectionIAP() const |
|
1198 /** |
|
1199 Retrieves the internet access point that is used when connecting to the |
|
1200 IMAP4 service. |
|
1201 |
|
1202 @return |
|
1203 KErrNotFound if the IMAP4 service is not connecting, otherwise the |
|
1204 internet access point number. |
|
1205 */ |
|
1206 { |
|
1207 if (iState == EConnecting) |
|
1208 { |
|
1209 // Return the connection IAP temporarily stored in iMsgsToDo |
|
1210 // while connection is in progress |
|
1211 return iMsgsToDo; |
|
1212 } |
|
1213 else |
|
1214 { |
|
1215 return KErrNotFound; |
|
1216 } |
|
1217 } |
|
1218 |
|
1219 /** |
|
1220 Check whether the KImap4EmailExpungeFlag is set in |
|
1221 CImImap4Settings |
|
1222 |
|
1223 @return |
|
1224 Returns ETrue if the KImap4EmailExpungeFlag was set in |
|
1225 CImImap4Settings::SetUseExpunge. |
|
1226 */ |
|
1227 EXPORT_C TBool CImImap4Settings::UseExpunge() const |
|
1228 { |
|
1229 return iFlags & KImap4EmailExpungeFlag; |
|
1230 } |
|
1231 |
|
1232 /** |
|
1233 Allows KImap4EmailExpungeFlag to be set. It is used by the state machine in |
|
1234 CImapCompoundCopyToLocal,CImapCompoundCopyWithinService, CImapCompoundDelete and CImapFolder. |
|
1235 The state machines use the flag to decide whether to use EXPUNGE command to perform |
|
1236 the deletion. |
|
1237 |
|
1238 The settings are written to the central repository. |
|
1239 |
|
1240 @param aFlag |
|
1241 Specify ETrue to enable EXPUNGE mode. |
|
1242 Specify EFalse to disable EXPUNGE mode. |
|
1243 */ |
|
1244 EXPORT_C void CImImap4Settings::SetUseExpunge(TBool aFlag) |
|
1245 { |
|
1246 iFlags = (iFlags & ~KImap4EmailExpungeFlag) | (aFlag ? KImap4EmailExpungeFlag : KImap4EmailSettingsClearFlag); |
|
1247 } |
|
1248 |
|
1249 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT) |
|
1250 |
|
1251 /** |
|
1252 Retrieves the value of IMAP4 authentication flag. |
|
1253 |
|
1254 @return |
|
1255 ETrue if IMAP4 authentication is enabled. |
|
1256 */ |
|
1257 EXPORT_C TBool CImImap4Settings::IMAP4Auth() const |
|
1258 { |
|
1259 return iFlags & KImap4EmailSettingsAuthenticationFlag; |
|
1260 } |
|
1261 /** |
|
1262 Enables IMAP4 authentication using CRAM-MD5 when connecting to email server. |
|
1263 Read RFC 2195 "IMAP/POP Authorize Extension for Simple Challenge/Response" for more details. |
|
1264 |
|
1265 @param aFlag |
|
1266 ETrue to enable IMAP4 authentication. |
|
1267 |
|
1268 */ |
|
1269 EXPORT_C void CImImap4Settings::SetIMAP4Auth(TBool aFlag) |
|
1270 { |
|
1271 iFlags = (iFlags & ~KImap4EmailSettingsAuthenticationFlag) | (aFlag ? KImap4EmailSettingsAuthenticationFlag : KImap4EmailSettingsClearFlag); |
|
1272 } |
|
1273 |
|
1274 /** |
|
1275 Retrieves the value of Fallback flag. |
|
1276 |
|
1277 @return |
|
1278 ETrue if Fallback flag is enabled. |
|
1279 |
|
1280 */ |
|
1281 EXPORT_C TBool CImImap4Settings::FallBack() const |
|
1282 { |
|
1283 return iFlags & KImap4EmailSettingsFallBackFlag; |
|
1284 } |
|
1285 /** |
|
1286 Enables less secure authentication mechanism (PLAIN or LOGIN), when email server doesn't support CRAM-MD5 authentication. |
|
1287 Fallback flag will be used in conjunction with Authenticate flag and will be used when Authenticate flag is enabled. |
|
1288 By default Fallback flag will be EFalse. |
|
1289 |
|
1290 @param aFlag |
|
1291 ETrue to enable Fallback option for less secure authentication. |
|
1292 |
|
1293 */ |
|
1294 EXPORT_C void CImImap4Settings::SetFallBack(TBool aFlag) |
|
1295 { |
|
1296 iFlags = (iFlags & ~KImap4EmailSettingsFallBackFlag) | (aFlag ? KImap4EmailSettingsFallBackFlag : KImap4EmailSettingsClearFlag); |
|
1297 } |
|
1298 |
|
1299 #endif |