|
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 // popservermtm module header |
|
15 // @internalComponent |
|
16 // @released |
|
17 // |
|
18 // |
|
19 |
|
20 #ifndef __POPSRFSH_H__ |
|
21 #define __POPSRFSH_H__ |
|
22 |
|
23 #include <pop3set.h> |
|
24 #include <imsk.h> |
|
25 |
|
26 class CImPop3Session; |
|
27 class CImPop3RefreshOperation; |
|
28 class CImTextServerSession; |
|
29 class CImPop3UidlMap; |
|
30 class CImPop3Stat; |
|
31 class CImPop3List; |
|
32 class CImPop3Uidl; |
|
33 class CImPop3Top; |
|
34 class CImPop3Retr; |
|
35 class CImPop3Capa; |
|
36 class CImRecvConvert; |
|
37 |
|
38 // |
|
39 // CImPop3RefreshMailBox |
|
40 // |
|
41 // Changes the modes for CImPop3RefreshOperation depending on |
|
42 // operation failures, |
|
43 // |
|
44 // CImPop3RefreshMailBox was the original name of CImPop3RefreshOperation |
|
45 // This version is written to trap a Leave while downloading equal UIDLs |
|
46 // and re-run CImPop3RefreshOperation skiping UIDL downloading. (BFSW1-2016) |
|
47 // |
|
48 // The public section is left to be exactly the same as the original |
|
49 // CImPop3RefreshOperation structure. |
|
50 // |
|
51 // |
|
52 // |
|
53 class CImPop3RefreshMailBox : public CMsgActive |
|
54 { |
|
55 private : |
|
56 enum TState { |
|
57 EPop3RefreshBoxDefault, |
|
58 EPop3RefreshBoxTop, |
|
59 EPop3RefreshBoxPurgeInput |
|
60 }; |
|
61 public: |
|
62 static CImPop3RefreshMailBox* NewL(CMsvServerEntry&, CImPop3Session&, RFs&); |
|
63 ~CImPop3RefreshMailBox(); |
|
64 void Start(TRequestStatus& aStatus, CArrayFixFlat<TMsvId>* aMsgIdArray); |
|
65 |
|
66 TPop3Progress Progress(); |
|
67 |
|
68 void SetMessagesToKeepL(const CMsvEntrySelection* aMessagesToKeep); |
|
69 |
|
70 TUint RemoteMessageSizeL(TMsvId aId); |
|
71 void Pause(); |
|
72 void ResumeL(CImPop3Session* aPopSession, TRequestStatus& aStatus); |
|
73 void CancelAllowResume(); |
|
74 |
|
75 private: |
|
76 CImPop3RefreshMailBox(CImPop3Session& aPopSession); |
|
77 |
|
78 void ConstructL(CMsvServerEntry&, RFs&); |
|
79 |
|
80 void DoRunL(); |
|
81 void DoCancel(); |
|
82 void ChangeStateL(TState aState); |
|
83 |
|
84 private : |
|
85 TState iState; |
|
86 CImPop3RefreshOperation* iRefreshOperation; |
|
87 CImTextServerSession* iTextServer; |
|
88 CImPop3Session& iPopSession; |
|
89 TImMailBuffer iTextServerResponse; |
|
90 |
|
91 TBufC8<3> iFullStopTerminator; |
|
92 CArrayFixFlat <TMsvId>* iMsvIdArray; |
|
93 TBool iMigratingToNewBearer; |
|
94 }; |
|
95 |
|
96 // |
|
97 // CImPop3RefreshOperation |
|
98 // |
|
99 // |
|
100 // Performs a refresh email sink |
|
101 // |
|
102 class CImPop3RefreshOperation : public CMsgActive |
|
103 { |
|
104 public: |
|
105 static CImPop3RefreshOperation *NewL(CMsvServerEntry&, CImPop3Session*, RFs&); |
|
106 ~CImPop3RefreshOperation(); |
|
107 void Start(TRequestStatus& aStatus, CArrayFixFlat<TMsvId>* aMsvIdArray); |
|
108 void Start(TRequestStatus& aStatus); |
|
109 |
|
110 TPop3Progress Progress(); |
|
111 |
|
112 void SetMessagesToKeepL(const CMsvEntrySelection* aMessagesToKeep); |
|
113 TUint RemoteMessageSizeL(TMsvId aId); |
|
114 void Pause(); |
|
115 void ResumeL(CImPop3Session* aPopSession, TRequestStatus& aStatus); |
|
116 void CancelAllowResume(); |
|
117 |
|
118 private: |
|
119 enum TState { |
|
120 EPopRefreshSyncCollection, |
|
121 EPopRefreshStat, |
|
122 EPopRefreshList, |
|
123 EPopRefreshUidl, |
|
124 EPopRefreshSyncUidl, |
|
125 EPopRefreshGetHeader, |
|
126 EPopRefreshDeleteDeadMessages, |
|
127 EPopRefreshComplete, |
|
128 EPopRefreshDeleteExcessMessages, |
|
129 EPopMigratingBearer |
|
130 }; |
|
131 |
|
132 class TMsgUidlStore |
|
133 { |
|
134 public: |
|
135 void ExternalizeL(RWriteStream& aStream) const; |
|
136 public: |
|
137 enum {EInvalid=-1,EPresent=-2}; |
|
138 public: |
|
139 HBufC8* iPopId; |
|
140 TMsvId iMsvId; |
|
141 TUint iRemoteSize; |
|
142 // |
|
143 TInt iSelectionPos; // transient member |
|
144 }; |
|
145 |
|
146 private: |
|
147 CImPop3RefreshOperation(CMsvServerEntry&, CImPop3Session*, RFs&); |
|
148 void ConstructL(); |
|
149 |
|
150 void ChangeStateL(TState aState); // the state machine engine |
|
151 void ChangeStateForMigrate(TState aState); |
|
152 TInt SelectNextState(); |
|
153 |
|
154 void DoRunL(); |
|
155 void DoComplete(TInt&); |
|
156 void DoCancel(); |
|
157 |
|
158 void AllocateArraysL(); |
|
159 void GetNoMessagesL(); |
|
160 void GetMsgSizesL(); |
|
161 void GetMsgUidlsL(); |
|
162 void GetCapabilitiesL(); |
|
163 |
|
164 void DeleteUidl(TInt anIndex); |
|
165 |
|
166 void RetrieveHeadersL(); |
|
167 |
|
168 void GetHeaderByIndexL(TInt); |
|
169 void GetMessageByIndexL(TInt); |
|
170 |
|
171 void CreateNewHeaderEntryL(TMsvEntry& aNewEntry); |
|
172 void GetRemoteMessagesL(); |
|
173 void QueueRemoteUpdate(); // will be asynch |
|
174 void SyncCollectionL(); |
|
175 void CompleteSyncCollection(); |
|
176 void SyncUidlL(); |
|
177 |
|
178 TBool CompareIdAndSizeL(); |
|
179 TBool GetMessagesIfAny(); |
|
180 |
|
181 void OpenUidlFileL(); |
|
182 void CreateUidlFileL(); |
|
183 |
|
184 void RefreshFinishedL(); |
|
185 |
|
186 TBool CanDeleteEntry(const TMsvEmailEntry& aEntry) const; |
|
187 |
|
188 private: |
|
189 TState iState; |
|
190 TUint iNoMessages; |
|
191 TUint iMboxSize; |
|
192 TInt32* iIdTab; |
|
193 TUint* iSize; |
|
194 CArrayFixFlat<TMsvId>* iNewMsg; |
|
195 TPtrC8 iImMsgId; |
|
196 |
|
197 TInt iRemoteArrayCtr; |
|
198 CImPop3UidlMap* iPop3Uidls; |
|
199 CArrayFix<TMsgUidlStore>* iUidlArray; |
|
200 TKeyArrayFix iUidlKey; |
|
201 |
|
202 CMsvServerEntry& iRemoteServerEntry; |
|
203 CMsvServerEntry* iLocalEntry; |
|
204 CMsvEntrySelection* iMsvSelection; |
|
205 |
|
206 CImPop3Session* iPopSession; |
|
207 CImPop3Stat* iPopStat; |
|
208 CImPop3List* iPopList; |
|
209 CImPop3Uidl* iPopUidl; |
|
210 CImPop3Top* iPopTop; |
|
211 CImPop3Retr* iPopRetr; |
|
212 |
|
213 CImRecvConvert* iRecvConverter; |
|
214 RArray <TInt> iUniqueUidlPosArray; |
|
215 RArray <TInt> iTemporaryUidlPosArray; |
|
216 TInt iPreviousIndex; |
|
217 |
|
218 TInt iMsgCtr; |
|
219 RFs& iFs; |
|
220 |
|
221 TMsvId iRemoteId; |
|
222 |
|
223 TPop3Progress iProgress; |
|
224 TMsvEntry iEntry; |
|
225 |
|
226 // flags for existence of UIDL / TOP command |
|
227 TBool iUidlExists; |
|
228 TBool iTopExists; |
|
229 TBool iFirstCallToTop; |
|
230 TBool iEmptyHeaders; |
|
231 // array of unwanted entries |
|
232 CMsvEntrySelection* iUnwantedEntries; |
|
233 |
|
234 TInt iCheckDiskSpaceCounter; |
|
235 TInt iCurrentDrive; |
|
236 |
|
237 TInt iLastHeaderToGet; |
|
238 TInt iRemoteArraySize; |
|
239 |
|
240 CMsvEntrySelection* iMessagesToKeep; |
|
241 |
|
242 TBool iPipeliningSupported; |
|
243 TBool iMigratingToNewBearer; |
|
244 }; |
|
245 #endif |