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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined (__POP3SET_H__)
28 /** Default POP3 server port number. */
29 const TUint32 KPOP3DefaultPortNumber = 110;
32 const TInt32 KImPop3SynchroniseAll = -1;
35 const TInt32 KImPop3SynchroniseNone = 0;
38 Specifies which parts of a POP3 message to download. Used when configuring the
39 POP3 service settings.
47 enum TPop3GetMailOptions
49 /** Message headers only. */
51 /** Complete message. */
58 Progress information for a POP3 operation.
65 IMPORT_C TInt ConnectionState() const;
66 IMPORT_C TInt ConnectionIAP() const;
69 /** Defines types of POP3 operations. */
70 enum TPop3ProgressType
72 /** Refreshing view of remote mail box. */
74 /** Copying messages. */
76 /** Deleting messages. */
78 /** Connecting to remote mail box. */
80 /** Internal reorganisation. */
82 /** Connected to remote mail box and no current operations. */
84 /** Disconnecting from remote mail box. */
86 /** Disconnected from remote mail box. */
88 /** Moving messages. */
90 /** Copying new messages. */
92 /** Moving new messages. */
94 /** Copying a selection of messages. */
95 EPopCopyMailSelection,
96 /** Moving a selection of messages. */
97 EPopMoveMailSelection,
98 /** Copying all messages. */
100 /** Moving all messages. */
102 /** Populating view of remote mail box. */
104 /** Cancelling all off-line operations. */
105 EPopCancellingOfflineOps,
106 /** Populating mailbox with top command */
108 /** Defines the maximum value for this enumeration. */
109 EPopMaxProgressValue=EPopTopPopulating
112 /** Type of operation for which progress is being reported. */
113 TPop3ProgressType iPop3Progress; // holds the progress for a 'super operation'
114 /** When in the EPopConnecting state, this member holds the connection
115 stage. Otherwise it holds the total number of messages for the operation. */
117 /** Remaining number of messages to process. */
119 /** Number of bytes processed by the operation. */
121 /** When in the EPopConnecting state, this member holds the connection
122 iap value. Otherwise it holds the total number of bytes to progress for the
125 /** Operation error code. */
126 TInt iErrorCode; // client side needs to be informed of an error
127 /** Type of the sub-operation, where a nested operations is occurring. */
128 TPop3ProgressType iPop3SubStateProgress; // holds the progress for the substate of the 'super operation'
129 /** Service performing the operation. */
131 /** The total size of messages to be downloaded. */
132 TInt iTotalSize; // The total size of messages to be downloaded.
136 class TImPop3GetMailInfo
138 Use to specify the maximum message size and the destination folder ID for
139 certain POP3 operations.
149 /** Maximum message size for the operation. */
150 TInt32 iMaxEmailSize;
151 /** ID of the destination folder for the operation. */
152 TMsvId iDestinationFolder;
155 class TImPop3PopulateOptions
157 Use to specify the population limit for the POP3 top command
167 /** Version of this GetMailInfo class, breaks coding standard by putting a private member at
168 the beginning to enable unpacking code to check the version before unpacking the rest of the class */
172 IMPORT_C TImPop3PopulateOptions();
173 IMPORT_C static void UnpackL(const TDesC8& aDesc, TImPop3PopulateOptions &aUnpackTo);
175 IMPORT_C TInt MaxEmailSize();
176 IMPORT_C void SetMaxEmailSize(TInt aMaxEmailSize);
177 IMPORT_C TInt PopulationLimit();
178 IMPORT_C void SetPopulationLimit(TInt aPopulationLimit);
181 /** Maximum message size for the operation. */
182 TInt32 iMaxEmailSize;
183 /** Population limit for Populate operation, set to -1 for total populate */
184 TInt32 iPopulationLimit;
185 /** Construction utility function */
189 class CImPop3Settings : public CImBaseEmailSettings
191 Run-time configuration settings for POP3.
193 Messaging clients should use an instance of this class to specify
194 and retrieve configuration settings that are used by the POP3 service when
195 executing email operations.
197 Service settings such as the user name and password, whether to authenticate
198 using APOP or plain text, the maximum size of an email to download, and the
199 maximum number of messages to synchronise can be specified using this class.
200 Storing and restoring from the message store is also supported.
202 To use this class to change a setting:
203 1) Set the current context to the POP3 service entry using CMsvStore.
204 2) Create an instance of CImPop3Settings and put it on the cleanup stack.
205 3) Retrieve the existing settings by calling CImPop3Settings::RestoreL().
206 4) Change the inbox synchronisation limit setting by calling CImPop3Settings::SetInboxSynchronisationLimit().
207 5) Save the new settings by calling CImPop3Settings::StoreL().
208 6) Pop and destroy the CImPop3Settings instance.
216 IMPORT_C CImPop3Settings();
217 IMPORT_C virtual ~CImPop3Settings();
218 IMPORT_C void Reset();
219 IMPORT_C const TPtrC8 LoginName() const;
220 IMPORT_C void SetLoginNameL(const TDesC8&);
221 IMPORT_C const TPtrC8 Password() const;
222 IMPORT_C void SetPasswordL(const TDesC8&);
223 IMPORT_C TBool AutoSendOnConnect() const;
224 IMPORT_C void SetAutoSendOnConnect(TBool aFlag);
225 IMPORT_C TBool Apop() const;
226 IMPORT_C void SetApop(TBool aFlag);
227 IMPORT_C TBool DisconnectedUserMode() const;
228 IMPORT_C void SetDisconnectedUserMode(TBool aFlag);
229 IMPORT_C TBool DeleteEmailsWhenDisconnecting() const;
230 IMPORT_C void SetDeleteEmailsWhenDisconnecting(TBool aFlag);
231 IMPORT_C TBool AcknowledgeReceipts() const;
232 IMPORT_C void SetAcknowledgeReceipts(TBool aFlag);
233 IMPORT_C TInt MaxEmailSize() const;
234 IMPORT_C void SetMaxEmailSize(const TInt aMaxEmailSize);
235 IMPORT_C TPop3GetMailOptions GetMailOptions() const;
236 IMPORT_C void SetGetMailOptions(TPop3GetMailOptions aGetMailOptions);
237 IMPORT_C CImPop3Settings& CopyL(const CImPop3Settings& aCImPop3Settings);
238 IMPORT_C TBool operator==(const CImPop3Settings& aCImPop3Settings) const;
239 IMPORT_C TInt32 InboxSynchronisationLimit() const;
240 IMPORT_C void SetInboxSynchronisationLimit(const TInt32 aInboxSyncLimit);
241 IMPORT_C TInt32 PopulationLimit() const;
242 IMPORT_C void SetPopulationLimitL(const TInt32 aPopulationLimit);
243 IMPORT_C void SetTlsSslDomainL(const TDesC8& aDomainName);
244 IMPORT_C TPtrC8 TlsSslDomain() const;
245 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT)
246 IMPORT_C void SetPOP3Auth(TBool aFlag);
247 IMPORT_C TBool POP3Auth() const;
248 IMPORT_C void SetFallBack(TBool aFlag);
249 IMPORT_C TBool FallBack() const;
253 class TImPop3SettingsExtension
256 inline TImPop3SettingsExtension();
260 HBufC8* iTlsSslDomain;
261 TInt32 iPopulationLimit;
263 inline TImPop3SettingsExtension* Extension() const;
264 inline void CheckExtensionExistsL();
266 enum TImPop3EmailSettings
268 KPop3SettingsClearFlag = 0x00000000,
269 KPop3BaseEmailSettingsLastUsedFlag = CImBaseEmailSettings::EBaseEmailSettingsLastUsedFlag, //0x00000002
270 KPop3ApopFlag = KPop3BaseEmailSettingsLastUsedFlag << 1, //0x00000004
271 KPop3AutoSendFlag = KPop3ApopFlag << 1, //0x00000008
272 KPop3DisconnectedModeFlag = KPop3AutoSendFlag << 1, //0x00000010
273 KPop3DeleteEmailsWhenDisconnectingFlag = KPop3DisconnectedModeFlag << 1, //0x00000020
274 KPop3AcknowledgeReceipts = KPop3DeleteEmailsWhenDisconnectingFlag << 1, //0x00000040
275 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT)
276 KPop3AuthFlag = KPop3AcknowledgeReceipts << 1, //0x00000080
277 KPop3FallbackFlag = KPop3AuthFlag << 1, //0x00000100
278 KPop3EmailSettingsLastUsedFlag = KPop3FallbackFlag //0x00000100
280 KPop3EmailSettingsLastUsedFlag = KPop3AcknowledgeReceipts //0x00000040
284 TImPop3SettingsExtension* iExtension; // renamed iReceiptAddress
285 TInt32 iInboxSyncLimit;
286 TInt32 iMaxEmailSize;
287 TPop3GetMailOptions iGetMailOptions;
290 inline CImPop3Settings::TImPop3SettingsExtension* CImPop3Settings::Extension() const
295 inline void CImPop3Settings::CheckExtensionExistsL()
298 iExtension=new (ELeave) CImPop3Settings::TImPop3SettingsExtension;
301 inline CImPop3Settings::TImPop3SettingsExtension::TImPop3SettingsExtension() : iLoginName(NULL) , iPassword(NULL), iTlsSslDomain(NULL)
305 #endif // #define __POP3SET_H__