|
1 // Copyright (c) 2006-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 #ifndef __CIMAPMAILSTORE_H__ |
|
17 #define __CIMAPMAILSTORE_H__ |
|
18 |
|
19 #define _MSVAPI_DONT_INCLUDE_FLOGGER_ |
|
20 |
|
21 #include <msvapi.h> |
|
22 #include <msventry.h> |
|
23 #include <miuthdr.h> |
|
24 #include "cimapsettings.h" |
|
25 #include "cfetchbodyinfo.h" |
|
26 |
|
27 //Forward declarations |
|
28 class CQueueEntryBase; |
|
29 class CImHeader; |
|
30 class CImMimeHeader; |
|
31 class CImapCharconvTls; |
|
32 |
|
33 /** |
|
34 Created to enable a session to be created with the messaging framework. Observer not used. |
|
35 @internalComponent |
|
36 @prototype |
|
37 */ |
|
38 class CSessionObserver : public CBase, public MMsvSessionObserver |
|
39 { |
|
40 public: |
|
41 void HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) |
|
42 { |
|
43 } |
|
44 }; |
|
45 |
|
46 /** |
|
47 Observer class used by CQueueEntryBase to call back to into the caller with the result of a |
|
48 storage operation. |
|
49 @internalComponent |
|
50 @prototype |
|
51 */ |
|
52 class MMailStoreObserver |
|
53 { |
|
54 public: |
|
55 //pure virtual member |
|
56 virtual void StoreOperationComplete(TMsvId aId,TInt aErrorCode)=0; |
|
57 }; |
|
58 |
|
59 /** |
|
60 Observer class used by CQueueEntryBase to call back to into the caller when proper chunk is recieved fron server |
|
61 and the chunks are written to the store in order. |
|
62 @internalComponent |
|
63 @prototype |
|
64 */ |
|
65 class MChunkOutOfOrderObserver |
|
66 { |
|
67 public: |
|
68 /** |
|
69 Notify CImapFetchBody to send FETCH command to server, if it was disabled because the client recieved |
|
70 out of order chunks and it reached it maximum buffer capacity(default 3 chunks). |
|
71 */ |
|
72 virtual void EnableSendFetch()=0; |
|
73 }; |
|
74 |
|
75 |
|
76 /** |
|
77 This class provides a public API which implements a wrapper over CMsvStosre and allows clients to make requests to stream data to the message store. |
|
78 The class maintains an array of CQueueEntryBase derived objects that service the requests. |
|
79 @internalComponent |
|
80 @prototype |
|
81 */ |
|
82 class CImapMailStore : public CBase |
|
83 { |
|
84 public: |
|
85 virtual ~CImapMailStore(); |
|
86 IMPORT_C static CImapMailStore* NewL(CMsvServerEntry& aServerEntry); |
|
87 IMPORT_C void StorePartL(CImHeader* aHeader,TMsvId aId,MMailStoreObserver& aObserver); |
|
88 IMPORT_C void StorePartL(CImMimeHeader* aHeader,TMsvId aId, MMailStoreObserver& aObserver); |
|
89 IMPORT_C void InitialiseStoreBody16L(TInt aTotalChunks, CImapSettings& aImapSettings,CFetchBodyInfo& aFetchBodyInfo,TInt aLogId,MMailStoreObserver& aObserver, TBool aBinaryCap=EFalse); |
|
90 IMPORT_C void InitialiseStoreBody8L(TInt aTotalChunks, CImapSettings& aImapSettings,CFetchBodyInfo& aFetchBodyInfo,TInt aLogId,MMailStoreObserver& aObserver, TBool aBinaryCap=EFalse); |
|
91 IMPORT_C void StoreBodyChunk16L(HBufC8* aData,TMsvId aId,TInt aChunkNumber, TInt aExtraFetchRequestCount=0); |
|
92 IMPORT_C void StoreBodyChunk8L(HBufC8* aData,TMsvId aId,TInt aChunkNumber, TInt aExtraFetchRequestCount=0); |
|
93 IMPORT_C void InitialiseStoreAttachmentL(TInt aTotalChunks,CImapSettings& aImapSettings,CFetchBodyInfo& aFetchBodyInfo,TInt aLogId,MMailStoreObserver& aObserver); |
|
94 IMPORT_C void StoreAttachmentChunkL(HBufC8* aData,TMsvId aId,TInt aChunkNumber); |
|
95 IMPORT_C TInt CancelRequest(MMailStoreObserver& aObserver); |
|
96 IMPORT_C TInt CancelRequest(TMsvId aId); |
|
97 IMPORT_C TInt RequestCount()const; |
|
98 IMPORT_C void CreateAttachmentInfoL(TMsvId aId); |
|
99 IMPORT_C void InitialiseStorePlainBodyTextL(TInt aTotalChunks, CImapSettings& aImapSettings, CFetchBodyInfo& aFetchBodyInfo, TInt aLogId, MMailStoreObserver& aObserver, MChunkOutOfOrderObserver& aChunkObserver, TBool aBinaryCap=EFalse); |
|
100 IMPORT_C TBool StorePlainBodyTextL(HBufC8* aData, TMsvId aId, TInt aChunkNumber, TInt aExtraFetchRequestCount=0); |
|
101 void RemoveFromQueueAndDelete(CQueueEntryBase* aQueueEntry); |
|
102 private: |
|
103 void ConstructL(); |
|
104 CImapMailStore(CMsvServerEntry& aServerEntry); |
|
105 static TBool IdsAndTypeMatch(const CQueueEntryBase& aLeft,const CQueueEntryBase& aRight); |
|
106 private: |
|
107 RPointerArray<CQueueEntryBase> iRequestArray; |
|
108 CMsvServerEntry& iServerEntry; |
|
109 }; |
|
110 |
|
111 #endif//__CIMAPMAILSTORE_H__ |