13 * |
13 * |
14 * Description: IMAP4 connect operation |
14 * Description: IMAP4 connect operation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
|
19 |
|
20 #include "emailtrace.h" |
18 #include "emailtrace.h" |
21 #include "ipsplgheaders.h" |
19 #include "ipsplgheaders.h" |
22 |
20 |
23 // Constants and defines |
21 // <qmail> remove priority const |
24 const TInt KConnectOpPriority = CActive::EPriorityStandard; |
|
25 |
22 |
26 // ---------------------------------------------------------------------------- |
23 // ---------------------------------------------------------------------------- |
27 // CIpsPlgDisconnectOp::NewL() |
24 // CIpsPlgDisconnectOp::NewL() |
28 // ---------------------------------------------------------------------------- |
25 // ---------------------------------------------------------------------------- |
29 // |
26 // <qmail> aDoRemoveAfterDisconnect parameter removed |
|
27 // <qmail> MFSMailRequestObserver& changed to pointer |
30 CIpsPlgDisconnectOp* CIpsPlgDisconnectOp::NewL( |
28 CIpsPlgDisconnectOp* CIpsPlgDisconnectOp::NewL( |
31 CMsvSession& aMsvSession, |
29 CMsvSession& aMsvSession, |
32 TRequestStatus& aObserverRequestStatus, |
30 TRequestStatus& aObserverRequestStatus, |
33 TMsvId aService, |
31 TMsvId aService, |
34 CIpsPlgTimerOperation& aActivityTimer, |
32 CIpsPlgTimerOperation& aActivityTimer, |
35 TFSMailMsgId aFSMailBoxId, |
33 TFSMailMsgId aFSMailBoxId, |
36 MFSMailRequestObserver& aFSOperationObserver, |
34 MFSMailRequestObserver* aFSOperationObserver, |
37 TInt aFSRequestId, |
35 TInt aFSRequestId ) |
38 TBool aDoRemoveAfterDisconnect ) |
36 { |
39 { |
37 FUNC_LOG; |
40 FUNC_LOG; |
38 // <qmail> aDoRemoveAfterDisconnect removed |
41 CIpsPlgDisconnectOp* op = new(ELeave) CIpsPlgDisconnectOp(aMsvSession, |
39 CIpsPlgDisconnectOp* op = new(ELeave) CIpsPlgDisconnectOp( |
|
40 aMsvSession, |
42 aObserverRequestStatus, |
41 aObserverRequestStatus, |
43 aService, |
42 aService, |
44 aActivityTimer, |
43 aActivityTimer, |
45 aFSMailBoxId, |
44 aFSMailBoxId, |
46 aFSOperationObserver, |
45 aFSOperationObserver, |
47 aFSRequestId, |
46 aFSRequestId ); |
48 aDoRemoveAfterDisconnect ); |
|
49 |
47 |
50 CleanupStack::PushL(op); |
48 CleanupStack::PushL(op); |
51 op->ConstructL(); |
49 op->ConstructL(); |
52 CleanupStack::Pop( op ); |
50 CleanupStack::Pop( op ); |
53 return op; |
51 return op; |
121 result.iError = iStatus.Int(); |
119 result.iError = iStatus.Int(); |
122 } |
120 } |
123 return result; |
121 return result; |
124 } |
122 } |
125 |
123 |
126 // ---------------------------------------------------------------------------- |
124 // <qmail> Connected() moved to base class |
127 // CIpsPlgDisconnectOp::Connected() |
125 |
128 // ---------------------------------------------------------------------------- |
126 // ---------------------------------------------------------------------------- |
129 // |
127 |
130 TBool CIpsPlgDisconnectOp::Connected() const |
|
131 { |
|
132 FUNC_LOG; |
|
133 return iTEntry.Connected(); |
|
134 } |
|
135 |
|
136 // ---------------------------------------------------------------------------- |
|
137 // CIpsPlgDisconnectOp::DoRunL() |
128 // CIpsPlgDisconnectOp::DoRunL() |
138 // ---------------------------------------------------------------------------- |
129 // ---------------------------------------------------------------------------- |
139 // |
130 // |
140 void CIpsPlgDisconnectOp::DoRunL() |
131 void CIpsPlgDisconnectOp::DoRunL() |
141 { |
132 { |
142 FUNC_LOG; |
133 FUNC_LOG; |
143 if( !iDisconnected ) |
134 // <qmail> |
|
135 if( Connected() ) |
144 { |
136 { |
145 DoDisconnectL(); |
137 DoDisconnectL(); |
146 iDisconnected = ETrue; |
138 // </qmail> |
147 } |
139 } |
148 else |
140 else |
149 { |
141 { |
150 if ( iDoRemoveAfterDisconnect ) |
142 // <qmail> iDoRemoveAfterDisconnect feature from this op has been removed |
151 { |
|
152 CIpsSetDataApi* settings = CIpsSetDataApi::NewL( iMsvSession ); |
|
153 CleanupStack::PushL( settings ); |
|
154 settings->RemoveAccountL( iTEntry, iMsvSession ); |
|
155 CleanupStack::PopAndDestroy( settings ); |
|
156 |
|
157 // delete the activitytimer here and set it to null so we don't try |
|
158 // to use it in CompleteObserver. This is a special case that |
|
159 // relates to deleting a connected mailbox. |
|
160 delete iActivityTimer; |
|
161 iActivityTimer = NULL; |
|
162 } |
|
163 |
|
164 CompleteObserver( KErrNone ); |
143 CompleteObserver( KErrNone ); |
165 } |
144 } |
166 } |
145 } |
167 |
146 |
168 // ---------------------------------------------------------------------------- |
147 // ---------------------------------------------------------------------------- |
169 // CIpsPlgDisconnectOp::CIpsPlgDisconnectOp() |
148 // CIpsPlgDisconnectOp::CIpsPlgDisconnectOp() |
170 // ---------------------------------------------------------------------------- |
149 // ---------------------------------------------------------------------------- |
171 // |
150 // <qmail> aDoRemoveAfterDisconnect removed |
|
151 // <qmail> MFSMailRequestObserver& changed to pointer |
172 CIpsPlgDisconnectOp::CIpsPlgDisconnectOp( |
152 CIpsPlgDisconnectOp::CIpsPlgDisconnectOp( |
173 CMsvSession& aMsvSession, |
153 CMsvSession& aMsvSession, |
174 TRequestStatus& aObserverRequestStatus, |
154 TRequestStatus& aObserverRequestStatus, |
175 TMsvId aServiceId, |
155 TMsvId aServiceId, |
176 CIpsPlgTimerOperation& aActivityTimer, |
156 CIpsPlgTimerOperation& aActivityTimer, |
177 TFSMailMsgId aFSMailBoxId, |
157 TFSMailMsgId aFSMailBoxId, |
178 MFSMailRequestObserver& aFSOperationObserver, |
158 MFSMailRequestObserver* aFSOperationObserver, |
179 TInt aFSRequestId, |
159 TInt aFSRequestId ) |
180 TBool aDoRemoveAfterDisconnect ) |
|
181 : |
160 : |
182 CIpsPlgOnlineOperation( |
161 CIpsPlgOnlineOperation( |
183 aMsvSession, |
162 aMsvSession, |
184 KConnectOpPriority, |
163 aObserverRequestStatus, |
185 aObserverRequestStatus, |
164 aActivityTimer, |
186 aActivityTimer, |
165 aFSMailBoxId, |
187 aFSMailBoxId, |
166 aFSOperationObserver, |
188 aFSOperationObserver, |
167 aFSRequestId ) |
189 aFSRequestId), |
|
190 iDoRemoveAfterDisconnect( aDoRemoveAfterDisconnect ) |
|
191 { |
168 { |
192 iService = aServiceId; |
169 iService = aServiceId; |
193 } |
170 } |
194 |
171 |
195 // ---------------------------------------------------------------------------- |
172 // ---------------------------------------------------------------------------- |
212 { |
189 { |
213 //should we panic with own codes? |
190 //should we panic with own codes? |
214 User::Leave( KErrNotSupported ); |
191 User::Leave( KErrNotSupported ); |
215 } |
192 } |
216 |
193 |
|
194 // <qmail> SetActive(); moved inside CompleteThis(); |
|
195 CompleteThis(); |
|
196 } |
|
197 |
|
198 // ---------------------------------------------------------------------------- |
|
199 // CIpsPlgDisconnectOp::DoDisconnectL() |
|
200 // ---------------------------------------------------------------------------- |
|
201 // |
|
202 void CIpsPlgDisconnectOp::DoDisconnectL() |
|
203 { |
|
204 FUNC_LOG; |
|
205 iStatus = KRequestPending; |
|
206 NM_COMMENT("CIpsPlgDisconnectOp: doing disconnect"); |
|
207 TInt cmd = (iTEntry.iMtm == KUidMsgTypePOP3) ? KPOP3MTMDisconnect : KIMAP4MTMDisconnect; |
|
208 InvokeClientMtmAsyncFunctionL( cmd, iService ); // <qmail> 1 param removed |
217 SetActive(); |
209 SetActive(); |
218 CompleteThis(); |
210 } |
219 } |
211 |
220 |
212 // <qmail> adding this func |
221 // ---------------------------------------------------------------------------- |
213 // ---------------------------------------------------------------------------- |
222 // CIpsPlgDisconnectOp::DoDisconnectL() |
214 // ---------------------------------------------------------------------------- |
223 // ---------------------------------------------------------------------------- |
215 // |
224 // |
216 TIpsOpType CIpsPlgDisconnectOp::IpsOpType() const |
225 void CIpsPlgDisconnectOp::DoDisconnectL() |
217 { |
226 { |
218 FUNC_LOG; |
227 FUNC_LOG; |
219 if ( iTEntry.iMtm == KUidMsgTypePOP3 ) |
228 iStatus = KRequestPending; |
220 { |
229 |
221 return EIpsOpTypePop3Disconnect; |
230 TInt cmd = (iTEntry.iMtm == KUidMsgTypePOP3) ? KPOP3MTMDisconnect : KIMAP4MTMDisconnect; |
222 } |
231 |
223 else |
232 InvokeClientMtmAsyncFunctionL(cmd, iService, iService); |
224 { |
233 SetActive(); |
225 return EIpsOpTypeImap4Disconnect; |
234 } |
226 } |
235 |
227 } |
|
228 // </qmail> |
|
229 |