|
1 /* |
|
2 * Copyright (c) 2006 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: Email Interface base implementation header file. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __BASEPLUGIN_H__ |
|
20 #define __BASEPLUGIN_H__ |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "CFSMailPlugin.h" |
|
26 #include "mmrorganizer.h" |
|
27 |
|
28 //<cmail> |
|
29 #include "MsgStoreFolderUtils.h" |
|
30 #include "MsgStoreMailBox.h" |
|
31 #include "MsgStoreMailBoxObserver.h" |
|
32 #include "MsgStoreMessage.h" |
|
33 #include "MsgStoreObserver.h" |
|
34 #include "DebugLogMacros.h" |
|
35 //</cmail> |
|
36 |
|
37 #include "BaseMrInfoObject.h" |
|
38 #include "Map.h" |
|
39 |
|
40 |
|
41 class CMsgStore; |
|
42 |
|
43 class CBaseMrInfoProcessor; |
|
44 class TDayOfWeekFtor; |
|
45 class CFetchRequester; |
|
46 class CMailboxInfo; |
|
47 class CSearchHandler; |
|
48 class HMailIterator; |
|
49 class CDelayedOpsManager; |
|
50 class MDelayedOpsManager; |
|
51 |
|
52 |
|
53 /** |
|
54 * Notes for derived classes: |
|
55 * GetPluginId - you must override this to return the ECOM id of the plugin. |
|
56 */ |
|
57 class CBasePlugin : |
|
58 public CFSMailPlugin, |
|
59 public MMsgStoreObserver, |
|
60 protected MMsgStoreMailBoxObserver |
|
61 |
|
62 { |
|
63 friend class HMailIterator; |
|
64 friend class CBaseMrInfoProcessor; |
|
65 friend class CMailboxInfo; |
|
66 friend class CSearchHandler; |
|
67 //there is a need for a better way to access internal plugin state by |
|
68 //private components. |
|
69 friend class CDelayedDeleteMessagesOp; |
|
70 friend class CDelayedSetContentOp; |
|
71 |
|
72 protected: |
|
73 struct TOngoingFetchInfo; |
|
74 struct TCacheLine |
|
75 { |
|
76 CMsgStoreMessage* iMsg; |
|
77 CMsgStoreMessagePart* iBody; |
|
78 RPointerArray<CMsgStoreMessagePart> iMsgChildren; |
|
79 RPointerArray<CMsgStoreMessagePart> iBodyChildren; |
|
80 }; |
|
81 |
|
82 public: |
|
83 static CBasePlugin* NewL(); |
|
84 static CBasePlugin* NewLC(); |
|
85 IMPORT_C virtual ~CBasePlugin(); |
|
86 protected: |
|
87 IMPORT_C CBasePlugin(); |
|
88 IMPORT_C void ConstructL(); |
|
89 |
|
90 // CFSMailPlugin // |
|
91 public: |
|
92 |
|
93 IMPORT_C virtual void ListMailBoxesL( |
|
94 RArray<TFSMailMsgId>& aMailboxes ); |
|
95 |
|
96 IMPORT_C virtual CFSMailBox* GetMailBoxByUidL( |
|
97 const TFSMailMsgId& aMailBox); |
|
98 |
|
99 IMPORT_C virtual void DeleteMailBoxByUidL( |
|
100 const TFSMailMsgId& aMailBoxId, |
|
101 MFSMailRequestObserver& aOperationObserver, |
|
102 const TInt aRequestId ); |
|
103 |
|
104 IMPORT_C virtual TDesC& GetBrandingIdL( |
|
105 const TFSMailMsgId& aMailboxId ); |
|
106 |
|
107 IMPORT_C virtual void MoveMessagesL( |
|
108 const TFSMailMsgId& aMailBoxId, |
|
109 const RArray<TFSMailMsgId>& aMessageIds, |
|
110 const TFSMailMsgId& aSourceFolderId, |
|
111 const TFSMailMsgId& aDestinationFolderId ); |
|
112 |
|
113 IMPORT_C virtual void CopyMessagesL( |
|
114 const TFSMailMsgId& aMailBoxId, |
|
115 const RArray<TFSMailMsgId>& aMessageIds, |
|
116 RArray<TFSMailMsgId>& aNewMessages, |
|
117 const TFSMailMsgId& aSourceFolderId, |
|
118 const TFSMailMsgId& aDestinationFolderId ); |
|
119 |
|
120 IMPORT_C MDesCArray* GetMrusL( |
|
121 const TFSMailMsgId& aMailBoxId ); |
|
122 |
|
123 IMPORT_C void SetMrusL( |
|
124 const TFSMailMsgId& aMailBoxId, |
|
125 MDesCArray* aNewMruList ); |
|
126 |
|
127 IMPORT_C void GoOnlineL( |
|
128 const TFSMailMsgId& aMailBoxId ); |
|
129 |
|
130 IMPORT_C void GoOfflineL( |
|
131 const TFSMailMsgId& aMailBoxId ); |
|
132 |
|
133 IMPORT_C const TFSProgress GetLastSyncStatusL( |
|
134 const TFSMailMsgId& aMailBoxId ); |
|
135 |
|
136 IMPORT_C void RefreshNowL( |
|
137 const TFSMailMsgId& aMailBoxId, |
|
138 MFSMailRequestObserver& aOperationObserver, |
|
139 TInt aRequestId ); |
|
140 |
|
141 IMPORT_C virtual CFSMailFolder* GetFolderByUidL( |
|
142 const TFSMailMsgId& aMailBoxId, |
|
143 const TFSMailMsgId& aFolderId ); |
|
144 |
|
145 IMPORT_C virtual CFSMailFolder* CreateFolderL( |
|
146 const TFSMailMsgId& aMailBoxId, |
|
147 const TFSMailMsgId& aFolderId, |
|
148 const TDesC& aFolderName, |
|
149 const TBool aSync ); |
|
150 |
|
151 IMPORT_C virtual void DeleteFolderByUidL( |
|
152 const TFSMailMsgId& aMailBox, |
|
153 const TFSMailMsgId& aFolder ); |
|
154 |
|
155 IMPORT_C virtual void ListFoldersL( |
|
156 const TFSMailMsgId& aMailBoxId, |
|
157 const TFSMailMsgId& aFolderId, |
|
158 RPointerArray<CFSMailFolder>& aFolderList ); |
|
159 |
|
160 IMPORT_C virtual void ListFoldersL( |
|
161 const TFSMailMsgId& aMailBoxId, |
|
162 RPointerArray<CFSMailFolder>& aFolderList ); |
|
163 |
|
164 IMPORT_C virtual TFSMailMsgId GetStandardFolderIdL( |
|
165 const TFSMailMsgId& aMailBoxId, |
|
166 const TFSFolderType aFolderType ); |
|
167 |
|
168 IMPORT_C virtual MFSMailIterator* ListMessagesL( |
|
169 const TFSMailMsgId& aMailBoxId, |
|
170 const TFSMailMsgId& aFolderId, |
|
171 const TFSMailDetails aDetails, |
|
172 const RArray<TFSMailSortCriteria>& aSorting ); |
|
173 |
|
174 IMPORT_C virtual CFSMailMessage* GetMessageByUidL( |
|
175 const TFSMailMsgId& aMailBoxId, |
|
176 const TFSMailMsgId& aFolderId, |
|
177 const TFSMailMsgId& aMessageId, |
|
178 const TFSMailDetails aDetails ); |
|
179 |
|
180 /** |
|
181 * The delete is executed asynchronously. The base plugin will queue |
|
182 * the request and return immediately. |
|
183 */ |
|
184 IMPORT_C virtual void DeleteMessagesByUidL( |
|
185 const TFSMailMsgId& aMailBoxId, |
|
186 const TFSMailMsgId& aFolderId, |
|
187 const RArray<TFSMailMsgId>& aMessages ); |
|
188 |
|
189 IMPORT_C virtual CFSMailMessage* CreateMessageToSendL( |
|
190 const TFSMailMsgId& aMailBox ); |
|
191 |
|
192 IMPORT_C virtual CFSMailMessage* CreateForwardMessageL( |
|
193 const TFSMailMsgId& aMailBox, |
|
194 const TFSMailMsgId& aOriginal, |
|
195 const TDesC& aHeaderDescriptor ); |
|
196 |
|
197 IMPORT_C virtual CFSMailMessage* CreateReplyMessageL( |
|
198 const TFSMailMsgId& aMailBoxId, |
|
199 const TFSMailMsgId& aOriginalMessageId, |
|
200 const TBool aReplyToAll, |
|
201 const TDesC& aHeaderDescriptor ); |
|
202 |
|
203 IMPORT_C virtual void StoreMessageL( |
|
204 const TFSMailMsgId& aMailBoxId, |
|
205 CFSMailMessage& aMessage ); |
|
206 |
|
207 IMPORT_C virtual void FetchMessagesL( |
|
208 const TFSMailMsgId& aMailBoxId, |
|
209 const TFSMailMsgId& aFolderId, |
|
210 const RArray<TFSMailMsgId>& aMessageIds, |
|
211 TFSMailDetails aDetails, |
|
212 MFSMailRequestObserver& aObserver, |
|
213 TInt aRequestId ); |
|
214 |
|
215 IMPORT_C virtual void FetchMessagePartsL( |
|
216 const TFSMailMsgId& aMailBoxId, |
|
217 const TFSMailMsgId& aFolderId, |
|
218 const TFSMailMsgId& aMessageId, |
|
219 const RArray<TFSMailMsgId>& aMessagePartIds, |
|
220 MFSMailRequestObserver& aOperationObserver, |
|
221 const TInt aRequestId, |
|
222 const TUint aPreferredByteCount ); |
|
223 |
|
224 IMPORT_C virtual void GetMessagesL( |
|
225 const TFSMailMsgId& aMailBoxId, |
|
226 const TFSMailMsgId& aParentFolderId, |
|
227 const RArray<TFSMailMsgId>& aMessageIds, |
|
228 RPointerArray<CFSMailMessage>& aMessageList, |
|
229 TFSMailDetails aDetails ); |
|
230 |
|
231 IMPORT_C virtual void ChildPartsL( |
|
232 const TFSMailMsgId& aMailBoxId, |
|
233 const TFSMailMsgId& aParentFolderId, |
|
234 const TFSMailMsgId& aMessageId, |
|
235 const TFSMailMsgId& aParentId, |
|
236 RPointerArray<CFSMailMessagePart>& aParts ); |
|
237 |
|
238 IMPORT_C virtual CFSMailMessagePart* NewChildPartL( |
|
239 const TFSMailMsgId& aMailBoxId, |
|
240 const TFSMailMsgId& aParentFolderId, |
|
241 const TFSMailMsgId& aMessageId, |
|
242 const TFSMailMsgId& aParentPartId, |
|
243 const TFSMailMsgId& aInsertBefore, |
|
244 const TDesC& aContentType ); |
|
245 |
|
246 IMPORT_C virtual CFSMailMessagePart* CopyMessageAsChildPartL( |
|
247 const TFSMailMsgId& aMailBoxId, |
|
248 const TFSMailMsgId& aParentFolderId, |
|
249 const TFSMailMsgId& aMessageId, |
|
250 const TFSMailMsgId& aParentPartId, |
|
251 const TFSMailMsgId& aInsertBefore, |
|
252 const CFSMailMessage& aMessage ); |
|
253 |
|
254 IMPORT_C virtual void RemoveChildPartL( |
|
255 const TFSMailMsgId& aMailBoxId, |
|
256 const TFSMailMsgId& aParentFolderId, |
|
257 const TFSMailMsgId& aMessageId, |
|
258 const TFSMailMsgId& aParentPartId, |
|
259 const TFSMailMsgId& aPartId ); |
|
260 |
|
261 IMPORT_C virtual void SetPartContentFromFileL( |
|
262 const TFSMailMsgId& aMailBoxId, |
|
263 const TFSMailMsgId& aParentFolderId, |
|
264 const TFSMailMsgId& aMessageId, |
|
265 const TFSMailMsgId& aMessagePartId, |
|
266 const TDesC& aFilePath ); |
|
267 |
|
268 IMPORT_C virtual void StoreMessagePartL( |
|
269 const TFSMailMsgId& aMailBoxId, |
|
270 const TFSMailMsgId& aParentFolderId, |
|
271 const TFSMailMsgId& aMessageId, |
|
272 CFSMailMessagePart& aMessagePart ); |
|
273 |
|
274 IMPORT_C virtual CFSMailMessagePart* MessagePartL( |
|
275 const TFSMailMsgId& aMailBoxId, |
|
276 const TFSMailMsgId& aParentFolderId, |
|
277 const TFSMailMsgId& aMessageId, |
|
278 const TFSMailMsgId& aMessagePartId ); |
|
279 |
|
280 IMPORT_C virtual TInt GetMessagePartFileL( |
|
281 const TFSMailMsgId& aMailBoxId, |
|
282 const TFSMailMsgId& aParentFolderId, |
|
283 const TFSMailMsgId& aMessageId, |
|
284 const TFSMailMsgId& aMessagePartId, |
|
285 RFile& aFileHandle ); |
|
286 |
|
287 IMPORT_C virtual void CopyMessagePartFileL( |
|
288 const TFSMailMsgId& aMailBoxId, |
|
289 const TFSMailMsgId& aParentFolderId, |
|
290 const TFSMailMsgId& aMessageId, |
|
291 const TFSMailMsgId& aMessagePartId, |
|
292 const TDesC& aFilePath ); |
|
293 |
|
294 IMPORT_C virtual void GetContentToBufferL( |
|
295 const TFSMailMsgId& aMailBoxId, |
|
296 const TFSMailMsgId& aParentFolderId, |
|
297 const TFSMailMsgId& aMessageId, |
|
298 const TFSMailMsgId& aMessagePartId, |
|
299 TDes& aBuffer, |
|
300 TUint aStartOffset ); |
|
301 |
|
302 IMPORT_C virtual void SetContentL( |
|
303 const TDesC& aBuffer, |
|
304 const TFSMailMsgId& aMailBoxId, |
|
305 const TFSMailMsgId& aParentFolderId, |
|
306 const TFSMailMsgId& aMessageId, |
|
307 const TFSMailMsgId& aMessagePartId); |
|
308 |
|
309 IMPORT_C virtual void RemovePartContentL( |
|
310 const TFSMailMsgId& aMailBoxId, |
|
311 const TFSMailMsgId& aParentFolderId, |
|
312 const TFSMailMsgId& aMessageId, |
|
313 const RArray<TFSMailMsgId>& aPartIds ); |
|
314 |
|
315 IMPORT_C virtual void SearchL( |
|
316 const TFSMailMsgId& aMailBoxId, |
|
317 const RArray<TFSMailMsgId>& aFolderIds, |
|
318 const RPointerArray<TDesC>& aSearchStrings, |
|
319 const TFSMailSortCriteria& aSortCriteria, |
|
320 MFSMailBoxSearchObserver& aSearchObserver ); |
|
321 |
|
322 IMPORT_C virtual void CancelSearch( |
|
323 const TFSMailMsgId& aMailBoxId ); |
|
324 |
|
325 IMPORT_C virtual void ClearSearchResultCache( |
|
326 const TFSMailMsgId& aMailBoxId ); |
|
327 |
|
328 IMPORT_C virtual void AddObserverL( |
|
329 MFSMailEventObserver& aObserver ); |
|
330 |
|
331 IMPORT_C virtual void RemoveObserver( |
|
332 MFSMailEventObserver& aObserver ); |
|
333 |
|
334 IMPORT_C virtual void UnregisterRequestObserver( |
|
335 TInt aRequestId ); |
|
336 |
|
337 IMPORT_C virtual void SendMessageL( |
|
338 CFSMailMessage& aMessage ); |
|
339 |
|
340 IMPORT_C virtual TFSProgress StatusL( |
|
341 TInt aRequestId ); |
|
342 |
|
343 IMPORT_C virtual void CancelL( |
|
344 TInt aRequestId ); |
|
345 |
|
346 IMPORT_C virtual void SubscribeMailboxEventsL( |
|
347 const TFSMailMsgId& aMailboxId, |
|
348 MFSMailEventObserver& aObserver ); |
|
349 |
|
350 IMPORT_C virtual void UnsubscribeMailboxEvents( |
|
351 const TFSMailMsgId& aMailboxId, |
|
352 MFSMailEventObserver& aObserver ); |
|
353 |
|
354 IMPORT_C virtual TSSMailSyncState CurrentSyncState( |
|
355 const TFSMailMsgId& aMailboxId ); |
|
356 |
|
357 IMPORT_C virtual TFSMailBoxStatus GetMailBoxStatus( |
|
358 const TFSMailMsgId& aMailboxId ); |
|
359 |
|
360 IMPORT_C virtual TBool MailboxHasCapabilityL( |
|
361 TFSMailBoxCapabilities aCapability, |
|
362 TFSMailMsgId aMailBoxId ); |
|
363 |
|
364 /** |
|
365 * Create a new ChildPart using a file path |
|
366 */ |
|
367 IMPORT_C virtual CFSMailMessagePart* NewChildPartFromFileL( |
|
368 const TFSMailMsgId& aMailBoxId, |
|
369 const TFSMailMsgId& aParentFolderId, |
|
370 const TFSMailMsgId& aMessageId, |
|
371 const TFSMailMsgId& aParentPartId, |
|
372 const TDesC& aContentType, |
|
373 const TDesC& aFilePath ); |
|
374 |
|
375 /** |
|
376 * Create a new ChildPart using a file handle |
|
377 * NOTE 1: RFs.ShareProtected() must have been called already before calling this method. |
|
378 * NOTE 2: The ownersip of the RFile handle (aFile) is transferred to this method. |
|
379 */ |
|
380 IMPORT_C virtual CFSMailMessagePart* NewChildPartFromFileL( |
|
381 const TFSMailMsgId& aMailBoxId, |
|
382 const TFSMailMsgId& aParentFolderId, |
|
383 const TFSMailMsgId& aMessageId, |
|
384 const TFSMailMsgId& aParentPartId, |
|
385 const TDesC& aContentType, |
|
386 RFile& aFile ); |
|
387 |
|
388 IMPORT_C virtual TInt WizardDataAvailableL(); |
|
389 |
|
390 IMPORT_C virtual void AuthenticateL( |
|
391 MFSMailRequestObserver& aOperationObserver, |
|
392 TInt aRequestId ); |
|
393 |
|
394 IMPORT_C virtual void SetCredentialsL( |
|
395 const TFSMailMsgId& aMailBoxId, |
|
396 const TDesC& aUsername, |
|
397 const TDesC& aPassword ); |
|
398 |
|
399 IMPORT_C virtual TInt CancelSyncL( |
|
400 const TFSMailMsgId& aMailBoxId ); |
|
401 |
|
402 IMPORT_C virtual void SetMailboxName( |
|
403 const TFSMailMsgId& /*aMailboxId*/, |
|
404 const TDesC& /*aMailboxName*/ ); |
|
405 |
|
406 // MMsgStoreObserver // |
|
407 public: |
|
408 IMPORT_C virtual void SystemEventNotify( |
|
409 TMsgStoreSystemEvent aEvent ); |
|
410 |
|
411 IMPORT_C virtual void AccountEventNotify( |
|
412 TMsgStoreAccountEvent aEvent, |
|
413 TInt32 aOwnerId, |
|
414 const TDesC& aName, |
|
415 const TDesC& aNewName, |
|
416 TMsgStoreId aMailboxId ); |
|
417 |
|
418 IMPORT_C virtual void ModificationNotify( |
|
419 TMsgStoreId aMailBoxId, |
|
420 TMsgStoreOperation aOperation, |
|
421 TMsgStoreContainerType aType, |
|
422 TUint32 aFlags, |
|
423 TMsgStoreId aId, |
|
424 TMsgStoreId aParentId, |
|
425 TMsgStoreId aOtherId ); |
|
426 |
|
427 protected: |
|
428 |
|
429 IMPORT_C CFSMailAddress* FetchEmailAddressL( |
|
430 CMsgStorePropertyContainer& aMessage, |
|
431 TUint aIdx ); |
|
432 |
|
433 IMPORT_C CMailboxInfo& GetMailboxInfoL( |
|
434 TMsgStoreId aId ); |
|
435 |
|
436 void GetMailboxDisplayNameL( |
|
437 TMsgStoreId aId, |
|
438 RBuf& aDisplayName ); |
|
439 |
|
440 IMPORT_C virtual TUint GetPluginId(); |
|
441 |
|
442 /** |
|
443 * Get signature string from protocol specific subclass. |
|
444 * Caller is responsible for memory of returned string. |
|
445 */ |
|
446 virtual HBufC* GetSignatureL( TFSMailMsgId /* aMailBox */ ) |
|
447 { |
|
448 return NULL; |
|
449 } |
|
450 |
|
451 /** |
|
452 * Get reply-to address from protocol specific subclass. |
|
453 * Caller is responsible for memory of returned string. |
|
454 */ |
|
455 virtual HBufC* GetReplyToAddressL( TFSMailMsgId /* aMailBox */ ) |
|
456 { |
|
457 return NULL; |
|
458 } |
|
459 |
|
460 /** |
|
461 * Get MailBox address from protocol specific subclass. |
|
462 * Caller is responsible for memory of returned string. |
|
463 */ |
|
464 virtual HBufC* GetMailBoxAddressL( TFSMailMsgId /*aMailBox*/ ) |
|
465 { |
|
466 return NULL; |
|
467 } |
|
468 |
|
469 |
|
470 IMPORT_C virtual void TranslateMsgStorePropsL( |
|
471 const TFSMailMsgId& aMailBoxId, |
|
472 CMsgStorePropertyContainer& aMessage, |
|
473 CFSMailMessagePart& aFsMsg, |
|
474 const TFSMailDetails aDetails = EFSMsgDataEnvelope ); |
|
475 |
|
476 /** |
|
477 * Translates common message store meeting requests into Freestyle mr info |
|
478 * objects. |
|
479 * Sync plugins might be interested in extending the default behavior. |
|
480 */ |
|
481 IMPORT_C virtual void TranslateMsgStoreMrL( |
|
482 const TFSMailMsgId& aMailBoxId, |
|
483 CMsgStorePropertyContainer& aMessage, |
|
484 CMsgStorePropertyContainer& aCalendar, |
|
485 CFSMailMessagePart& aFsMsg ); |
|
486 |
|
487 /** |
|
488 * Translates a message in Freestyle format to the common Message Store |
|
489 * format. Does not store the destination's properties in the msgstore. |
|
490 * The caller must call StorePropertiesL when necessary. This way writes |
|
491 * to the message store can be minimized. |
|
492 * |
|
493 * @param aSrc input/source Freestyle message. |
|
494 * @param aDst output/destination MessageStore message. |
|
495 */ |
|
496 IMPORT_C virtual void TranslateEmailFwMessageL( |
|
497 CFSMailMessagePart& aSrc, |
|
498 CMsgStoreMessagePart& aDst, |
|
499 TBool aInInbox ); |
|
500 |
|
501 IMPORT_C virtual void TranslateEmailFwMrL( |
|
502 MMRInfoObject& aSrc, |
|
503 CMsgStorePropertyContainer& aDst ); |
|
504 |
|
505 IMPORT_C void TranslateEmailFwAttendeeL( |
|
506 MMROrganizer& aSrc, |
|
507 RMsgStoreAddress& aDst ); |
|
508 |
|
509 void DoListFoldersL( |
|
510 TFSMailMsgId aMailBoxId, |
|
511 TMsgStoreId aFolderId, |
|
512 TBool aRecursive, |
|
513 RPointerArray<CFSMailFolder>& aFolderList ); |
|
514 |
|
515 void NotifyEventL( |
|
516 TMsgStoreId aMailBoxId, |
|
517 TMsgStoreId aId, |
|
518 TMsgStoreId aParentId, |
|
519 TFSMailEvent aFsEvent, |
|
520 TMsgStoreId aOtherId = KMsgStoreInvalidId ); |
|
521 |
|
522 void NotifyGlobalEventL( |
|
523 TFSMailEvent aEvent, |
|
524 TFSMailMsgId aMailBox = TFSMailMsgId(), |
|
525 TAny* aParam1 = NULL, |
|
526 TAny* aParam2 = NULL, |
|
527 TAny* aParam3 = NULL ); |
|
528 |
|
529 IMPORT_C virtual void NotifyMailboxEventL( |
|
530 TFSMailEvent aEvent, |
|
531 TFSMailMsgId aMailBox, |
|
532 TAny* aParam1 = NULL, |
|
533 TAny* aParam2 = NULL, |
|
534 TAny* aParam3 = NULL ); |
|
535 |
|
536 /** |
|
537 * Tries to find a body part of the specified content type. By default |
|
538 * looks for the text/plain part. |
|
539 * @return the main body text part or NULL if one can not be found. |
|
540 */ |
|
541 IMPORT_C CMsgStoreMessagePart* GetBodyPartL( |
|
542 CMsgStoreMessage& aMessage, |
|
543 const TDesC& aContentType = KFSMailContentTypeTextPlain() ); |
|
544 |
|
545 /** |
|
546 * Creates a forward/reply message via copying the original, using sender(s) as |
|
547 * recipient(s). |
|
548 * |
|
549 * @param aHeaderDescriptor packaged TReplyForwardParams that provide the message |
|
550 * quote header and the smart reply label that needs to be inserted in case of a |
|
551 * truncated message. |
|
552 * @param aKeepAttachments true if the original message attachments are to be kept. |
|
553 */ |
|
554 IMPORT_C CFSMailMessage* CreateForwardReplyMessageL( |
|
555 const TFSMailMsgId& aMailBox, |
|
556 const TFSMailMsgId& aOriginal, |
|
557 const TBool aReplyToAll, |
|
558 const TDesC& aHeaderDescriptor, |
|
559 TBool aKeepAttachments, |
|
560 TBool aKeepMeetingRequestInfo = ETrue ); |
|
561 |
|
562 /** |
|
563 * Recursively looks for the part with id aPartId in the part container |
|
564 * aParent. |
|
565 */ |
|
566 IMPORT_C CMsgStoreMessagePart* FindMessagePartL( |
|
567 CMsgStoreMessagePart& aParent, |
|
568 TMsgStoreId aPartId ); |
|
569 |
|
570 /** |
|
571 * Get MsgStore account object for the specified mailbox id. |
|
572 */ |
|
573 IMPORT_C CMsgStoreAccount* GetAccountForMsgBoxL( |
|
574 const TFSMailMsgId& aMailboxId ); |
|
575 |
|
576 /** |
|
577 * Create a MR reply message. |
|
578 */ |
|
579 IMPORT_C virtual CFSMailMessage* CreateMrReplyMessageL( |
|
580 const TFSMailMsgId& aMailBoxId, |
|
581 MMRInfoObject& aMeetingRequest, |
|
582 const TFSMailMsgId& aOriginalMessageId ); |
|
583 |
|
584 /** |
|
585 * Applyed when an account was deleted for proper cleanup. |
|
586 */ |
|
587 IMPORT_C virtual void HandleMailboxDeleteL( |
|
588 const TFSMailMsgId& aMailboxId ); |
|
589 |
|
590 |
|
591 protected: |
|
592 |
|
593 void SystemEventNotifyL( |
|
594 TMsgStoreSystemEvent aEvent ); |
|
595 |
|
596 void AccountEventNotifyL( |
|
597 TMsgStoreAccountEvent aEvent, |
|
598 TInt32 aOwnerId, |
|
599 const TDesC& aName, |
|
600 const TDesC& aNewName, |
|
601 TMsgStoreId aMailboxId ); |
|
602 |
|
603 void ModificationNotifyL( |
|
604 TMsgStoreId aMailBoxId, |
|
605 TMsgStoreOperation aOperation, |
|
606 TMsgStoreContainerType aType, |
|
607 TUint32 aFlags, |
|
608 TMsgStoreId aId, |
|
609 TMsgStoreId aParentId, |
|
610 TMsgStoreId aOtherId ); |
|
611 |
|
612 void TranslateMsgStoreDayOfWeek( |
|
613 TUint32 aDayOfWeekMask, |
|
614 TDayOfWeekFtor& aFtor ); |
|
615 |
|
616 void TranslateEmailFwDayOfWeek( |
|
617 MRRecurrenceRule::TMRRecurrentDay aSrc, |
|
618 TUint32& aDst ); |
|
619 |
|
620 void TranslateEmailFwRecipientsL( |
|
621 CMsgStoreMessagePart& aDst, |
|
622 const TDesC8& aDstProperty, |
|
623 RPointerArray<CFSMailAddress>& aRecipients ); |
|
624 |
|
625 IMPORT_C static void RemoveAllPropertiesL( |
|
626 CMsgStorePropertyContainer& aContainer, |
|
627 const TDesC8& aName ); |
|
628 |
|
629 IMPORT_C CMailboxInfo& RefreshMailboxCacheL( TMsgStoreId aMailBoxId ); |
|
630 |
|
631 void UnsubscribeMailboxEventsL( |
|
632 const TFSMailMsgId& aMailboxId, |
|
633 MFSMailEventObserver& aObserver ); |
|
634 |
|
635 /** |
|
636 * Children should overload to call CFSMailFolderBase::BlockMoveFromL() |
|
637 * and CFSMailFolderBase::BlockCopyFromL() for the CFSMailFolder |
|
638 */ |
|
639 virtual void BlockCopyMoveFromFoldersL( |
|
640 TFSMailMsgId /*aFolderId*/, |
|
641 TFSFolderType /*aFolderType*/, |
|
642 CFSMailFolder& /*aFSMailFolder*/ ) |
|
643 { |
|
644 // do nothing |
|
645 } |
|
646 |
|
647 void DoCancelSearchL( |
|
648 const TFSMailMsgId& aMailBoxId ); |
|
649 |
|
650 void DoClearSearchResultCacheL( |
|
651 const TFSMailMsgId& aMailBoxId ); |
|
652 |
|
653 /** |
|
654 * Helper method to avoid duplicated code |
|
655 */ |
|
656 CFSMailMessagePart* NewChildPartFromFilePathOrHandleL( |
|
657 const TFSMailMsgId& aMailBoxId, |
|
658 const TFSMailMsgId& aParentFolderId, |
|
659 const TFSMailMsgId& aMessageId, |
|
660 const TFSMailMsgId& aParentPartId, |
|
661 const TDesC& aContentType, |
|
662 const TDesC& aFilePath, |
|
663 TBool aUseFileHandle, |
|
664 RFile& aFile ); |
|
665 |
|
666 /** |
|
667 * Called by RemovePartContentL for each part that needs its content removed. |
|
668 */ |
|
669 IMPORT_C virtual void HandleRemovePartContentL( |
|
670 CMsgStoreMessage& aMsg, |
|
671 CMsgStoreMessagePart& aPart ); |
|
672 |
|
673 /** |
|
674 * When replying or forwarding a message determine the "To:" field's value. |
|
675 */ |
|
676 void SetReplyOrForwardToFieldL( CMsgStoreMessage& newMsg ); |
|
677 |
|
678 |
|
679 /** |
|
680 * Used to refresh the cached mailbox display name, which can be changed by the user. The name |
|
681 * is cached along with other mailbox info so that we can tell when it's changed in the message |
|
682 * store and only notify the UI when such a change occurs. |
|
683 * |
|
684 * @param aMailBoxNameHasChanged - used to return to the caller if a change is detected. |
|
685 * @param aMailBoxId - the ID of the mailbox |
|
686 */ |
|
687 void RefreshCachedMailBoxDisplayNameL( TBool& aMailBoxNameHasChanged, const TMsgStoreId& aMailBoxId ); |
|
688 |
|
689 IMPORT_C virtual void ReportRequestStatusL( |
|
690 TMsgStoreId aMailBox, |
|
691 TMsgStoreId aOtherId, |
|
692 TMsgStoreId aMsgId, |
|
693 TMsgStoreId aPartId, |
|
694 TBool aCanReportCompletion = EFalse ); |
|
695 |
|
696 /** |
|
697 * Finds the corresponding download request object for the part with id |
|
698 * of aPartId identified by also the mailbox and the message ids. |
|
699 */ |
|
700 IMPORT_C TBool FindFetchRequestL( |
|
701 TMsgStoreId aMailBox, |
|
702 TMsgStoreId aOtherId, |
|
703 TMsgStoreId aMsgId, |
|
704 TMsgStoreId aPartId, |
|
705 CBasePlugin::TOngoingFetchInfo& aOngoingFetchInfo ); |
|
706 |
|
707 IMPORT_C TBool DeleteFetchRequestForPart( |
|
708 TOngoingFetchInfo& aFetchInfo ); |
|
709 |
|
710 IMPORT_C void DeleteFetchRequest( |
|
711 TOngoingFetchInfo& aFetchInfo ); |
|
712 |
|
713 |
|
714 protected: |
|
715 IMPORT_C void ResetCache(); |
|
716 |
|
717 IMPORT_C void ResetBodyCache(); |
|
718 |
|
719 /** |
|
720 * This method retrieves the specified message store message from a |
|
721 * cache or directly from the message store if not cached. If the |
|
722 * message was retrieved from the message store it is put into the |
|
723 * cache. The lifetime of the message is managed by the cache but if a |
|
724 * plugin makes a modification that would make the cached message |
|
725 * invalid it must call the ResetCache method. |
|
726 * |
|
727 * @param aMailBoxId |
|
728 * @param aMsgId |
|
729 */ |
|
730 IMPORT_C CMsgStoreMessage* GetCachedMsgL( |
|
731 TMsgStoreId aMailBoxId, |
|
732 TMsgStoreId aMsgId ); |
|
733 |
|
734 IMPORT_C CMsgStoreMessagePart* GetCachedBodyL( |
|
735 TMsgStoreId aPartId ); |
|
736 |
|
737 IMPORT_C RPointerArray<CMsgStoreMessagePart>& GetCachedMsgChildrenL(); |
|
738 |
|
739 IMPORT_C RPointerArray<CMsgStoreMessagePart>& GetCachedBodyChildrenL(); |
|
740 |
|
741 IMPORT_C void InvalidateCacheIfNecessary( |
|
742 TMsgStoreId aId, |
|
743 TMsgStoreId aParentId, |
|
744 TMsgStoreId aOtherId ); |
|
745 |
|
746 public: |
|
747 |
|
748 /** |
|
749 * Direct message sending that does not require having a FW message |
|
750 * instance. The FW's SendMessageL method internally uses this method |
|
751 * after translating the FW message to the MsgStore format. |
|
752 */ |
|
753 IMPORT_C void SendMessageL( |
|
754 CMsgStoreMailBox& aMailBox, |
|
755 CMsgStoreMessage& aMsg, |
|
756 const TTime& aSentTime ); |
|
757 |
|
758 /** |
|
759 * The delayed ops manager is used to queue asynchronous processing of |
|
760 * plugin requests. |
|
761 */ |
|
762 IMPORT_C MDelayedOpsManager& GetDelayedOpsManager(); |
|
763 |
|
764 protected: |
|
765 |
|
766 CMsgStore* iMsgStore; |
|
767 RMap<TInt64, CMailboxInfo> iMailboxes; |
|
768 |
|
769 //does not actually own the observers. |
|
770 RPointerArray<MFSMailEventObserver> iObservers; |
|
771 //async fetch reqs. |
|
772 RPointerArray<CFetchRequester> iReqs; |
|
773 |
|
774 TCacheLine iCacheLine; |
|
775 |
|
776 private: |
|
777 |
|
778 MDelayedOpsManager* iDelayedOpsManager; |
|
779 |
|
780 /** |
|
781 * Descriptor for an ongoing part(attachment) fetch operation. |
|
782 */ |
|
783 struct TOngoingFetchInfo |
|
784 { |
|
785 CFetchRequester* iRequest; |
|
786 TInt iPartIndex; |
|
787 TMsgStoreId iMessageId; |
|
788 TInt iRequestIndex; |
|
789 |
|
790 TOngoingFetchInfo() : |
|
791 iRequest( NULL ), |
|
792 iPartIndex( KErrNotFound ), |
|
793 iMessageId( KMsgStoreInvalidId ), |
|
794 iRequestIndex( 0 ) |
|
795 { } |
|
796 }; |
|
797 |
|
798 __LOG_DECLARATION |
|
799 }; |
|
800 |
|
801 |
|
802 /** |
|
803 * There is mailbox-related state information that is used to bind |
|
804 * the FSEF representation and the MsgStore one. This entity groups |
|
805 * it in one place. |
|
806 */ |
|
807 class CMailboxInfo : public CBase |
|
808 { |
|
809 public: |
|
810 CMailboxInfo( CBasePlugin* aBasePlugin ) |
|
811 : iBasePlugin( aBasePlugin ) |
|
812 { |
|
813 } |
|
814 |
|
815 virtual ~CMailboxInfo() |
|
816 { |
|
817 iMailBox->RemoveObserverL( iBasePlugin ); |
|
818 iObservers.Close(); |
|
819 |
|
820 delete iMailBoxName; |
|
821 delete iMailBoxDisplayName; |
|
822 delete iBrandingId; |
|
823 delete iMailBox; |
|
824 }; |
|
825 |
|
826 CMsgStoreMailBox& operator() () |
|
827 { |
|
828 return *iMailBox; |
|
829 } |
|
830 |
|
831 public: |
|
832 CMsgStoreMailBox* iMailBox; |
|
833 HBufC* iMailBoxName; |
|
834 HBufC* iMailBoxDisplayName; |
|
835 HBufC* iBrandingId; |
|
836 //does not actually own the observers. |
|
837 RPointerArray<MFSMailEventObserver> iObservers; |
|
838 CBasePlugin* iBasePlugin; |
|
839 |
|
840 TMsgStoreRootFolders iRootFolders; |
|
841 }; |
|
842 |
|
843 |
|
844 /** |
|
845 * Asynchronous attachment/body fetch descriptor. |
|
846 */ |
|
847 /**@ move to separate unit.*/ |
|
848 NONSHARABLE_CLASS (CFetchRequester) : public CBase |
|
849 { |
|
850 friend class CBasePlugin; |
|
851 |
|
852 public: |
|
853 static CFetchRequester* NewL( |
|
854 CBasePlugin& aPlugin, |
|
855 const TFSMailMsgId& aMailBoxId, |
|
856 const TFSMailMsgId& iMessageId, |
|
857 const RArray<TFSMailMsgId>& aMessages, |
|
858 MFSMailRequestObserver& aObserver, |
|
859 TInt aRequestId ); |
|
860 |
|
861 virtual ~CFetchRequester(); |
|
862 |
|
863 private: |
|
864 CFetchRequester( |
|
865 CBasePlugin& aPlugin, |
|
866 const TFSMailMsgId& aMailBoxId, |
|
867 const TFSMailMsgId& iMessageId, |
|
868 MFSMailRequestObserver& aObserver, |
|
869 TInt aRequestId ); |
|
870 void ConstructL( const RArray<TFSMailMsgId>& aMessages ); |
|
871 |
|
872 private: |
|
873 CBasePlugin& iPlugin; |
|
874 public: |
|
875 RArray<TFSMailMsgId> iParts; |
|
876 MFSMailRequestObserver& iObserver; |
|
877 TFSMailMsgId iMailBoxId; |
|
878 TFSMailMsgId iMessageId; |
|
879 TInt iRequestId; |
|
880 |
|
881 __LOG_DECLARATION |
|
882 }; |
|
883 |
|
884 #endif // __BASEPLUGIN_H__ |