|
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 #define _MSVAPI_DONT_INCLUDE_FLOGGER_ |
|
17 |
|
18 #include <e32std.h> |
|
19 |
|
20 #include "POPSMBX.H" |
|
21 #include "POPS.H" |
|
22 #include "POPSOP.H" //CImPop3Operations |
|
23 #include "POPSMTM.H" |
|
24 |
|
25 // includes for IMCV stuff |
|
26 #include <txtetext.h> |
|
27 #include <txtrich.h> |
|
28 #include <miuthdr.h> |
|
29 #include <imcvrecv.h> |
|
30 // Oyster includes |
|
31 #include <msventry.h> // CMsvServerEntry |
|
32 |
|
33 #include <logwrap.h> |
|
34 #include <logwraplimits.h> |
|
35 |
|
36 #include <s32mem.h> |
|
37 #include <s32file.h> |
|
38 #include <msvapi.h> |
|
39 #include <imcvutil.h> |
|
40 |
|
41 #include "PopsDele.h" |
|
42 #include "PopsCpMv.h" |
|
43 #include "POPS.H" |
|
44 #include "POPSOP.H" //CImPop3Operations |
|
45 #include "popstran.h" |
|
46 #include <msvstore.h> |
|
47 #include "POPS.PAN" // imrc's own panic codes |
|
48 #include "POPSMBX.H" |
|
49 |
|
50 #include "mobilitytestmtmapi.h" |
|
51 |
|
52 |
|
53 // IMRC Panic function |
|
54 GLREF_C void Panic(TPopsPanic aPanic); |
|
55 |
|
56 CImPop3CopyMove::CImPop3CopyMove(CMsvServerEntry& aLocalEntry, CImPop3Session* aPop3Session, TBool aCopy, RFs& anFs, TMsvId aDestinationId, CImLogMessage* aLogMessage, TBool aDisconnectedMode) |
|
57 : CMsgActive( KMsgPop3RefreshMailboxPriority ), iDestination(aLocalEntry), iPopSession(aPop3Session),iCopy(aCopy),iFs(anFs), iDestId(aDestinationId), iPopulate(EFalse), iLogMessage(aLogMessage), iDisconnectedMode(aDisconnectedMode) |
|
58 { |
|
59 } |
|
60 |
|
61 CImPop3CopyMove::CImPop3CopyMove(CMsvServerEntry& aLocalEntry, CImPop3Session* aPop3Session, TBool aCopy, RFs& anFs, CImLogMessage* aLogMessage, TBool aDisconnectedMode) |
|
62 : CMsgActive( KMsgPop3RefreshMailboxPriority ), iDestination(aLocalEntry), iPopSession(aPop3Session),iCopy(aCopy),iFs(anFs), iPopulate(ETrue), iLogMessage(aLogMessage), iDisconnectedMode(aDisconnectedMode) |
|
63 { |
|
64 } |
|
65 |
|
66 CImPop3CopyMove* CImPop3CopyMove::NewL(const CMsvEntrySelection& aRemoteEntry, CMsvServerEntry& aLocalEntry, CImPop3Session* aPop3Session, TBool aCopy, RFs& anFs, TMsvId aServiceId, CImLogMessage* aLogMessage, TBool aDisconnectedMode) |
|
67 { |
|
68 CImPop3CopyMove* self = new (ELeave) CImPop3CopyMove( aLocalEntry, aPop3Session, aCopy, anFs, aServiceId, aLogMessage, aDisconnectedMode); |
|
69 |
|
70 CleanupStack::PushL(self); |
|
71 self->ConstructL(aRemoteEntry); |
|
72 CleanupStack::Pop(); |
|
73 return self; |
|
74 } |
|
75 |
|
76 CImPop3CopyMove* CImPop3CopyMove::NewL(const CMsvEntrySelection& aRemoteEntry, CMsvServerEntry& aLocalEntry, CImPop3Session* aPop3Session, TBool aCopy, RFs& anFs, CImLogMessage* aLogMessage, TBool aDisconnectedMode) |
|
77 // This verion of NewL creates a CImPop3CopyMove for populating entries from the remote mailbox |
|
78 { |
|
79 // Moving does not make sense when populating a message entry from the remote mailbox |
|
80 __ASSERT_DEBUG(aCopy, Panic(EPopFailedDebugAssert)); |
|
81 |
|
82 CImPop3CopyMove* self = new (ELeave) CImPop3CopyMove( aLocalEntry, aPop3Session, aCopy, anFs, aLogMessage, aDisconnectedMode); |
|
83 |
|
84 CleanupStack::PushL(self); |
|
85 self->ConstructL(aRemoteEntry); |
|
86 CleanupStack::Pop(); |
|
87 return self; |
|
88 } |
|
89 |
|
90 void CImPop3CopyMove::ConstructL( const CMsvEntrySelection& aRemoteSelection ) |
|
91 { |
|
92 LeaveIfLowDiskL(aRemoteSelection); |
|
93 iTransfer = CImPop3TransferMessage::NewL(iDestination); |
|
94 |
|
95 // make our copy of aRemoteEntry |
|
96 iSource = aRemoteSelection.CopyL(); |
|
97 iServiceId = iDestination.Entry().Id(); |
|
98 |
|
99 // assume Entry passed in is set to service id (IMCV needs to set new entries to this) |
|
100 iRecvConverter = CImRecvConvert::NewL( iFs, &iDestination, KUidMsgTypePOP3, iServiceId); |
|
101 iRecvConverter->SetCaf(*iPopSession->GetCafL(iFs)); |
|
102 iPopCopyMoveState=EPopCpMvRetrieving; |
|
103 iProcessComplete=EFalse; |
|
104 iMigratingToNewBearer = EFalse; |
|
105 // richtext body which we might or might not need |
|
106 |
|
107 // set recv conv. |
|
108 if (iPopulate) |
|
109 { |
|
110 if (iSource->Count()) |
|
111 { |
|
112 // Set the MIME parser to point at the first message to be populated. |
|
113 iRecvConverter->SetMsvId((*iSource)[0]); |
|
114 } |
|
115 } |
|
116 else |
|
117 { |
|
118 iRecvConverter->SetMsvId(iDestId); |
|
119 } |
|
120 |
|
121 CActiveScheduler::Add(this); // Add CImPop3CopyMove to scheduler's queue |
|
122 } |
|
123 |
|
124 |
|
125 CImPop3CopyMove::~CImPop3CopyMove() |
|
126 { |
|
127 Cancel(); |
|
128 // delete everything here |
|
129 delete iRetrieve; |
|
130 delete iDelete; |
|
131 delete iSource; |
|
132 |
|
133 delete iRecvConverter; |
|
134 |
|
135 delete iTransfer; |
|
136 } |
|
137 |
|
138 |
|
139 void CImPop3CopyMove::LeaveIfLowDiskL(const CMsvEntrySelection& aMsgSelection) |
|
140 { |
|
141 // Get the original destination |
|
142 TMsvEntry destination = iDestination.Entry(); |
|
143 |
|
144 // Get the size of all the messages that need to be downloaded |
|
145 TInt totalMsgsSize = 0; |
|
146 for(TInt i = 0; i < aMsgSelection.Count(); i ++) |
|
147 { |
|
148 iDestination.SetEntry(aMsgSelection.At(i)); |
|
149 if(!iDestination.Entry().Complete()) |
|
150 { |
|
151 totalMsgsSize += iDestination.Entry().iSize; |
|
152 } |
|
153 } |
|
154 |
|
155 // Set the destination back to the original |
|
156 iDestination.SetEntry(destination.Id()); |
|
157 |
|
158 // Get the Free Disk Space |
|
159 TVolumeInfo volumeInfo; |
|
160 TInt currentDrive = MessageServer::CurrentDriveL(iFs); |
|
161 User::LeaveIfError(iFs.Volume(volumeInfo, currentDrive)); |
|
162 |
|
163 // Leave if not enougth Disk Space |
|
164 if (volumeInfo.iFree < (totalMsgsSize + KMinimumDiskSpaceForSync)) |
|
165 { |
|
166 User::Leave(KErrDiskFull); |
|
167 } |
|
168 } |
|
169 |
|
170 // |
|
171 // Cancel any current operation |
|
172 // |
|
173 void CImPop3CopyMove::DoCancel() |
|
174 { |
|
175 iPopSession->SetOpNotPending(); |
|
176 |
|
177 if(iPopCopyMoveState==EPopCpMvRetrieving) |
|
178 { |
|
179 iRetrieve->Cancel(); |
|
180 } |
|
181 else if (iDelete != NULL) |
|
182 { |
|
183 if (iMigratingToNewBearer) |
|
184 { |
|
185 iDelete->CancelAllowResume(); |
|
186 } |
|
187 else |
|
188 { |
|
189 iDelete->Cancel(); |
|
190 } |
|
191 } |
|
192 |
|
193 if (iTransfer != NULL) |
|
194 { |
|
195 iTransfer->Cancel(); |
|
196 } |
|
197 |
|
198 CMsgActive::DoCancel(); |
|
199 } |
|
200 |
|
201 // |
|
202 // |
|
203 // |
|
204 void CImPop3CopyMove::DoComplete(TInt& /*aCompleteStatus*/) |
|
205 { |
|
206 } |
|
207 // |
|
208 // Start me up |
|
209 // |
|
210 void CImPop3CopyMove::StartL(TRequestStatus& aStatus) |
|
211 { |
|
212 iMsgCtr=0; |
|
213 iSavedError = KErrNone; |
|
214 // set up progress obj. |
|
215 iProgress.iTotalMsgs=iSource->Count(); |
|
216 iProgress.iMsgsToProcess=iProgress.iTotalMsgs; |
|
217 |
|
218 // Do a quick tally on the size of messages which are to be copied / moved. |
|
219 iProgress.iTotalSize = 0; |
|
220 for(TInt i = 0; i < iProgress.iTotalMsgs; i ++) |
|
221 { |
|
222 iDestination.SetEntry(iSource->At(i)); |
|
223 if(!iDestination.Entry().Complete()) |
|
224 { |
|
225 iProgress.iTotalSize += iDestination.Entry().iSize; |
|
226 } |
|
227 } |
|
228 |
|
229 delete iRetrieve; |
|
230 iRetrieve=NULL; |
|
231 iRetrieve=CImPop3Retr::NewL(iPopSession,iRecvConverter, iFs); |
|
232 |
|
233 if(iProgress.iTotalMsgs) |
|
234 { |
|
235 DoRetrieveL(); |
|
236 Queue(aStatus); |
|
237 } |
|
238 else |
|
239 { |
|
240 aStatus = KRequestPending; |
|
241 TRequestStatus* pS=&aStatus; |
|
242 User::RequestComplete(pS,KErrNone); |
|
243 } |
|
244 } |
|
245 |
|
246 |
|
247 // ****************************************************************************************** |
|
248 // Resume function called by the POP Server MTM, once it has completed Migrating to new bearer |
|
249 // |
|
250 // ****************************************************************************************** |
|
251 void CImPop3CopyMove::ResumeL(CImPop3Session* aPopSession, TRequestStatus& aStatus) |
|
252 { |
|
253 iMigratingToNewBearer = EFalse; |
|
254 iPopSession = aPopSession; |
|
255 |
|
256 delete iRecvConverter; |
|
257 iRecvConverter = NULL; |
|
258 iRecvConverter = CImRecvConvert::NewL( iFs, &iDestination, KUidMsgTypePOP3, iServiceId); |
|
259 iRecvConverter->SetCaf(*iPopSession->GetCafL(iFs)); |
|
260 |
|
261 if (iPopulate) |
|
262 { |
|
263 if (iSource->Count()) |
|
264 { |
|
265 // Set the MIME parser to point at the first message to be populated. |
|
266 iRecvConverter->SetMsvId((*iSource)[iMsgCtr]); |
|
267 } |
|
268 } |
|
269 else |
|
270 { |
|
271 // Set the folder |
|
272 iRecvConverter->SetMsvId(iDestId); |
|
273 } |
|
274 |
|
275 |
|
276 switch (iPopCopyMoveState) |
|
277 { |
|
278 case EPopCpMvRetrieving: |
|
279 case EPopCpMvLogging: |
|
280 { |
|
281 delete iRetrieve; |
|
282 iRetrieve=NULL; |
|
283 iRetrieve=CImPop3Retr::NewL(iPopSession,iRecvConverter, iFs); |
|
284 |
|
285 // Start retrieving again, from where we had left |
|
286 DoRetrieveL(); |
|
287 break; |
|
288 } |
|
289 case EPopCpMvDeleting: |
|
290 { |
|
291 // set iDestination to service entry so we can delete stuff |
|
292 User::LeaveIfError(iDestination.SetEntry( iServiceId )); |
|
293 |
|
294 iDelete->ResumeL(iPopSession, iStatus); |
|
295 SetActive(); |
|
296 |
|
297 break; |
|
298 } |
|
299 default: |
|
300 { |
|
301 __ASSERT_ALWAYS(EFalse, Panic(EPopUnexpectedMigrateState)); |
|
302 break; |
|
303 } |
|
304 } |
|
305 Queue(aStatus); |
|
306 } |
|
307 |
|
308 |
|
309 // |
|
310 // Function called from DoRunL. |
|
311 // |
|
312 void CImPop3CopyMove::RunLProcessingL() |
|
313 // This function is called and trapped by the DoRunL function. |
|
314 // This allows a logging operation to be carried if it leaves. |
|
315 { |
|
316 TInt err = KErrNone; |
|
317 |
|
318 switch (iPopCopyMoveState) |
|
319 { |
|
320 case EPopCpMvRetrieving: |
|
321 { |
|
322 |
|
323 if(iRetrieveMessage) |
|
324 { |
|
325 if ((!iAlreadyComplete) && (!iMessageMarkedForDelete)) |
|
326 iRecvConverter->MessageCompleteL(); |
|
327 |
|
328 TMsvId msgId=(*iSource)[iMsgCtr]; |
|
329 err = iDestination.SetEntry(msgId); |
|
330 if(err==KErrNone) |
|
331 { |
|
332 TMsvEntry header=iDestination.Entry(); |
|
333 if((header.Unread()) && (!iPopulate)) |
|
334 { |
|
335 header.SetNew(EFalse); |
|
336 err = iDestination.ChangeEntry(header); |
|
337 __ASSERT_DEBUG(err == KErrNone, Panic(EPopFailedDebugAssert)); |
|
338 } |
|
339 err = iDestination.SetEntry(iDestId); // make sure not trying to delete current context |
|
340 if(err!=KErrNone) |
|
341 { |
|
342 User::Leave(KPop3ProblemWithRemotePopServer); |
|
343 } |
|
344 } |
|
345 |
|
346 // If the server replies with "-ERR" command, leave with "KErrNotFound". |
|
347 if(!iRetrieve->PopCommandAccepted()) |
|
348 { |
|
349 User::Leave(KErrNotFound); |
|
350 } |
|
351 } |
|
352 LogFetchedMessageL(); |
|
353 } |
|
354 break; |
|
355 case EPopCpMvLogging: |
|
356 { |
|
357 // If the message has been logged then move on and download the next one. |
|
358 iProgress.iMsgsToProcess--; |
|
359 if(++iMsgCtr<iSource->Count()) |
|
360 { |
|
361 if (iPopulate) |
|
362 // The destination must be changed to the new message when populating |
|
363 { |
|
364 iRecvConverter->ResetL(); |
|
365 iRecvConverter->SetMsvId((*iSource)[iMsgCtr]); |
|
366 } |
|
367 // If we are migrating halt the operation here |
|
368 if (iMigratingToNewBearer) |
|
369 { |
|
370 // If we don't SetActive, the RunL will complete the request |
|
371 iPopCopyMoveState = EPopCpMvRetrieving; |
|
372 return; |
|
373 } |
|
374 DoRetrieveL(); //add it to the collection; |
|
375 iPopCopyMoveState = EPopCpMvRetrieving; |
|
376 } |
|
377 else |
|
378 { |
|
379 // There are no more messages to download. |
|
380 // If we're moving rather than copying then delete the source messages. |
|
381 iPopCopyMoveState = EPopCpMvDeleting; |
|
382 RetrievalCompleteL(); |
|
383 } |
|
384 } |
|
385 break; |
|
386 default: |
|
387 break; |
|
388 } |
|
389 } |
|
390 |
|
391 // |
|
392 // Result of last active call |
|
393 // |
|
394 void CImPop3CopyMove::DoRunL() |
|
395 { |
|
396 if (iDoingTransfer) |
|
397 { |
|
398 iDoingTransfer = EFalse; |
|
399 TMsvEntry entry = iDestination.Entry(); |
|
400 entry.SetComplete(EFalse); |
|
401 iDestination.ChangeEntry(entry); |
|
402 } |
|
403 |
|
404 if (iSavedError != KErrNone) |
|
405 // If we have already have an error then we have just been logging the failure. |
|
406 // The failure has been logged so we can leave now. |
|
407 { |
|
408 User::Leave(iSavedError); |
|
409 } |
|
410 else |
|
411 // There was no error so handle the completion of either the logging or the retrieve operations. |
|
412 { |
|
413 TRAP(iSavedError, RunLProcessingL()); |
|
414 |
|
415 if (iSavedError != KErrNone) |
|
416 // If an error has occured then we need to clean up the message and log the failure before bailing out. |
|
417 { |
|
418 if( iRetrieveMessage ) |
|
419 { |
|
420 TInt err = KErrNone; |
|
421 if ((!iAlreadyComplete) && (!iMessageMarkedForDelete)) |
|
422 { |
|
423 TRAP(err,iRecvConverter->MessageCompleteL()); |
|
424 } |
|
425 |
|
426 if(err != KErrNone || iSavedError) |
|
427 { |
|
428 // something is wrong with the message delete and report back |
|
429 if (!iPopulate) |
|
430 { |
|
431 err = iDestination.SetEntry(iDestId); |
|
432 if (err == KErrNone) |
|
433 { |
|
434 err = iDestination.DeleteEntry(iRetrieve->EntryId()); |
|
435 } |
|
436 } |
|
437 else |
|
438 // cleanup the message, leave the root entry only. |
|
439 { |
|
440 TMsvId entryId = iRetrieve->EntryId(); |
|
441 if (entryId != KMsvNullIndexEntryId) |
|
442 { |
|
443 err = iDestination.SetEntry(iRetrieve->EntryId()); |
|
444 if (err == KErrNone) |
|
445 { |
|
446 CMsvEntrySelection *childEntries = new (ELeave) CMsvEntrySelection(); |
|
447 CleanupStack::PushL(childEntries); |
|
448 // ignore any errors, there is nothing that can be done about them here. |
|
449 User::LeaveIfError(iDestination.GetChildren(*childEntries)); |
|
450 if (childEntries->Count() != 0) |
|
451 { |
|
452 iDestination.DeleteEntries(*childEntries); |
|
453 } |
|
454 CleanupStack::PopAndDestroy(); //childEntries |
|
455 } |
|
456 } |
|
457 } |
|
458 } |
|
459 } |
|
460 |
|
461 // The message is logged as 'failed' if iSavedError is not KErrNone. |
|
462 LogFetchedMessageL(); |
|
463 } |
|
464 } |
|
465 } |
|
466 |
|
467 // |
|
468 // Use Pop3Retr to Retrieve a message specified by it's Oyster message Id |
|
469 // |
|
470 void CImPop3CopyMove::DoRetrieveL() |
|
471 { |
|
472 iAlreadyComplete = EFalse; |
|
473 iMessageMarkedForDelete = EFalse; |
|
474 TRequestStatus* pS = &iStatus; |
|
475 TMsvId msgId=(*iSource)[iMsgCtr]; |
|
476 // iDestination will later be changed back to the destination entry, if required |
|
477 TInt err = iDestination.SetEntry(msgId); |
|
478 TMsvEmailEntry entry = iDestination.Entry(); |
|
479 |
|
480 TBool partial=entry.PartialDownloaded(); |
|
481 if(err != KErrNone) |
|
482 { |
|
483 SetActive(); |
|
484 User::RequestComplete(pS,err); |
|
485 } |
|
486 else if (entry.Operation() && (entry.DisconnectedOperation() == EDisconnectedDeleteOperation)) |
|
487 { |
|
488 iMessageMarkedForDelete = ETrue; |
|
489 SetActive(); |
|
490 User::RequestComplete(pS, KErrNone); |
|
491 } |
|
492 else if ((entry.Complete() && !partial) && (iPopulate)) |
|
493 { |
|
494 iAlreadyComplete = ETrue; |
|
495 SetActive(); |
|
496 User::RequestComplete(pS, KErrNone); |
|
497 } |
|
498 else |
|
499 { |
|
500 iProgress.iTotalBytes = entry.iSize; |
|
501 if(entry.Complete() && !iPopulate) |
|
502 { |
|
503 iRetrieveMessage=EFalse; |
|
504 // copy from source to target collection |
|
505 DoTransferL(entry); |
|
506 } |
|
507 else |
|
508 { |
|
509 // reset entry to destination context if the current entry is not meant to be populated |
|
510 if (!iPopulate) |
|
511 { |
|
512 err = iDestination.SetEntry(iDestId); |
|
513 User::LeaveIfError(err); |
|
514 } |
|
515 |
|
516 iRetrieveMessage = ETrue; |
|
517 |
|
518 //If the message is not found complete the request. |
|
519 if (!iRetrieve->SetMessage(msgId)) |
|
520 { |
|
521 iAlreadyComplete = ETrue; |
|
522 SetActive(); |
|
523 User::RequestComplete(pS, KErrNone); |
|
524 } |
|
525 else |
|
526 { |
|
527 iRetrieve->StartL(iStatus); |
|
528 SetActive(); |
|
529 MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStatePopRetrieving); |
|
530 } |
|
531 } |
|
532 } |
|
533 } |
|
534 |
|
535 // |
|
536 // Report the refreshing news back to the UI |
|
537 // |
|
538 TPop3Progress CImPop3CopyMove::Progress() |
|
539 { |
|
540 if(iPopCopyMoveState==EPopCpMvRetrieving) |
|
541 { |
|
542 // Get the Copy/Move Progress |
|
543 iProgress.iBytesDone=iRetrieve->Progress(); |
|
544 } |
|
545 else if (iPopCopyMoveState == EPopCpMvLogging) |
|
546 { |
|
547 // We are doing Logging so the move/copy is complete |
|
548 iProgress.iBytesDone = iProgress.iTotalBytes; |
|
549 } |
|
550 else |
|
551 { |
|
552 iProgress.iBytesDone=0; |
|
553 iProgress.iTotalBytes=0; |
|
554 iProgress.iMsgsToProcess=0; |
|
555 } |
|
556 return iProgress; |
|
557 } |
|
558 |
|
559 // |
|
560 // Transfer message from remote to local collection (when there's no TOP) |
|
561 // |
|
562 void CImPop3CopyMove::DoTransferL(TMsvEntry& aMsvEntry) |
|
563 { |
|
564 CImPop3TransferMessage::TImPop3TransferMethod transferMethod; |
|
565 |
|
566 if (iDisconnectedMode) |
|
567 { |
|
568 transferMethod = CImPop3TransferMessage::EImPop3CopyTransfer; |
|
569 } |
|
570 else |
|
571 { |
|
572 transferMethod = CImPop3TransferMessage::EImPop3MoveTransfer; |
|
573 } |
|
574 |
|
575 iStatus = KRequestPending; |
|
576 iTransfer->StartL(aMsvEntry.Id(), iDestId, transferMethod, iStatus); |
|
577 SetActive(); |
|
578 } |
|
579 |
|
580 void CImPop3CopyMove::RetrievalCompleteL() |
|
581 { |
|
582 iProcessComplete=ETrue; |
|
583 if(iCopy==EFalse) |
|
584 { |
|
585 // set iDestination to service entry so we can delete stuff |
|
586 User::LeaveIfError(iDestination.SetEntry( iServiceId )); |
|
587 |
|
588 delete iDelete; |
|
589 iDelete=NULL; |
|
590 iDelete = CImPop3Delete::NewL(iDestination,*iSource,iPopSession, iServiceId); |
|
591 iDelete->Start(iStatus); |
|
592 SetActive(); // Don't need to requeue? |
|
593 } |
|
594 } |
|
595 |
|
596 // |
|
597 // Helper function to set up the iLogEntry object which is invoked after the copy/move. |
|
598 // |
|
599 void CImPop3CopyMove::LogFetchedMessageL() |
|
600 { |
|
601 iPopCopyMoveState = EPopCpMvLogging; |
|
602 if (iLogMessage) |
|
603 { |
|
604 // Get the header information for the message that is to be copied or moved. |
|
605 User::LeaveIfError(iDestination.SetEntry((*iSource)[iMsgCtr])); |
|
606 |
|
607 // Get the 'Fetch' string from the logging string table. |
|
608 TBuf<KLogMaxSharedStringLength> fetchString; |
|
609 iLogMessage->GetString(fetchString, R_LOG_DIR_FETCHED); |
|
610 |
|
611 // Set up the log event. |
|
612 iLogMessage->LogEvent().SetEventType(KLogMailEventTypeUid); |
|
613 |
|
614 iLogMessage->LogEvent().SetDirection(fetchString); |
|
615 iLogMessage->LogEvent().SetRemoteParty(iDestination.Entry().iDetails); |
|
616 iLogMessage->LogEvent().SetSubject(iDestination.Entry().iDescription); |
|
617 iLogMessage->LogEvent().SetLink(iDestId); |
|
618 |
|
619 if (iSavedError != KErrNone) |
|
620 { |
|
621 TBuf<KLogMaxSharedStringLength> failedString; |
|
622 iLogMessage->GetString(failedString, R_LOG_DEL_FAILED); |
|
623 iLogMessage->LogEvent().SetStatus(failedString); |
|
624 } |
|
625 |
|
626 // Run the iLogMessage operation. |
|
627 iLogMessage->Start(iDestination.Entry().iError, iStatus); |
|
628 SetActive(); |
|
629 } |
|
630 else |
|
631 { |
|
632 TRequestStatus* status = &iStatus; |
|
633 SetActive(); |
|
634 User::RequestComplete(status, KErrNone); |
|
635 } |
|
636 } |
|
637 |
|
638 |
|
639 // ****************************************************************************************** |
|
640 // This is called by the POP Server MTM when it starts Migrating Bearer |
|
641 // |
|
642 // ****************************************************************************************** |
|
643 void CImPop3CopyMove::Pause() |
|
644 { |
|
645 // Set the Migration flag, so we can migrate when the current operation (msg) is complete. |
|
646 iMigratingToNewBearer = ETrue; |
|
647 } |
|
648 |
|
649 // ****************************************************************************************** |
|
650 // This is called by the POP Server MTM when it starts Migrating Bearer |
|
651 // |
|
652 // ****************************************************************************************** |
|
653 void CImPop3CopyMove::CancelAllowResume() |
|
654 { |
|
655 // Cancel the copying of the current message and decrement counters |
|
656 // so we can restart from this message onwards when we have migrated. |
|
657 // Use the normal cancel, as we really need to cancel here. |
|
658 iMigratingToNewBearer = ETrue; |
|
659 Cancel(); |
|
660 } |