|
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 #if !defined (__POP3SET_H__) |
|
17 #define __POP3SET_H__ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include <msvuids.h> |
|
23 #include <miutset.h> |
|
24 #include <miut_err.h> |
|
25 |
|
26 |
|
27 |
|
28 /** Default POP3 server port number. */ |
|
29 const TUint32 KPOP3DefaultPortNumber = 110; |
|
30 |
|
31 /** @deprecated */ |
|
32 const TInt32 KImPop3SynchroniseAll = -1; |
|
33 |
|
34 /** @deprecated */ |
|
35 const TInt32 KImPop3SynchroniseNone = 0; |
|
36 |
|
37 /** |
|
38 Specifies which parts of a POP3 message to download. Used when configuring the |
|
39 POP3 service settings. |
|
40 |
|
41 @see |
|
42 CImPop3Settings |
|
43 |
|
44 @publishedAll |
|
45 @released |
|
46 */ |
|
47 enum TPop3GetMailOptions |
|
48 { |
|
49 /** Message headers only. */ |
|
50 EGetPop3EmailHeaders, |
|
51 /** Complete message. */ |
|
52 EGetPop3EmailMessages |
|
53 }; |
|
54 |
|
55 |
|
56 class TPop3Progress |
|
57 /** |
|
58 Progress information for a POP3 operation. |
|
59 |
|
60 @publishedAll |
|
61 @released |
|
62 */ |
|
63 { |
|
64 public: |
|
65 IMPORT_C TInt ConnectionState() const; |
|
66 IMPORT_C TInt ConnectionIAP() const; |
|
67 |
|
68 public: |
|
69 /** Defines types of POP3 operations. */ |
|
70 enum TPop3ProgressType |
|
71 { |
|
72 /** Refreshing view of remote mail box. */ |
|
73 EPopRefreshing, |
|
74 /** Copying messages. */ |
|
75 EPopCopying, |
|
76 /** Deleting messages. */ |
|
77 EPopDeleting, |
|
78 /** Connecting to remote mail box. */ |
|
79 EPopConnecting, |
|
80 /** Internal reorganisation. */ |
|
81 EPopTidying, |
|
82 /** Connected to remote mail box and no current operations. */ |
|
83 EPopConnectedAndIdle, |
|
84 /** Disconnecting from remote mail box. */ |
|
85 EPopDisconnecting, |
|
86 /** Disconnected from remote mail box. */ |
|
87 EPopDisconnected, |
|
88 /** Moving messages. */ |
|
89 EPopMoving, |
|
90 /** Copying new messages. */ |
|
91 EPopCopyNewMail, |
|
92 /** Moving new messages. */ |
|
93 EPopMoveNewMail, |
|
94 /** Copying a selection of messages. */ |
|
95 EPopCopyMailSelection, |
|
96 /** Moving a selection of messages. */ |
|
97 EPopMoveMailSelection, |
|
98 /** Copying all messages. */ |
|
99 EPopCopyAllMail, |
|
100 /** Moving all messages. */ |
|
101 EPopMoveAllMail, |
|
102 /** Populating view of remote mail box. */ |
|
103 EPopPopulating, |
|
104 /** Cancelling all off-line operations. */ |
|
105 EPopCancellingOfflineOps, |
|
106 /** Populating mailbox with top command */ |
|
107 EPopTopPopulating, |
|
108 /** Defines the maximum value for this enumeration. */ |
|
109 EPopMaxProgressValue=EPopTopPopulating |
|
110 }; |
|
111 |
|
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. */ |
|
116 TInt iTotalMsgs; |
|
117 /** Remaining number of messages to process. */ |
|
118 TInt iMsgsToProcess; |
|
119 /** Number of bytes processed by the operation. */ |
|
120 TInt iBytesDone; |
|
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 |
|
123 operation. */ |
|
124 TInt iTotalBytes; |
|
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. */ |
|
130 TMsvId iServiceId; |
|
131 /** The total size of messages to be downloaded. */ |
|
132 TInt iTotalSize; // The total size of messages to be downloaded. |
|
133 }; |
|
134 |
|
135 |
|
136 class TImPop3GetMailInfo |
|
137 /** |
|
138 Use to specify the maximum message size and the destination folder ID for |
|
139 certain POP3 operations. |
|
140 |
|
141 @see |
|
142 CPop3ClientMtm |
|
143 |
|
144 @publishedAll |
|
145 @released |
|
146 */ |
|
147 { |
|
148 public: |
|
149 /** Maximum message size for the operation. */ |
|
150 TInt32 iMaxEmailSize; |
|
151 /** ID of the destination folder for the operation. */ |
|
152 TMsvId iDestinationFolder; |
|
153 }; |
|
154 |
|
155 class TImPop3PopulateOptions |
|
156 /** |
|
157 Use to specify the population limit for the POP3 top command |
|
158 |
|
159 @see |
|
160 CPop3ClientMtm |
|
161 |
|
162 @publishedAll |
|
163 @released |
|
164 */ |
|
165 { |
|
166 private: |
|
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 */ |
|
169 TInt32 iVersion; |
|
170 |
|
171 public: |
|
172 IMPORT_C TImPop3PopulateOptions(); |
|
173 IMPORT_C static void UnpackL(const TDesC8& aDesc, TImPop3PopulateOptions &aUnpackTo); |
|
174 |
|
175 IMPORT_C TInt MaxEmailSize(); |
|
176 IMPORT_C void SetMaxEmailSize(TInt aMaxEmailSize); |
|
177 IMPORT_C TInt PopulationLimit(); |
|
178 IMPORT_C void SetPopulationLimit(TInt aPopulationLimit); |
|
179 |
|
180 private: |
|
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 */ |
|
186 }; |
|
187 |
|
188 |
|
189 class CImPop3Settings : public CImBaseEmailSettings |
|
190 /** |
|
191 Run-time configuration settings for POP3. |
|
192 |
|
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. |
|
196 |
|
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. |
|
201 |
|
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. |
|
209 |
|
210 @see CMsvStore |
|
211 @publishedAll |
|
212 @released |
|
213 */ |
|
214 { |
|
215 public: |
|
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; |
|
250 #endif |
|
251 |
|
252 private: |
|
253 class TImPop3SettingsExtension |
|
254 { |
|
255 public: |
|
256 inline TImPop3SettingsExtension(); |
|
257 public: |
|
258 HBufC8* iLoginName; |
|
259 HBufC8* iPassword; |
|
260 HBufC8* iTlsSslDomain; |
|
261 TInt32 iPopulationLimit; |
|
262 }; |
|
263 inline TImPop3SettingsExtension* Extension() const; |
|
264 inline void CheckExtensionExistsL(); |
|
265 |
|
266 enum TImPop3EmailSettings |
|
267 { |
|
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 |
|
279 #else |
|
280 KPop3EmailSettingsLastUsedFlag = KPop3AcknowledgeReceipts //0x00000040 |
|
281 #endif |
|
282 }; |
|
283 |
|
284 TImPop3SettingsExtension* iExtension; // renamed iReceiptAddress |
|
285 TInt32 iInboxSyncLimit; |
|
286 TInt32 iMaxEmailSize; |
|
287 TPop3GetMailOptions iGetMailOptions; |
|
288 }; |
|
289 |
|
290 inline CImPop3Settings::TImPop3SettingsExtension* CImPop3Settings::Extension() const |
|
291 { |
|
292 return iExtension; |
|
293 } |
|
294 |
|
295 inline void CImPop3Settings::CheckExtensionExistsL() |
|
296 { |
|
297 if (!iExtension) |
|
298 iExtension=new (ELeave) CImPop3Settings::TImPop3SettingsExtension; |
|
299 } |
|
300 |
|
301 inline CImPop3Settings::TImPop3SettingsExtension::TImPop3SettingsExtension() : iLoginName(NULL) , iPassword(NULL), iTlsSslDomain(NULL) |
|
302 { |
|
303 } |
|
304 |
|
305 #endif // #define __POP3SET_H__ |