46
|
1 |
/*
|
|
2 |
* Copyright (c) 2004 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 "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: DM Email Settings Adapter
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
#ifndef __NSMLDMEMAILADAPTER_H__
|
|
23 |
#define __NSMLDMEMAILADAPTER_H__
|
|
24 |
|
|
25 |
// -----------------------------------------------------------------------------
|
|
26 |
// Includes
|
|
27 |
// -----------------------------------------------------------------------------
|
|
28 |
#include <e32base.h>
|
|
29 |
#include <smldmadapter.h>
|
|
30 |
#include <msvapi.h>
|
|
31 |
|
|
32 |
// -----------------------------------------------------------------------------
|
|
33 |
// Class forwards
|
|
34 |
// -----------------------------------------------------------------------------
|
|
35 |
class CImSmtpSettings;
|
|
36 |
class CImPop3Settings;
|
|
37 |
class CImImap4Settings;
|
|
38 |
class CImIAPPreferences;
|
|
39 |
class CMsvSession;
|
|
40 |
class CEmailAccounts;
|
|
41 |
|
|
42 |
|
|
43 |
// -----------------------------------------------------------------------------
|
|
44 |
// Definitions
|
|
45 |
// -----------------------------------------------------------------------------
|
|
46 |
|
|
47 |
// the DDF version must be changed if any changes in DDF structure
|
|
48 |
// ( built in DDFStructureL() function )
|
|
49 |
//
|
|
50 |
_LIT8( KNSmlDMEmailDDFVersion, "1.1" );
|
|
51 |
|
|
52 |
_LIT8( KNSmlDMEmailTextPlain, "text/plain" );
|
|
53 |
_LIT8( KNSmlDMEmailNodeName, "Email" );
|
|
54 |
_LIT8( KNSmlDMEmailDescription, "The interior object holds all email objects" );
|
|
55 |
_LIT8( KNSmlDMDynamicNodeDescription, "Placeholder for one or more Email objects" );
|
|
56 |
_LIT8( KNSmlDMNameDescription, "Displayable Account Name for the Email Settings" );
|
|
57 |
_LIT8( KNSmlDMUIDDescription, "User ID for email account" );
|
|
58 |
_LIT8( KNSmlDMPWDescription, "Password for email account " );
|
|
59 |
_LIT8( KNSmlDMUAddrDescription, "User's email address" );
|
|
60 |
_LIT8( KNSmlDMUNameDescription, "Displayable name for the user" );
|
|
61 |
_LIT8( KNSmlDMMrcvDescription, "Host name of the receiving (IMAP/POP3) server" );
|
|
62 |
_LIT8( KNSmlDMMsndDescription, "Host name of the SMTP server" );
|
|
63 |
_LIT8( KNSmlDMMproDescription, "Remote mailbox protocol" );
|
|
64 |
_LIT8( KNSmlDMUseSecConDescription, "Secure connection is used or not" );
|
|
65 |
_LIT8( KNSmlDMUseSauthDescription, "SMTP authentication is used or not" );
|
|
66 |
_LIT8( KNSmlDMSauthUIDDescription, "SMTP authenticatio user Id" );
|
|
67 |
_LIT8( KNSmlDMSauthPWDescription, "SMTP authentication password" );
|
|
68 |
_LIT8( KNSmlDMPtxtSAuthDescription, "Plain text SMTP authentication is allowed or not" );
|
|
69 |
_LIT8( KNSmlDMDelFetDescription, "Defines whether to delete fetched mail from remote server" );
|
|
70 |
_LIT8( KNSmlDMUseAPOPDescription, "Defines whether the APOP is used or not" );
|
|
71 |
_LIT8( KNSmlDMRcvPortDescription, "Port for IMAP4 or POP3" );
|
|
72 |
_LIT8( KNSmlDMSndPortDescription, "Port for SMTP" );
|
|
73 |
_LIT8( KNSmlDMToNapIDDescription, "Link to connectivity information" );
|
|
74 |
|
|
75 |
_LIT8( KNSmlDMSToNapIDDescription, "Link to connectivity information for sending SMTP" );
|
|
76 |
_LIT8( KNSmlDMSUseSecConDescription, "Defines whether SSL/TLS security is used in SMTP" );
|
|
77 |
_LIT8( KNSmlDMUseStartTLSDescription, "Defines whether StartTLS is used in IMAP/POP" );
|
|
78 |
_LIT8( KNSmlDMSUseStartTLSDescription, "Defines whether StartTLS is in SMTP" );
|
|
79 |
_LIT8( KNSmlDMMrcvPortDescription, "Defines the port number of the IMAP/POP server" );
|
|
80 |
_LIT8( KNSmlDMMsndPortDescription, "Defines the port number of the SMTP server" );
|
|
81 |
_LIT8( KNSmlDMFolderPathDescription, "Defines the mailbox folder path" );
|
|
82 |
|
|
83 |
_LIT8( KNSmlDMEmailDynamicNode, "" );
|
|
84 |
_LIT8( KNSmlDMEmailName, "Name" );
|
|
85 |
_LIT8( KNSmlDMEmailUID, "UID" );
|
|
86 |
_LIT8( KNSmlDMEmailPW, "PW" );
|
|
87 |
_LIT8( KNSmlDMEmailUAddr, "UAddr" );
|
|
88 |
_LIT8( KNSmlDMEmailUName, "UName" );
|
|
89 |
_LIT8( KNSmlDMEmailMrcv, "Mrcv" );
|
|
90 |
_LIT8( KNSmlDMEmailMsnd, "Msnd" );
|
|
91 |
_LIT8( KNSmlDMEmailMpro, "Mpro" );
|
|
92 |
_LIT8( KNSmlDMEmailUseAPOP, "UseAPOP" );
|
|
93 |
_LIT8( KNSmlDMEmailUseSecCon, "UseSecCon" );
|
|
94 |
_LIT8( KNSmlDMEmailUseSauth, "UseSauth" );
|
|
95 |
_LIT8( KNSmlDMEmailSauthUID, "SauthUID" );
|
|
96 |
_LIT8( KNSmlDMEmailSauthPW, "SauthPW" );
|
|
97 |
_LIT8( KNSmlDMEmailPtxtSAuth, "PtxtSAuth" );
|
|
98 |
//_LIT8( KNSmlDMEmailRcvPort, "RcvPort" );
|
|
99 |
//_LIT8( KNSmlDMEmailSndPort, "SndPort" );
|
|
100 |
_LIT8( KNSmlDMEmailToNapID, "ToNapID" );
|
|
101 |
_LIT8( KNSmlDMEmailIAPUri, "AP" );
|
|
102 |
|
|
103 |
_LIT8( KNSmlDMEmailSToNapID, "SToNapID" );
|
|
104 |
_LIT8( KNSmlDMEmailSUseSecCon, "SUseSecCon" );
|
|
105 |
_LIT8( KNSmlDMEmailUseStartTLS, "UseStartTLS" );
|
|
106 |
_LIT8( KNSmlDMEmailSUseStartTLS, "SUseStartTLS" );
|
|
107 |
_LIT8( KNSmlDMEmailMrcvPort, "MrcvPort" );
|
|
108 |
_LIT8( KNSmlDMEmailMsndPort, "MsndPort" );
|
|
109 |
_LIT8( KNSmlDMEmailFolderPath, "FolderPath" );
|
|
110 |
|
|
111 |
_LIT8( KNSmlDMEmailMproPOP, "POP" );
|
|
112 |
_LIT8( KNSmlDMEmailMproIMAP, "IMAP" );
|
|
113 |
_LIT8( KNSmlDMEmailTrue, "True" );
|
|
114 |
_LIT8( KNSmlDMEmailFalse, "False" );
|
|
115 |
|
|
116 |
_LIT8( KNSmlDMEmailListOfLeafs, "Name/UID/PW/UAddr/UName/Mrcv/Msnd/Mpro/UseSecCon/UseSauth/SauthUID/SauthPW/PtxtSAuth/ToNapID/SToNapID/SUseSecCon/UseStartTLS/SUseStartTLS/MrcvPort/MsndPort/UseAPOP/FolderPath" );
|
|
117 |
_LIT8( KNSmlDMEmailSeparator8, "/" );
|
|
118 |
_LIT8( KNSmlEmailUriDotSlash, "./");
|
|
119 |
|
|
120 |
const TInt KNSmlDmFatMinimumFileSize = 512;
|
|
121 |
const TInt KNSmlSmtpMessageTypeValue = 0x10001028;
|
|
122 |
const TInt KNSmlDefaultMaxLimit = 1024*10; //maximum message size (default)
|
|
123 |
const TInt KNSmlDmEmailGranularity = 4;
|
|
124 |
const TUint32 KNSmlDmEmailAlwaysAskIap = 0;
|
|
125 |
|
|
126 |
const TInt KNSmlDMEmailNormalSmtpPort = 25;
|
|
127 |
const TInt KNSmlDMEmailSslSmtpPort = 465;
|
|
128 |
const TInt KNSmlDMEmailNormalImap4Port = 143;
|
|
129 |
const TInt KNSmlDMEmailNormalPop3Port = 110;
|
|
130 |
const TInt KNSmlDMEmailSslWrappedImap4Port = 993;
|
|
131 |
const TInt KNSmlDMEmailSslWrappedPop3Port = 995;
|
|
132 |
const TInt KNSmlDMEmailDefaultHeaderCount = 30;
|
|
133 |
|
|
134 |
const TInt KNSmlDmEmailImapLuidLow = 50000;
|
|
135 |
const TInt KNSmlDmEmailImapLuidHigh = 100000;
|
|
136 |
const TInt KNSmlDmEmailPopLuidHigh = 150000;
|
|
137 |
const TUint32 KNSmlDMEmailMaxPortNbr = 0xffff;
|
|
138 |
|
|
139 |
/**
|
|
140 |
* The main class of the SyncML DM Email adapter.
|
|
141 |
*
|
|
142 |
* @since
|
|
143 |
*/
|
|
144 |
class CNSmlDmEmailAdapter : public CSmlDmAdapter, public MMsvSessionObserver
|
|
145 |
{
|
|
146 |
public:
|
|
147 |
/**
|
|
148 |
* The one phase constructor
|
|
149 |
*
|
|
150 |
*/
|
|
151 |
static CNSmlDmEmailAdapter* NewL(MSmlDmCallback* aDmCallback );
|
|
152 |
|
|
153 |
/**
|
|
154 |
* The destructor
|
|
155 |
*
|
|
156 |
*/
|
|
157 |
virtual ~CNSmlDmEmailAdapter();
|
|
158 |
|
|
159 |
// Adapter interface from CSmlDmAdapter
|
|
160 |
/**
|
|
161 |
* The function returns current version of the DDF. By asking
|
|
162 |
* current DDF versions from adapters DM Module can control *
|
|
163 |
* possible changes in the data structure and send the changed DDF
|
|
164 |
* description to a management server. This function is always
|
|
165 |
* called after DDFStructureL.
|
|
166 |
* @param aVersion DDF version of the
|
|
167 |
* adapter. (filled by the adapter)
|
|
168 |
* @publishedPartner
|
|
169 |
* @prototype
|
|
170 |
*/
|
|
171 |
|
|
172 |
void DDFVersionL( CBufBase& aDDFVersion );
|
|
173 |
/**
|
|
174 |
* The function for filling the DDF structure of the adapter
|
|
175 |
* This function is only called once, immediately after the adapter is created.
|
|
176 |
* @param aDDFObject Reference to root object. A DM adapter starts filling
|
|
177 |
* the data structure by calling AddChildObjectL to the root object and
|
|
178 |
* so describes the DDF of the adapter.
|
|
179 |
* @publishedPartner
|
|
180 |
* @prototype
|
|
181 |
*/
|
|
182 |
void DDFStructureL( MSmlDmDDFObject& aDDF );
|
|
183 |
/**
|
|
184 |
* The function creates new leaf objects, or replaces data in existing leaf
|
|
185 |
* objects. The information about the success of the command should be
|
|
186 |
* returned by calling SetStatusL function of MSmlDmCallback callback
|
|
187 |
* interface. This makes it possible to buffer the commands. However, all
|
|
188 |
* the status codes for buffered commands must be returned at the latest when
|
|
189 |
* the adapter's CompleteOutstandingCmdsL() is called.
|
|
190 |
* @param aURI URI of the object
|
|
191 |
* @param aLUID LUID of the object (if the adapter has earlier returned a
|
|
192 |
* LUID to the DM Module). For new objects, this is the LUID
|
|
193 |
* inherited through the parent node.
|
|
194 |
* @param aObject Data of the object.
|
|
195 |
* @param aType MIME type of the object
|
|
196 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
197 |
* must be used when calling the SetStatusL of this command
|
|
198 |
* @publishedPartner
|
|
199 |
* @prototype
|
|
200 |
*/
|
|
201 |
void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
202 |
const TDesC8& aObject, const TDesC8& aType,
|
|
203 |
TInt aStatusRef );
|
|
204 |
/**
|
|
205 |
* The function deletes an object and its child objects. The SetStatusL
|
|
206 |
* should be used as described in UpdateLeafObjectL()
|
|
207 |
* @param aURI URI of the object
|
|
208 |
* @param aLUID LUID of the object (if the adapter have earlier returned
|
|
209 |
* LUID to the DM Module).
|
|
210 |
* @param aStatusRef Reference to correct command, i.e. this reference must
|
|
211 |
* be used when calling the SetStatusL of this command.
|
|
212 |
* @publishedPartner
|
|
213 |
* @prototype
|
|
214 |
*/
|
|
215 |
void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
216 |
const TInt aStatusRef );
|
|
217 |
/**
|
|
218 |
* The function fetches data of a leaf object. The SetStatusL should be used
|
|
219 |
* as described in UpdateLeafObjectL(). The data is returned by using the
|
|
220 |
* SetResultsL function of MSmlCallback callback interface, and may be streamed.
|
|
221 |
* @param aURI URI of the object
|
|
222 |
* @param aLUID LUID of the object (if the adapter have earlier
|
|
223 |
* returned LUID to the DM Module).
|
|
224 |
* @param aType MIME type of the object
|
|
225 |
* @param aResultsRef Reference to correct results, i.e. this reference
|
|
226 |
* must be used when returning the result by calling
|
|
227 |
* the SetResultsL.
|
|
228 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
229 |
* must be used when calling the SetStatusL of this
|
|
230 |
* command.
|
|
231 |
* @publishedPartner
|
|
232 |
* @prototype
|
|
233 |
*/
|
|
234 |
void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
235 |
const TDesC8& aType, const TInt aResultsRef,
|
|
236 |
const TInt aStatusRef );
|
|
237 |
/**
|
|
238 |
* The function fetches URI list. An adapter returns the list of URI segments
|
|
239 |
* under the given URI be separated by slash ("/"). The URI segment names for
|
|
240 |
* new objects must be given by the adapter.
|
|
241 |
* The list is returned by calling the SetResultsL function of MSmlCallback
|
|
242 |
* callback interface. Results from this call MUST NOT be streamed.
|
|
243 |
* @param aParentURI URI of the parent object
|
|
244 |
* @param aParentLUID LUID of the parent object (if the
|
|
245 |
* adapter have earlier returned LUID to
|
|
246 |
* the DM Module).
|
|
247 |
* @param aPreviousURISegmentList URI list with mapping LUID information,
|
|
248 |
* which is known by DM engine. An adapter
|
|
249 |
* can use this information when verifying
|
|
250 |
* if old objects still exists. An adapter
|
|
251 |
* also knows what objects are new to DM
|
|
252 |
* engine and can provide LUID mapping for
|
|
253 |
* them. aPreviousURISegmentList parameter
|
|
254 |
* (see above) helps to recognise new
|
|
255 |
* objects.
|
|
256 |
* @param aResultsRef Reference to correct results, i.e. this
|
|
257 |
* reference must be used when returning
|
|
258 |
* the result by calling the SetResultsL.
|
|
259 |
* @param aStatusRef Reference to correct command, i.e. this
|
|
260 |
* reference must be used when calling the
|
|
261 |
* SetStatusL of this command.
|
|
262 |
* @publishedPartner
|
|
263 |
* @prototype
|
|
264 |
*/
|
|
265 |
void ChildURIListL( const TDesC8& aURI,
|
|
266 |
const TDesC8& aLUID,
|
|
267 |
const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList,
|
|
268 |
const TInt aResultsRef, const TInt aStatusRef );
|
|
269 |
/**
|
|
270 |
* The function adds node object. In some cases an implementation of the
|
|
271 |
* function may be empty function, if the node object does not need concrete
|
|
272 |
* database update. Still this function may be helpful to an adapter, i.e. in
|
|
273 |
* passing mapping LUID of the node to DM Module. The SetStatusL should be
|
|
274 |
* used as described in UpdateLeafObjectL()
|
|
275 |
* @param aURI URI of the object
|
|
276 |
* @param aParentLUID LUID of the parent object (if the adapter have
|
|
277 |
* earlier returned LUID to the DM Module).
|
|
278 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
279 |
* must be used when calling the SetStatusL of this
|
|
280 |
* command.
|
|
281 |
* @publishedPartner
|
|
282 |
* @prototype
|
|
283 |
*/
|
|
284 |
void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID,
|
|
285 |
const TInt aStatusRef );
|
|
286 |
/**
|
|
287 |
* The function creates new leaf objects, or replaces data in existing leaf
|
|
288 |
* objects, in the case where data is large enough to be streamed. The
|
|
289 |
* information about the success of the command should be returned by calling
|
|
290 |
* SetStatusL function of MSmlDmCallback callback interface. This makes it
|
|
291 |
* possible to buffer the commands. However, all the status codes for buffered
|
|
292 |
* commands must be returned at the latest when the CompleteOutstandingCmdsL()
|
|
293 |
* of adapter is called.
|
|
294 |
* @param aURI URI of the object
|
|
295 |
* @param aLUID LUID of the object (if the adapter has earlier returned a
|
|
296 |
* LUID to the DM Module). For new objects, this is the LUID
|
|
297 |
* inherited through the parent node.
|
|
298 |
* @param aStream Data of the object. Adapter should create write stream
|
|
299 |
* and return, when data is written to stream by DM agent,
|
|
300 |
* StreamCommittedL() is called by DM engine
|
|
301 |
* @param aType MIME type of the object
|
|
302 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
303 |
* must be used when calling the SetStatusL of this
|
|
304 |
* command.
|
|
305 |
* @publishedPartner
|
|
306 |
* @prototype
|
|
307 |
*/
|
|
308 |
void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
309 |
RWriteStream*& aStream, const TDesC8& aType,
|
|
310 |
const TInt aStatusRef );
|
|
311 |
/**
|
|
312 |
* The function fetches the size of the data of a leaf object. The size is
|
|
313 |
* in bytes, and must reflect the number of bytes that will be transferred
|
|
314 |
* when the framework calls FetchLeafObjectL. The SetStatusL should be used
|
|
315 |
* as described in FetchLeafObjectL(). The size value is returned by using
|
|
316 |
* the SetResultsL function of MSmlCallback callback interface, and must be
|
|
317 |
* a decimal integer expressed as a string, eg. "1234".
|
|
318 |
* Results from this call MUST NOT be streamed.
|
|
319 |
* @param aURI URI of the object
|
|
320 |
* @param aLUID LUID of the object (if the adapter have earlier
|
|
321 |
* returned LUID to the DM Module).
|
|
322 |
* @param aType MIME type of the object
|
|
323 |
* @param aResultsRef Reference to correct results, i.e. this reference
|
|
324 |
* must be used when returning the result by calling
|
|
325 |
* the SetResultsL.
|
|
326 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
327 |
* must be used when calling the SetStatusL of this
|
|
328 |
* command.
|
|
329 |
* @publishedPartner
|
|
330 |
* @prototype
|
|
331 |
*/
|
|
332 |
void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
333 |
const TDesC8& aType, const TInt aResultsRef,
|
|
334 |
const TInt aStatusRef );
|
|
335 |
/**
|
|
336 |
* The function implements execute command. The information about the success
|
|
337 |
* of the command should be returned by calling SetStatusL function of
|
|
338 |
* MSmlDmCallback callback interface. This makes it possible to buffer the
|
|
339 |
* commands.
|
|
340 |
* However, all the status codes for buffered commands must be returned at
|
|
341 |
* the latest when the CompleteOutstandingCmdsL() of adapter is called.
|
|
342 |
* @param aURI URI of the command
|
|
343 |
* @param aLUID LUID of the object (if the adapter have earlier
|
|
344 |
* returned LUID to the DM Module).
|
|
345 |
* @param aArgument Argument for the command
|
|
346 |
* @param aType MIME type of the object
|
|
347 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
348 |
* must be used when calling the SetStatusL of this
|
|
349 |
* command.
|
|
350 |
* @publishedPartner
|
|
351 |
* @prototype
|
|
352 |
*/
|
|
353 |
void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
354 |
const TDesC8& aArgument, const TDesC8& aType,
|
|
355 |
const TInt aStatusRef );
|
|
356 |
/**
|
|
357 |
* The function implements execute command. The information about the
|
|
358 |
* success of the command should be returned by calling SetStatusL function
|
|
359 |
* of MSmlDmCallback callback interface. This makes it possible to buffer the
|
|
360 |
* commands.
|
|
361 |
* However, all the status codes for buffered commands must be returned at
|
|
362 |
* the latest when the CompleteOutstandingCmdsL() of adapter is called.
|
|
363 |
* @param aURI URI of the command
|
|
364 |
* @param aLUID LUID of the object (if the adapter have earlier
|
|
365 |
* returned LUID to the DM Module).
|
|
366 |
* @param aStream Argument for the command. Adapter should create
|
|
367 |
* write stream and return, when data is written to
|
|
368 |
* stream by DM agent, StreamCommittedL() is called by
|
|
369 |
* DM engine
|
|
370 |
* @param aType MIME type of the object
|
|
371 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
372 |
* must be used when calling the SetStatusL of this
|
|
373 |
* command.
|
|
374 |
* @publishedPartner
|
|
375 |
* @prototype
|
|
376 |
*/
|
|
377 |
void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID,
|
|
378 |
RWriteStream*& aStream, const TDesC8& aType,
|
|
379 |
const TInt aStatusRef );
|
|
380 |
/**
|
|
381 |
* The function implements copy command. The information about the success of
|
|
382 |
* the command should be returned by calling SetStatusL function of
|
|
383 |
* MSmlDmCallback callback interface. This makes it possible to buffer the
|
|
384 |
* commands.
|
|
385 |
* However, all the status codes for buffered commands must be returned at
|
|
386 |
* the latest when the CompleteOutstandingCmdsL() of adapter is called.
|
|
387 |
* @param aTargetURI Target URI for the command
|
|
388 |
* @param aSourceLUID LUID of the target object (if one exists, and if the adapter
|
|
389 |
* has earlier returned a LUID to the DM Module).
|
|
390 |
* @param aSourceURI Source URI for the command
|
|
391 |
* @param aSourceLUID LUID of the source object (if the adapter has
|
|
392 |
* earlier returned a LUID to the DM Module).
|
|
393 |
* @param aType MIME type of the objects
|
|
394 |
* @param aStatusRef Reference to correct command, i.e. this reference
|
|
395 |
* must be used when calling the SetStatusL of this
|
|
396 |
* command.
|
|
397 |
* @publishedPartner
|
|
398 |
* @prototype
|
|
399 |
*/
|
|
400 |
void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID,
|
|
401 |
const TDesC8& aSourceURI, const TDesC8& aSourceLUID,
|
|
402 |
const TDesC8& aType, TInt aStatusRef );
|
|
403 |
/**
|
|
404 |
* The function indicates start of Atomic command.
|
|
405 |
* @publishedPartner
|
|
406 |
* @prototype
|
|
407 |
*/
|
|
408 |
void StartAtomicL();
|
|
409 |
/**
|
|
410 |
* The function indicates successful end of Atomic command. The adapter
|
|
411 |
* should commit all changes issued between StartAtomicL() and
|
|
412 |
* CommitAtomicL()
|
|
413 |
* @publishedPartner
|
|
414 |
* @prototype
|
|
415 |
*/
|
|
416 |
void CommitAtomicL();
|
|
417 |
/**
|
|
418 |
* The function indicates unsuccessful end of Atomic command. The adapter
|
|
419 |
* should rollback all changes issued between StartAtomicL() and
|
|
420 |
* RollbackAtomicL(). If rollback fails for a command, adapter should use
|
|
421 |
* SetStatusL() to indicate it.
|
|
422 |
* @publishedPartner
|
|
423 |
* @prototype
|
|
424 |
*/
|
|
425 |
void RollbackAtomicL();
|
|
426 |
/**
|
|
427 |
* Returns ETrue if adapter supports streaming otherwise EFalse.
|
|
428 |
* @param aItemSize size limit for stream usage
|
|
429 |
* @return TBool ETrue for streaming support
|
|
430 |
* @publishedPartner
|
|
431 |
* @prototype
|
|
432 |
*/
|
|
433 |
TBool StreamingSupport( TInt& aItemSize );
|
|
434 |
/**
|
|
435 |
* Called when stream returned from UpdateLeafObjectL or ExecuteCommandL has
|
|
436 |
* been written to and committed. Not called when fetching item.
|
|
437 |
* @publishedPartner
|
|
438 |
* @prototype
|
|
439 |
*/
|
|
440 |
void StreamCommittedL();
|
|
441 |
/**
|
|
442 |
* The function tells the adapter that all the commands of the message that
|
|
443 |
* can be passed to the adapter have now been passed. This indciates that
|
|
444 |
* the adapter must supply status codes and results to any buffered commands.
|
|
445 |
* This must be done at latest by the time this function returns.
|
|
446 |
* This function is used at the end of SyncML messages, and during processing
|
|
447 |
* of Atomic. In the case of Atomic processing, the function will be
|
|
448 |
* followed by a call to CommitAtomicL or RollbackAtomicL.
|
|
449 |
* @publishedPartner
|
|
450 |
* @prototype
|
|
451 |
*/
|
|
452 |
void CompleteOutstandingCmdsL();
|
|
453 |
|
|
454 |
protected:
|
|
455 |
/**
|
|
456 |
* Inherited from MMsvSessionObserver
|
|
457 |
* Indicates an event has occurred.
|
|
458 |
* @param aEvent Indicates the event type.
|
|
459 |
* @param aArg1 Event type-specific argument value
|
|
460 |
* @param aArg2 Event type-specific argument value
|
|
461 |
* @param aArg3 Event type-specific argument value
|
|
462 |
*/
|
|
463 |
void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
|
|
464 |
TAny* aArg3 );
|
|
465 |
|
|
466 |
private:
|
|
467 |
|
|
468 |
struct TNSmlEmailCommandElement
|
|
469 |
{
|
|
470 |
HBufC8* iLastUriSeg;
|
|
471 |
HBufC8* iData;
|
|
472 |
TInt iStatusRef;
|
|
473 |
TBool iLeaf;
|
|
474 |
CSmlDmAdapter::TError iStatus;
|
|
475 |
};
|
|
476 |
|
|
477 |
enum TNSmlEmailAccountType
|
|
478 |
{
|
|
479 |
EImap,
|
|
480 |
EPop,
|
|
481 |
EUnknown
|
|
482 |
};
|
|
483 |
|
|
484 |
enum TNSmlEmailSecuritySetting
|
|
485 |
{
|
|
486 |
EUseSecCon = 1,
|
|
487 |
EUseStartTls,
|
|
488 |
ESuseSecCon,
|
|
489 |
ESuseStartTls,
|
|
490 |
};
|
|
491 |
|
|
492 |
struct TNSmlEmailSettingsElement
|
|
493 |
{
|
|
494 |
CArrayFixFlat<TNSmlEmailCommandElement> *iNodeBuf;
|
|
495 |
/* iMappingName = Email/xxxx */
|
|
496 |
HBufC8* iMappingName;
|
|
497 |
HBufC* iName;
|
|
498 |
CImSmtpSettings* iSmtpSettings;
|
|
499 |
CImPop3Settings* iPop3Settings;
|
|
500 |
CImImap4Settings* iImap4Settings;
|
|
501 |
CImIAPPreferences* iIapPref;
|
|
502 |
CImIAPPreferences* iSmtpIapPref;
|
|
503 |
|
|
504 |
TBool iExecuted;
|
|
505 |
TInt iLuid;
|
|
506 |
TBool iJustFetch;
|
|
507 |
CNSmlDmEmailAdapter::TNSmlEmailAccountType iAccType;
|
|
508 |
TInt iAccId;
|
|
509 |
TMsvId iServiceId;
|
|
510 |
};
|
|
511 |
|
|
512 |
/**
|
|
513 |
* C++ default constructor.
|
|
514 |
*/
|
|
515 |
void ConstructL();
|
|
516 |
CNSmlDmEmailAdapter();
|
|
517 |
CNSmlDmEmailAdapter( MSmlDmCallback* aDmCallback );
|
|
518 |
|
|
519 |
/**
|
|
520 |
* Initializes the buffer for leaf nodes.
|
|
521 |
* @param aURI URI of the object
|
|
522 |
* @param aObject The data to be updated
|
|
523 |
* @param aStatusRef The status reference
|
|
524 |
* @param aIndex The index to command buffer
|
|
525 |
* @return status of the operation
|
|
526 |
*/
|
|
527 |
TInt FirstAddLeafL(const TDesC8& aURI,
|
|
528 |
const TDesC8& aObject,
|
|
529 |
TInt aStatusRef,
|
|
530 |
TInt aIndex);
|
|
531 |
|
|
532 |
/**
|
|
533 |
* Updates the value of leaf object
|
|
534 |
* @param aLastUriSeg URI of the object
|
|
535 |
* @param aObject The data to be updated
|
|
536 |
* @param aIndex The index to node buffer
|
|
537 |
* @param aCommand The index to command buffer
|
|
538 |
* @return status of the operation
|
|
539 |
*/
|
|
540 |
TInt DoAddLeafObjectL(const TDesC8& aLastUriSeg,
|
|
541 |
const TDesC8& aObject,
|
|
542 |
TInt aIndex,
|
|
543 |
TInt aCommand);
|
|
544 |
|
|
545 |
/**
|
|
546 |
* Set the default values to email account
|
|
547 |
* @param aIndex The index to node buffer
|
|
548 |
* @return none
|
|
549 |
*/
|
|
550 |
void SetDefaultSettingsL(TInt aIndex);
|
|
551 |
|
|
552 |
/**
|
|
553 |
* Converts 16bit descriptor to integer
|
|
554 |
* @param aLuid The descriptor to be converted
|
|
555 |
* @return Integer value of the descriptor
|
|
556 |
*/
|
|
557 |
TInt DesToInt(const TDesC& aLuid) const;
|
|
558 |
|
|
559 |
/**
|
|
560 |
* Converts 8bit descriptor to integer
|
|
561 |
* @param aLuid The descriptor to be converted
|
|
562 |
* @return Integer value of the descriptor
|
|
563 |
*/
|
|
564 |
TInt DesToInt(const TDesC8& aLuid) const;
|
|
565 |
|
|
566 |
/**
|
|
567 |
* Converts integer to 16bit descriptor
|
|
568 |
* @param aLuid The integer to be converted
|
|
569 |
* @return The Integer as a descriptor
|
|
570 |
*/
|
|
571 |
HBufC* IntToDesLC(const TInt aLuid) const;
|
|
572 |
|
|
573 |
/**
|
|
574 |
* Converts integer to 8bit descriptor
|
|
575 |
* @param aLuid The integer to be converted
|
|
576 |
* @return The Integer as a descriptor
|
|
577 |
*/
|
|
578 |
HBufC8* IntToDes8LC(const TInt aLuid) const;
|
|
579 |
|
|
580 |
/**
|
|
581 |
* Converts 16bit descriptor to 8bit descriptor
|
|
582 |
* @param aSource The descriptor to be converted
|
|
583 |
* @return The 8bit descriptor
|
|
584 |
*/
|
|
585 |
HBufC8* ConvertTo8LC( const TDesC& aSource ) const;
|
|
586 |
|
|
587 |
/**
|
|
588 |
* Transfers the email settings from memory to phones permanent data store
|
|
589 |
* @param aIndex The index to command buffer
|
|
590 |
* @return Luid of the email account
|
|
591 |
*/
|
|
592 |
TInt ValidateAndStoreSettingsL(TInt aIndex);
|
|
593 |
|
|
594 |
/**
|
|
595 |
* Restores the settings to the adapter from phones permanent data store
|
|
596 |
* @param aIndex The index to command buffer
|
|
597 |
* @return Status of the operation
|
|
598 |
*/
|
|
599 |
TInt DoRestoreSettingsL(TInt aIndex);
|
|
600 |
|
|
601 |
/**
|
|
602 |
* Opens the CMsvSession if it is not open already
|
|
603 |
* @param none
|
|
604 |
* @return Status of the operation
|
|
605 |
*/
|
|
606 |
TInt OpenSessionL();
|
|
607 |
|
|
608 |
/**
|
|
609 |
* Parses the last URI segment from URI
|
|
610 |
* @param aURI The whole URI
|
|
611 |
* @return The last URI segment
|
|
612 |
*/
|
|
613 |
TPtrC8 LastURISeg(const TDesC8& aURI) const;
|
|
614 |
|
|
615 |
/**
|
|
616 |
* Removes the last URI segment from URI
|
|
617 |
* @param aURI The whole URI
|
|
618 |
* @return The aURI without the last URI segment
|
|
619 |
*/
|
|
620 |
TPtrC8 RemoveLastURISeg(const TDesC8& aURI) const;
|
|
621 |
|
|
622 |
/**
|
|
623 |
* Calculates the number of URI segments
|
|
624 |
* @param aURI The whole URI
|
|
625 |
* @return The number of URI segments
|
|
626 |
*/
|
|
627 |
TInt NumOfURISegs(const TDesC8& aURI) const;
|
|
628 |
|
|
629 |
/**
|
|
630 |
* Fills the DDF node with desired properties
|
|
631 |
* @param aNode Reference to node or leaf which info to be filled.
|
|
632 |
* @param aAccTypes Access rights for a leaf / node.
|
|
633 |
* @param aOccurrence Occurance of the node / leaf.
|
|
634 |
* @param aScope Scope (dynamic / permanent) of the leaf / node.
|
|
635 |
* @param aFormat Data format of the leaf / node.
|
|
636 |
* @param aDescription Description of the node / leaf.
|
|
637 |
* @param aDefaultValue Default value for a leaf or node.
|
|
638 |
* @return none
|
|
639 |
*/
|
|
640 |
void FillNodeInfoL( MSmlDmDDFObject& aNode,
|
|
641 |
const TSmlDmAccessTypes& aAccTypes,
|
|
642 |
MSmlDmDDFObject::TOccurence aOccurrence,
|
|
643 |
MSmlDmDDFObject::TScope aScope,
|
|
644 |
MSmlDmDDFObject::TDFFormat aFormat,
|
|
645 |
const TDesC8& aDescription) const;
|
|
646 |
|
|
647 |
/**
|
|
648 |
* Parses the dot and slash in start of URI away
|
|
649 |
* @param aURI The whole URI
|
|
650 |
* @return The URI without dot and slash in start
|
|
651 |
*/
|
|
652 |
TPtrC8 RemoveDotSlash(const TDesC8& aURI) const;
|
|
653 |
|
|
654 |
/**
|
|
655 |
* Fetches the value of leaf node
|
|
656 |
* @param aURI The whole URI
|
|
657 |
* @param aLUID The LUID
|
|
658 |
* @param aObject The storage for the result
|
|
659 |
* @return Status of the operation
|
|
660 |
*/
|
|
661 |
CSmlDmAdapter::TError FetchObjectL(const TDesC8& aURI,
|
|
662 |
const TDesC8& aLUID,
|
|
663 |
CBufBase& aObject);
|
|
664 |
|
|
665 |
/**
|
|
666 |
* Calculates correct account id from the LUID
|
|
667 |
* @param aAccType Account Type
|
|
668 |
* @param aAccId Account ID
|
|
669 |
* @param aLuid The LUID
|
|
670 |
* @return none
|
|
671 |
*/
|
|
672 |
void GetIdByLuid( TNSmlEmailAccountType& aAccType,
|
|
673 |
TInt& aAccId, const TInt aLuid ) const;
|
|
674 |
|
|
675 |
/**
|
|
676 |
* Calculates LUID from the account id
|
|
677 |
* @param aAccType Account Type
|
|
678 |
* @param aAccId Account ID
|
|
679 |
* @param aLuid The LUID
|
|
680 |
* @return none
|
|
681 |
*/
|
|
682 |
void SetLuidById( const TNSmlEmailAccountType& aAccType,
|
|
683 |
const TInt& aAccId, TInt& aLuid ) const;
|
|
684 |
|
|
685 |
/**
|
|
686 |
* Checks if the account with given id exists
|
|
687 |
* @param aAccs Pointer to CEmailAccount object
|
|
688 |
* @param aAccType Account Type
|
|
689 |
* @param aId Account ID
|
|
690 |
* @param aIndex The LUIDIndex to the command buffer
|
|
691 |
* @return True if the account exists
|
|
692 |
*/
|
|
693 |
TBool AccountExistsL( CEmailAccounts* aAccs,
|
|
694 |
const TNSmlEmailAccountType aAccType,
|
|
695 |
const TInt aId,
|
|
696 |
TInt aIndex );
|
|
697 |
|
|
698 |
/**
|
|
699 |
* Sets the parameters related to STARTTLS and SSL/TLS
|
|
700 |
* @param aObject The value(True/False) to be set
|
|
701 |
* @param aThisElem The element of which value is to be set.
|
|
702 |
* @param aSetting The setting which value is to be set
|
|
703 |
* @return none
|
|
704 |
*/
|
|
705 |
void SetDefaultSecurityL(const TDesC8& aObject,
|
|
706 |
const TNSmlEmailSettingsElement* aThisElem,
|
|
707 |
const TNSmlEmailSecuritySetting aSetting
|
|
708 |
) const;
|
|
709 |
|
|
710 |
/**
|
|
711 |
* Fetches the parameters related to STARTTLS and SSL/TLS
|
|
712 |
* @param aObject The storage for the value
|
|
713 |
* @param aElem The element of which value is fetched.
|
|
714 |
* @param aSetting The setting which value is fetched.
|
|
715 |
* @return Status of the operation
|
|
716 |
*/
|
|
717 |
CSmlDmAdapter::TError FetchSecurityValueL(CBufBase& aObject,
|
|
718 |
const TNSmlEmailSettingsElement* aElem,
|
|
719 |
const TNSmlEmailSecuritySetting aSetting ) const;
|
|
720 |
|
|
721 |
/**
|
|
722 |
* Creates the mapping for the email account preset
|
|
723 |
* @param aURI The whole URI
|
|
724 |
* @return the luid of the email account specified im aURI, else -1
|
|
725 |
*/
|
|
726 |
TInt ConstructTreeL(const TDesC8& aURI);
|
|
727 |
|
|
728 |
/**
|
|
729 |
* The function extracts Email/x node from aURI
|
|
730 |
* @param aURI Email aURI.
|
|
731 |
* @return Email/x node.
|
|
732 |
*/
|
|
733 |
TPtrC8 GetDynamicEmailNodeUri( const TDesC8& aURI );
|
|
734 |
|
|
735 |
private:
|
|
736 |
// Pointer to CMsvSession
|
|
737 |
CMsvSession* iMsvSession;
|
|
738 |
// The buffer for received commands
|
|
739 |
CArrayFixFlat<TNSmlEmailSettingsElement>* iBuffer;
|
|
740 |
};
|
|
741 |
|
|
742 |
#endif // __NSMLDMEMAILADAPTER_H__
|
|
743 |
|
|
744 |
// End of File
|