|
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 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 @released |
|
22 */ |
|
23 |
|
24 #if !defined(__POPSMTM_H__) |
|
25 #define __POPSMTM_H__ |
|
26 |
|
27 #include <e32base.h> |
|
28 |
|
29 #include <mtsr.h> |
|
30 #include <offop.h> |
|
31 #include <pop3set.h> |
|
32 |
|
33 #include <msvstd.h> |
|
34 #include <pops.h> |
|
35 #include "mimmobileserver.h" |
|
36 #include <tnonoperationmtmdata.h> |
|
37 |
|
38 // Forward declarations |
|
39 class CImPop3RefreshMailBox; |
|
40 class CImPop3CopyMove; |
|
41 class CImPop3Delete; |
|
42 class CImPop3TopPopulate; |
|
43 class CPopSessionManager; |
|
44 class CImMobilityManager; |
|
45 |
|
46 #if (defined SYMBIAN_USER_PROMPT_SERVICE) |
|
47 class CPopUpsResponseWaiter; |
|
48 #endif |
|
49 |
|
50 // |
|
51 // CImppServerMtm |
|
52 // |
|
53 // |
|
54 // POP3 server MTM |
|
55 // package buffer for progress info. |
|
56 typedef TPckgBuf<TPop3Progress> TPop3ProgressBuf; |
|
57 |
|
58 _LIT(KImPopsMTMResourcePath,"c:\\system\\data\\imcv.r01"); |
|
59 |
|
60 // |
|
61 // Forward declarations |
|
62 class CImPop3Settings; |
|
63 class CImOffLineOperation; |
|
64 class CImPop3OfflineOperationFinder; |
|
65 class CImPop3SetOfflineOps; |
|
66 class CImLogMessage; |
|
67 // |
|
68 // |
|
69 |
|
70 // |
|
71 // CImppServerMtm |
|
72 // |
|
73 class CImppServerMtm : public CBaseServerMtm, public MImMobileServer |
|
74 { |
|
75 public: |
|
76 enum TPopOpStopType |
|
77 { |
|
78 EPopStopOpBearerLost, |
|
79 EPopStopOpImmediate, |
|
80 EPopStopOpNormal |
|
81 }; |
|
82 |
|
83 IMPORT_C static CImppServerMtm* NewL(CRegisteredMtmDll& aPopServerMtmDll, |
|
84 CMsvServerEntry* aEntry); |
|
85 // mobility API from MImMobileServer |
|
86 void PrepareForNewCarrier(TImMobilityAction aAction, TBool aIsSeamless); |
|
87 void CarrierLost(); |
|
88 void NewCarrierActive(TAccessPointInfo aNewAp, TBool aIsSeamless); |
|
89 void MobilityError(TUint aError); |
|
90 virtual const TDesC8& MobilityProgress(); |
|
91 |
|
92 ~CImppServerMtm(); |
|
93 // |
|
94 void CopyFromLocalL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aStatus); |
|
95 void CopyToLocalL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aStatus); |
|
96 void CopyWithinServiceL(const CMsvEntrySelection& aSelection,TMsvId aDestination, TRequestStatus& aStatus); |
|
97 void DeleteAllL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus); |
|
98 void CreateL(TMsvEntry aNewEntry, TRequestStatus& aStatus); |
|
99 void ChangeL(TMsvEntry aNewEntry, TRequestStatus& aStatus); |
|
100 // |
|
101 void StartCommandL(CMsvEntrySelection& aSelection, TInt aCommand, const TDesC8& aParameter, TRequestStatus& aStatus); |
|
102 // |
|
103 const TDesC8& Progress(); |
|
104 |
|
105 TBool CommandExpected(); |
|
106 // |
|
107 void MoveToLocalL(const CMsvEntrySelection& aSelection,TMsvId aDestination, TRequestStatus& aStatus); |
|
108 void MoveFromLocalL(const CMsvEntrySelection& aSelection,TMsvId aDestination, TRequestStatus& aStatus); |
|
109 void MoveWithinServiceL(const CMsvEntrySelection& aSelection,TMsvId aDestination, TRequestStatus& aStatus); |
|
110 |
|
111 protected: |
|
112 TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1); |
|
113 |
|
114 private: |
|
115 enum TImppCopyMethod |
|
116 { |
|
117 EImppCopy, |
|
118 EImppMove, |
|
119 EImppPopulate |
|
120 }; |
|
121 |
|
122 CImppServerMtm(CRegisteredMtmDll& aPopServerMtmDll, CMsvServerEntry* aEntry); |
|
123 void ConstructL(); |
|
124 |
|
125 void DoCancel(); |
|
126 void DoRunL(); |
|
127 void DoComplete(TInt aError); |
|
128 |
|
129 void DoCancelCurrentOp(); |
|
130 |
|
131 void CheckMailboxStateL(); |
|
132 void DoConnectL(TRequestStatus& aStatus, CMsvEntrySelection& aSelection); |
|
133 void DoRefreshL(); |
|
134 void DoCopyMoveL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aStatus, TImppCopyMethod aCopyMethod); |
|
135 void DoQuitL(TRequestStatus& aStatus); |
|
136 void DoTopPopulateL(const CMsvEntrySelection& aSelection, TInt aLimit, TRequestStatus& aStatus); |
|
137 |
|
138 void GetPopDetailsL(const CMsvEntrySelection& aSel); |
|
139 void QueueRemoteCleanup(); // tidy up if anything goes wrong with refresh |
|
140 |
|
141 void ResetProgress(); |
|
142 |
|
143 // Called from DoRun() sets TMsvEntry visible flag for each POP3 child. |
|
144 void DoShowMessagesL( TBool aHide); |
|
145 void CommandComplete( TInt aErrorCode ); |
|
146 CMsvEntrySelection* StripInvalidEntriesLC(const CMsvEntrySelection& aSelection,TBool aExcludePartial=EFalse) const; |
|
147 void FindFirstOfflineOperationL(TBool aQuitting); |
|
148 inline void RunOfflineOperationL(); |
|
149 inline TBool AcceptingOfflineOperationsL(const CMsvEntrySelection& aSelection); |
|
150 void AddOfflineOperationL(const CMsvEntrySelection& aSelection, TMsvId aDestination, CImOffLineOperation::TOffLineOpType aOperationType, TRequestStatus& aStatus); |
|
151 void CancelOfflineOperationsL(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus); |
|
152 |
|
153 TBool PruneMessages(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus); |
|
154 void GetSystemProgress(TMsvSystemProgress& aSysProg); |
|
155 void GetProgress(); |
|
156 |
|
157 TBool StartBearerMobilityL(TInt aError); |
|
158 void CancelToMigrate(); |
|
159 void CompleteCurrentOpForMigration(); |
|
160 void StopCurrentOpForMigration(); |
|
161 TBool DoMigrationRunL(); |
|
162 void DisconnectForMigrate(); |
|
163 void RestartAfterMigrateL(); |
|
164 void StoreConfigurationToMigrateL(); |
|
165 TInt GetNonOperationMtmData(TNonOperationMtmDataType aMtmDataType, TPtrC8& aMtmDataBuffer); |
|
166 |
|
167 private: |
|
168 |
|
169 enum TPopsMtmState |
|
170 { |
|
171 EPopConnecting, |
|
172 EPopRefreshing, |
|
173 EPopCopying, |
|
174 EPopMoving, |
|
175 EPopDeleting, |
|
176 EPopQuitting, |
|
177 EPopTidying, |
|
178 EPopConnectedAndIdle, |
|
179 EPopDisconnected, |
|
180 EPopPopulating, |
|
181 EPopAddingOfflineOp, |
|
182 EPopFindingFirstOfflineOp, |
|
183 EPopCancellingOfflineOps, |
|
184 EPopTopPopulating, |
|
185 EPopAuthoriseAndConnect |
|
186 }; |
|
187 |
|
188 enum TPopMigrateState |
|
189 { |
|
190 ENotMigrating, |
|
191 EWaitingForOpToStop, |
|
192 EWaitingForOpToComplete, |
|
193 EDisconnectingForMigrate, |
|
194 EWaitingForNewCarrier, |
|
195 EWaitingCarrierRejected, |
|
196 EConnectingAfterMigrate |
|
197 }; |
|
198 |
|
199 struct TImPop3Status |
|
200 { |
|
201 TBool iQuitting; |
|
202 TBool iRunningOfflineOperations; |
|
203 TPopsMtmState iCurrentOperation; |
|
204 TPopsMtmState iLastCurrentOperation; |
|
205 }; |
|
206 |
|
207 struct TPopSavedValuesForMigration |
|
208 { |
|
209 TInt32* iMessageArray; |
|
210 TInt iNumMessages; |
|
211 TBool iValuesSaved; |
|
212 }; |
|
213 |
|
214 TImPop3Status iState; |
|
215 TPopMigrateState iMigrationState; |
|
216 TBool iCancelForBMMigration; |
|
217 TPopSavedValuesForMigration iSavedValuesForMigration; |
|
218 |
|
219 CImPop3Session* iPopSession; |
|
220 CImPop3RefreshMailBox* iPopRefreshMailbox; |
|
221 CImPop3CopyMove* iPopCopyMove; |
|
222 CImPop3Delete* iPopDelete; |
|
223 CImPop3TopPopulate* iPopTopPop; |
|
224 |
|
225 CArrayFixFlat<TMsvId>* iMsvIdArray; // stores any failed refresh msgs |
|
226 TInt iArrayCtr; |
|
227 TRequestStatus* iReportStatus; |
|
228 // Pop3 settings |
|
229 CImPop3Settings* iPopSettings; |
|
230 CImIAPPreferences* iIAPPreferences; |
|
231 |
|
232 TPop3Progress iPopProgress; |
|
233 TPop3ProgressBuf iPopProgressBuf; |
|
234 |
|
235 TBool iConnectedToPopMbox; |
|
236 TBool iOperationActive; |
|
237 |
|
238 TMsvId iServiceId; |
|
239 TUint iPort; |
|
240 TInt iDoCallShowMessages; |
|
241 |
|
242 TInt iCurrentOfflineOp; |
|
243 CImPop3OfflineOperationFinder* iOfflineOpFinder; |
|
244 CImPop3SetOfflineOps* iOfflineOpSetter; |
|
245 CImLogMessage* iLogMessage; |
|
246 |
|
247 CMsvEntrySelection* iMessagesToKeep; |
|
248 TBool iNotConnectToPopMailBox ; |
|
249 #if (defined SYMBIAN_USER_PROMPT_SERVICE) |
|
250 /** For interaction with UPS server */ |
|
251 TThreadId iClientThreadId; |
|
252 TBool iHasCapability; |
|
253 CPopUpsResponseWaiter* iWaiter; |
|
254 #endif |
|
255 |
|
256 CImMobilityManager* iMobilityManager; |
|
257 |
|
258 CPopSessionManager* iSessionManager; |
|
259 |
|
260 TNonOperationMtmDataAccessPointIdBuffer iMtmDataAccessPointIdBuffer; |
|
261 |
|
262 }; |
|
263 |
|
264 #endif |