17 |
17 |
18 |
18 |
19 #include "emailtrace.h" |
19 #include "emailtrace.h" |
20 #include "ipsplgheaders.h" |
20 #include "ipsplgheaders.h" |
21 |
21 |
22 #include <featmgr.h> |
|
23 #include <bldvariant.hrh> // for feature definitions |
|
24 |
|
25 // <cmail> const TInt KIpsSetUtilsCharAt = '@'; </cmail> |
22 // <cmail> const TInt KIpsSetUtilsCharAt = '@'; </cmail> |
26 const TInt KIpsSetUtilsCharLessThan = '<'; |
23 const TInt KIpsSetUtilsCharLessThan = '<'; |
27 const TInt KIpsSetUtilsCharMoreThan = '>'; |
24 const TInt KIpsSetUtilsCharMoreThan = '>'; |
28 const TInt KIpsSetUtilsCntrCharacters = 2; |
25 const TInt KIpsSetUtilsCntrCharacters = 2; |
29 |
26 |
49 // |
46 // |
50 CIpsPlgSmtpService::~CIpsPlgSmtpService() |
47 CIpsPlgSmtpService::~CIpsPlgSmtpService() |
51 { |
48 { |
52 FUNC_LOG; |
49 FUNC_LOG; |
53 delete iMsgMapper; |
50 delete iMsgMapper; |
54 |
51 // <qmail> |
55 if( iFeatureManagerInitialized ) |
52 iOperations.ResetAndDestroy(); |
56 { |
53 // </qmail> |
57 FeatureManager::UnInitializeLib(); |
|
58 } |
|
59 } |
54 } |
60 |
55 |
61 // --------------------------------------------------------------------------- |
56 // --------------------------------------------------------------------------- |
62 // CIpsPlgSmtpService::NewL |
57 // CIpsPlgSmtpService::NewL |
63 // --------------------------------------------------------------------------- |
58 // --------------------------------------------------------------------------- |
95 // |
90 // |
96 void CIpsPlgSmtpService::ConstructL() |
91 void CIpsPlgSmtpService::ConstructL() |
97 { |
92 { |
98 FUNC_LOG; |
93 FUNC_LOG; |
99 iMsgMapper = CIpsPlgMsgMapper::NewL( iSession, iPlugin ); |
94 iMsgMapper = CIpsPlgMsgMapper::NewL( iSession, iPlugin ); |
100 |
95 } |
101 FeatureManager::InitializeLibL(); |
96 |
102 iFeatureManagerInitialized = ETrue; |
97 // <qmail> |
103 } |
98 // ---------------------------------------------------------------------------- |
|
99 // CIpsPlgSmtpService::OpCompleted |
|
100 // ---------------------------------------------------------------------------- |
|
101 void CIpsPlgSmtpService::OpCompleted( |
|
102 CIpsPlgSingleOpWatcher& aOpWatcher, |
|
103 TInt /*aCompletionCode*/ ) |
|
104 { |
|
105 FUNC_LOG; |
|
106 // Get valid operation count in each, some operations could have been |
|
107 // deleted in array |
|
108 TInt opId = aOpWatcher.Operation().Id(); |
|
109 |
|
110 TInt count = iOperations.Count(); |
|
111 |
|
112 for ( TInt i = count - 1; i >= 0; i-- ) |
|
113 { |
|
114 CMsvOperation& oper = iOperations[i]->Operation(); |
|
115 |
|
116 if ( oper.Id() == opId ) |
|
117 { |
|
118 DeleteAndRemoveOperation( i ); |
|
119 } |
|
120 } |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // CIpsPlgSmtpService::DeleteAndRemoveOperation |
|
125 // --------------------------------------------------------------------------- |
|
126 void CIpsPlgSmtpService::DeleteAndRemoveOperation( const TInt aOpArrayIndex ) |
|
127 { |
|
128 FUNC_LOG; |
|
129 CIpsPlgSingleOpWatcher* opWatcher = iOperations[aOpArrayIndex]; |
|
130 |
|
131 iOperations.Remove( aOpArrayIndex ); |
|
132 delete opWatcher; |
|
133 opWatcher = NULL; |
|
134 } |
|
135 // </qmail> |
104 |
136 |
105 // --------------------------------------------------------------------------- |
137 // --------------------------------------------------------------------------- |
106 // CIpsPlgSmtpService::CreateDisplayStringLC |
138 // CIpsPlgSmtpService::CreateDisplayStringLC |
107 // --------------------------------------------------------------------------- |
139 // --------------------------------------------------------------------------- |
108 // |
140 // |
163 { |
195 { |
164 header->SetFromL( aMessage.GetSender()->GetEmailAddress() ); |
196 header->SetFromL( aMessage.GetSender()->GetEmailAddress() ); |
165 } |
197 } |
166 |
198 |
167 // To Field |
199 // To Field |
168 const RPointerArray<CFSMailAddress>& toArray |
200 RPointerArray<CFSMailAddress> toArray = aMessage.GetToRecipients(); |
169 = aMessage.GetToRecipients(); |
|
170 // Reseting recipient list, because our client calls us many times |
201 // Reseting recipient list, because our client calls us many times |
171 // and we want to avoid duplicates |
202 // and we want to avoid duplicates |
172 header->ToRecipients().Reset(); |
203 header->ToRecipients().Reset(); |
173 // build new 'to' header |
204 // build new 'to' header |
174 for( TInt i = 0; i < toArray.Count(); i++ ) |
205 for( TInt i = 0; i < toArray.Count(); i++ ) |
189 } |
220 } |
190 CleanupStack::PopAndDestroy( fullName ); // >>> fullName |
221 CleanupStack::PopAndDestroy( fullName ); // >>> fullName |
191 } |
222 } |
192 |
223 |
193 // CC field |
224 // CC field |
194 const RPointerArray<CFSMailAddress>& ccArray |
225 RPointerArray<CFSMailAddress> ccArray |
195 = aMessage.GetCCRecipients(); |
226 = aMessage.GetCCRecipients(); |
196 header->CcRecipients().Reset(); |
227 header->CcRecipients().Reset(); |
197 for( TInt i = 0; i < ccArray.Count(); i++ ) |
228 for( TInt i = 0; i < ccArray.Count(); i++ ) |
198 { |
229 { |
199 header->CcRecipients().AppendL( ccArray[i]->GetEmailAddress() ); // copy created |
230 header->CcRecipients().AppendL( ccArray[i]->GetEmailAddress() ); // copy created |
200 } |
231 } |
201 |
232 |
202 // BCC field |
233 // BCC field |
203 const RPointerArray<CFSMailAddress>& bccArray |
234 RPointerArray<CFSMailAddress> bccArray |
204 = aMessage.GetBCCRecipients(); |
235 = aMessage.GetBCCRecipients(); |
205 header->BccRecipients().Reset(); |
236 header->BccRecipients().Reset(); |
206 for( TInt i = 0; i < bccArray.Count(); i++ ) |
237 for( TInt i = 0; i < bccArray.Count(); i++ ) |
207 { |
238 { |
208 header->BccRecipients().AppendL( bccArray[i]->GetEmailAddress() ); // copy created |
239 header->BccRecipients().AppendL( bccArray[i]->GetEmailAddress() ); // copy created |
265 CleanupStack::PopAndDestroy( 2, wait ); |
296 CleanupStack::PopAndDestroy( 2, wait ); |
266 |
297 |
267 return CreateFSMessageAndSetFlagsL( |
298 return CreateFSMessageAndSetFlagsL( |
268 msgId, KErrNotFound, aMailBoxId.Id() ); |
299 msgId, KErrNotFound, aMailBoxId.Id() ); |
269 } |
300 } |
270 |
301 |
|
302 // <qmail> |
|
303 // --------------------------------------------------------------------------- |
|
304 // CIpsPlgSmtpService::CreateNewSmtpMessageL |
|
305 // --------------------------------------------------------------------------- |
|
306 // |
|
307 void CIpsPlgSmtpService::CreateNewSmtpMessageL( |
|
308 const TFSMailMsgId& aMailBoxId, |
|
309 MFSMailRequestObserver& aOperationObserver, |
|
310 const TInt aRequestId ) |
|
311 { |
|
312 TMsvPartList partList( KMsvMessagePartBody ); |
|
313 |
|
314 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewLC(*this); |
|
315 |
|
316 TMsvEntry mboxEntry; |
|
317 TMsvId service; |
|
318 User::LeaveIfError( |
|
319 iSession.GetEntry( aMailBoxId.Id(), service, mboxEntry ) ); |
|
320 |
|
321 CIpsPlgCreateMessageOperation* op = CIpsPlgCreateMessageOperation::NewL( this, |
|
322 iSession, |
|
323 watcher->iStatus, |
|
324 mboxEntry.iRelatedId, |
|
325 partList, |
|
326 aMailBoxId.Id(), |
|
327 aOperationObserver, |
|
328 aRequestId ); |
|
329 watcher->SetOperation( op ); |
|
330 |
|
331 iOperations.AppendL( watcher ); |
|
332 CleanupStack::Pop( watcher ); |
|
333 } |
|
334 // </qmail> |
|
335 |
271 // --------------------------------------------------------------------------- |
336 // --------------------------------------------------------------------------- |
272 // CIpsPlgSmtpService::CreateForwardSmtpMessageL |
337 // CIpsPlgSmtpService::CreateForwardSmtpMessageL |
273 // --------------------------------------------------------------------------- |
338 // --------------------------------------------------------------------------- |
274 // |
339 // |
275 CFSMailMessage* CIpsPlgSmtpService::CreateForwardSmtpMessageL( |
340 CFSMailMessage* CIpsPlgSmtpService::CreateForwardSmtpMessageL( |
287 if ( orgMsg.Id() == KMsvNullIndexEntryIdValue ) |
352 if ( orgMsg.Id() == KMsvNullIndexEntryIdValue ) |
288 { |
353 { |
289 User::Leave(KErrNotFound); |
354 User::Leave(KErrNotFound); |
290 } |
355 } |
291 |
356 |
292 // In case original message is in Sent folder, it's serviceId must be |
|
293 // changed before starting forward/reply msg creation operation |
|
294 // (after forward msg is created, this is changed back) |
|
295 TMsvId orgServiceId( 0 ); |
|
296 if ( ( orgMsg.Parent() == KMsvSentEntryIdValue ) && |
357 if ( ( orgMsg.Parent() == KMsvSentEntryIdValue ) && |
297 ( orgMsg.iMtm == KSenduiMtmSmtpUid ) ) |
358 ( orgMsg.iMtm == KSenduiMtmSmtpUid ) ) |
298 { |
359 { |
299 orgServiceId = orgMsg.iServiceId; |
|
300 ChangeServiceIdL( orgMsg ); |
360 ChangeServiceIdL( orgMsg ); |
301 } |
361 } |
302 |
|
303 TMsvPartList partList( KMsvMessagePartBody | KMsvMessagePartAttachments ); |
362 TMsvPartList partList( KMsvMessagePartBody | KMsvMessagePartAttachments ); |
304 |
363 |
305 CIpsPlgOperationWait* wait = CIpsPlgOperationWait::NewLC( ); |
364 CIpsPlgOperationWait* wait = CIpsPlgOperationWait::NewLC( ); |
306 CImEmailOperation* forwMailOp = CImEmailOperation::CreateForwardL( |
365 CImEmailOperation* forwMailOp = CImEmailOperation::CreateForwardL( |
307 wait->iStatus, |
366 wait->iStatus, |
317 wait->Start(); |
376 wait->Start(); |
318 |
377 |
319 TMsvId msgId = GetIdFromProgressL( forwMailOp->FinalProgress() ); |
378 TMsvId msgId = GetIdFromProgressL( forwMailOp->FinalProgress() ); |
320 |
379 |
321 CleanupStack::PopAndDestroy( 2, wait ); |
380 CleanupStack::PopAndDestroy( 2, wait ); |
322 |
|
323 // If original message's serviceId was changed prior to forward/reply msg |
|
324 // creation op, changing it back to the original |
|
325 if ( orgServiceId ) |
|
326 { |
|
327 ChangeServiceIdL( orgMsg, orgServiceId ); |
|
328 } |
|
329 |
381 |
330 return CreateFSMessageAndSetFlagsL( msgId, orgMsg.Id(), aMailBoxId.Id() ); |
382 return CreateFSMessageAndSetFlagsL( msgId, orgMsg.Id(), aMailBoxId.Id() ); |
331 } |
383 } |
332 |
384 |
|
385 // <qmail> |
|
386 // --------------------------------------------------------------------------- |
|
387 // CIpsPlgSmtpService::CreateNewSmtpMessageL |
|
388 // --------------------------------------------------------------------------- |
|
389 // |
|
390 void CIpsPlgSmtpService::CreateForwardSmtpMessageL( |
|
391 const TFSMailMsgId& aMailBoxId, |
|
392 const TFSMailMsgId& aOriginalMessageId, |
|
393 MFSMailRequestObserver& aOperationObserver, |
|
394 const TInt aRequestId ) |
|
395 { |
|
396 FUNC_LOG; |
|
397 // 1. part of function checs that body text and all |
|
398 // attachments are fetched |
|
399 TMsvEntry orgMsg; |
|
400 TMsvId service; |
|
401 User::LeaveIfError( iSession.GetEntry( |
|
402 aOriginalMessageId.Id(), service, orgMsg ) ); |
|
403 |
|
404 if ( orgMsg.Id() == KMsvNullIndexEntryIdValue ) |
|
405 { |
|
406 User::Leave(KErrNotFound); |
|
407 } |
|
408 |
|
409 if ( ( orgMsg.Parent() == KMsvSentEntryIdValue ) && |
|
410 ( orgMsg.iMtm == KSenduiMtmSmtpUid ) ) |
|
411 { |
|
412 ChangeServiceIdL( orgMsg ); |
|
413 } |
|
414 |
|
415 TMsvPartList partList( KMsvMessagePartBody | KMsvMessagePartAttachments ); |
|
416 |
|
417 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewLC(*this); |
|
418 |
|
419 CIpsPlgCreateForwardMessageOperation* op = CIpsPlgCreateForwardMessageOperation::NewL( |
|
420 this, |
|
421 iSession, |
|
422 watcher->iStatus, |
|
423 partList, |
|
424 aMailBoxId.Id(), |
|
425 orgMsg.Id(), |
|
426 aOperationObserver, |
|
427 aRequestId ); |
|
428 watcher->SetOperation( op ); |
|
429 |
|
430 iOperations.AppendL( watcher ); |
|
431 CleanupStack::Pop( watcher ); |
|
432 } |
|
433 // </qmail> |
|
434 |
333 // --------------------------------------------------------------------------- |
435 // --------------------------------------------------------------------------- |
334 // CIpsPlgSmtpService::CreateReplySmtpMessageL |
436 // CIpsPlgSmtpService::CreateReplySmtpMessageL |
335 // --------------------------------------------------------------------------- |
437 // --------------------------------------------------------------------------- |
336 // |
438 // |
337 CFSMailMessage* CIpsPlgSmtpService::CreateReplySmtpMessageL( |
439 CFSMailMessage* CIpsPlgSmtpService::CreateReplySmtpMessageL( |
349 if ( orgMsg.Id() == KMsvNullIndexEntryIdValue ) |
451 if ( orgMsg.Id() == KMsvNullIndexEntryIdValue ) |
350 { |
452 { |
351 User::Leave(KErrNotFound); |
453 User::Leave(KErrNotFound); |
352 } |
454 } |
353 |
455 |
354 // In case original message is in Sent folder, it's serviceId must be |
|
355 // changed before starting forward/reply msg creation operation |
|
356 // (after forward msg is created, this is changed back) |
|
357 TMsvId orgServiceId( 0 ); |
|
358 if ( ( orgMsg.Parent() == KMsvSentEntryIdValue ) && |
456 if ( ( orgMsg.Parent() == KMsvSentEntryIdValue ) && |
359 ( orgMsg.iMtm == KSenduiMtmSmtpUid ) ) |
457 ( orgMsg.iMtm == KSenduiMtmSmtpUid ) ) |
360 { |
458 { |
361 orgServiceId = orgMsg.iServiceId; |
|
362 ChangeServiceIdL( orgMsg ); |
459 ChangeServiceIdL( orgMsg ); |
363 } |
460 } |
364 |
461 |
365 // partList flags control e.g. what kind of recipient set is created |
462 // partList flags control e.g. what kind of recipient set is created |
366 TMsvPartList partList = KMsvMessagePartBody | KMsvMessagePartDescription |
463 TMsvPartList partList = KMsvMessagePartBody | KMsvMessagePartDescription |
383 CleanupStack::PushL( replMailOp ); |
480 CleanupStack::PushL( replMailOp ); |
384 wait->Start(); |
481 wait->Start(); |
385 TMsvId msgId = GetIdFromProgressL( replMailOp->FinalProgress() ); |
482 TMsvId msgId = GetIdFromProgressL( replMailOp->FinalProgress() ); |
386 CleanupStack::PopAndDestroy( 2, wait ); |
483 CleanupStack::PopAndDestroy( 2, wait ); |
387 |
484 |
388 // If original message's serviceId was changed prior to forward/reply msg |
|
389 // creation op, changing it back to the original |
|
390 if ( orgServiceId ) |
|
391 { |
|
392 ChangeServiceIdL( orgMsg, orgServiceId ); |
|
393 } |
|
394 |
|
395 // Start finalising new FS style message |
485 // Start finalising new FS style message |
396 CFSMailMessage* fsMsg = CreateFSMessageAndSetFlagsL( |
486 CFSMailMessage* fsMsg = CreateFSMessageAndSetFlagsL( |
397 msgId, orgMsg.Id(), aMailBoxId.Id() ); |
487 msgId, orgMsg.Id(), aMailBoxId.Id() ); |
398 CleanupStack::PushL( fsMsg ); // *** |
488 CleanupStack::PushL( fsMsg ); // *** |
399 |
489 |
421 fsMsg->AppendToRecipient( fsAddr ); // No copy |
511 fsMsg->AppendToRecipient( fsAddr ); // No copy |
422 CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg |
512 CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg |
423 CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used |
513 CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used |
424 } |
514 } |
425 // copy cc recipients |
515 // copy cc recipients |
426 // <cmail> |
|
427 TFSMailMsgId folderId; |
|
428 TFSMailDetails details( EFSMsgDataEnvelope ); |
|
429 CFSMailMessage* originalMessage = iPlugin.GetMessageByUidL( aMailBoxId, |
|
430 folderId, aOriginalMessageId, details ); |
|
431 CleanupStack::PushL( originalMessage ); |
|
432 RPointerArray<CFSMailAddress>& originalToRecipients = |
|
433 originalMessage->GetToRecipients(); |
|
434 TInt originalToRecipientsCount = originalToRecipients.Count(); |
|
435 TBool present = EFalse; |
|
436 // </cmail> |
|
437 for( TInt i = 0; i < header->CcRecipients().Count(); i++ ) |
516 for( TInt i = 0; i < header->CcRecipients().Count(); i++ ) |
438 { |
517 { |
439 emailAddr = header->CcRecipients()[i].AllocLC(); // *** |
518 emailAddr = header->CcRecipients()[i].AllocLC(); // *** |
440 fsAddr = CFSMailAddress::NewLC(); // *** |
519 fsAddr = CFSMailAddress::NewLC(); // *** |
441 fsAddr->SetEmailAddress( *emailAddr ); // Copy created |
520 fsAddr->SetEmailAddress( *emailAddr ); // Copy created |
442 // <cmail> |
521 fsMsg->AppendCCRecipient( fsAddr ); // No copy |
443 if( aReplyToAll ) |
|
444 { |
|
445 // check if CC recipient read from header was present in To field |
|
446 // of original message. If so, copy it into To recipietns |
|
447 present = EFalse; |
|
448 for( TInt j = 0; j < originalToRecipientsCount; j++ ) |
|
449 { |
|
450 if( emailAddr->Find( originalToRecipients[j]->GetEmailAddress()) |
|
451 != KErrNotFound ) |
|
452 { |
|
453 present = ETrue; |
|
454 break; |
|
455 } |
|
456 } |
|
457 if( present ) |
|
458 { |
|
459 fsMsg->AppendToRecipient( fsAddr ); // No copy |
|
460 } |
|
461 else |
|
462 { |
|
463 fsMsg->AppendCCRecipient( fsAddr ); // No copy |
|
464 } |
|
465 } |
|
466 else |
|
467 { |
|
468 fsMsg->AppendCCRecipient( fsAddr ); // No copy |
|
469 } |
|
470 // </cmail> |
|
471 CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg |
522 CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg |
472 CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used |
523 CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used |
473 } |
524 } |
474 // <cmail> |
|
475 CleanupStack::PopAndDestroy( originalMessage ); |
|
476 // </cmail> |
|
477 // copy bcc recipients |
525 // copy bcc recipients |
478 for( TInt i = 0; i < header->BccRecipients().Count(); i++ ) |
526 for( TInt i = 0; i < header->BccRecipients().Count(); i++ ) |
479 { |
527 { |
480 emailAddr = header->BccRecipients()[i].AllocLC(); // *** |
528 emailAddr = header->BccRecipients()[i].AllocLC(); // *** |
481 fsAddr = CFSMailAddress::NewLC(); // *** |
529 fsAddr = CFSMailAddress::NewLC(); // *** |
488 CleanupStack::PopAndDestroy( 3, cEntry ); // header, store, cEntry |
536 CleanupStack::PopAndDestroy( 3, cEntry ); // header, store, cEntry |
489 CleanupStack::Pop( fsMsg ); // fsMsg is given to client |
537 CleanupStack::Pop( fsMsg ); // fsMsg is given to client |
490 return fsMsg; |
538 return fsMsg; |
491 } |
539 } |
492 |
540 |
|
541 // <qmail> |
|
542 // --------------------------------------------------------------------------- |
|
543 // CIpsPlgSmtpService::CreateReplySmtpMessageL |
|
544 // --------------------------------------------------------------------------- |
|
545 // |
|
546 void CIpsPlgSmtpService::CreateReplySmtpMessageL( |
|
547 const TFSMailMsgId& aMailBoxId, |
|
548 const TFSMailMsgId& aOriginalMessageId, |
|
549 TBool aReplyToAll, |
|
550 MFSMailRequestObserver& aOperationObserver, |
|
551 const TInt aRequestId ) |
|
552 { |
|
553 FUNC_LOG; |
|
554 // find orginal message header and check that body is fetched |
|
555 TMsvEntry orgMsg; |
|
556 TMsvId service; |
|
557 User::LeaveIfError( |
|
558 iSession.GetEntry( aOriginalMessageId.Id(), service, orgMsg ) ); |
|
559 |
|
560 if ( orgMsg.Id() == KMsvNullIndexEntryIdValue ) |
|
561 { |
|
562 User::Leave(KErrNotFound); |
|
563 } |
|
564 |
|
565 if ( ( orgMsg.Parent() == KMsvSentEntryIdValue ) && |
|
566 ( orgMsg.iMtm == KSenduiMtmSmtpUid ) ) |
|
567 { |
|
568 ChangeServiceIdL( orgMsg ); |
|
569 } |
|
570 |
|
571 // partList flags control e.g. what kind of recipient set is created |
|
572 TMsvPartList partList = KMsvMessagePartBody | KMsvMessagePartDescription |
|
573 | KMsvMessagePartOriginator; |
|
574 if( aReplyToAll ) |
|
575 { |
|
576 partList |= KMsvMessagePartRecipient; |
|
577 } |
|
578 |
|
579 CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewLC(*this); |
|
580 |
|
581 CIpsPlgCreateReplyMessageOperation* op = CIpsPlgCreateReplyMessageOperation::NewL( |
|
582 this, |
|
583 iSession, |
|
584 watcher->iStatus, |
|
585 partList, |
|
586 aMailBoxId.Id(), |
|
587 orgMsg.Id(), |
|
588 aOperationObserver, |
|
589 aRequestId ); |
|
590 watcher->SetOperation( op ); |
|
591 |
|
592 iOperations.AppendL( watcher ); |
|
593 CleanupStack::Pop( watcher ); |
|
594 } |
|
595 // </qmail> |
|
596 |
493 // --------------------------------------------------------------------------- |
597 // --------------------------------------------------------------------------- |
494 // CIpsPlgSmtpService::ChangeServiceIdL |
598 // CIpsPlgSmtpService::ChangeServiceIdL |
495 // --------------------------------------------------------------------------- |
599 // --------------------------------------------------------------------------- |
496 // |
600 // |
497 void CIpsPlgSmtpService::ChangeServiceIdL( TMsvEntry& aEntry ) |
601 void CIpsPlgSmtpService::ChangeServiceIdL( TMsvEntry& aEntry ) |
508 cEntry->SetEntryL( aEntry.Id() ); |
612 cEntry->SetEntryL( aEntry.Id() ); |
509 cEntry->ChangeL( aEntry ); |
613 cEntry->ChangeL( aEntry ); |
510 } |
614 } |
511 CleanupStack::PopAndDestroy( cEntry ); |
615 CleanupStack::PopAndDestroy( cEntry ); |
512 } |
616 } |
513 |
617 |
514 // --------------------------------------------------------------------------- |
|
515 // CIpsPlgSmtpService::ChangeServiceIdL |
|
516 // --------------------------------------------------------------------------- |
|
517 // |
|
518 void CIpsPlgSmtpService::ChangeServiceIdL( TMsvEntry& aEntry, TMsvId aServiceId ) |
|
519 { |
|
520 FUNC_LOG; |
|
521 CMsvEntry* cEntry = iSession.GetEntryL( aEntry.Id() ); |
|
522 CleanupStack::PushL( cEntry ); |
|
523 aEntry.iServiceId = aServiceId; |
|
524 cEntry->ChangeL( aEntry ); |
|
525 CleanupStack::PopAndDestroy( cEntry ); |
|
526 } |
|
527 |
|
528 // --------------------------------------------------------------------------- |
618 // --------------------------------------------------------------------------- |
529 // CIpsPlgSmtpService::CreateFSMessageAndSetFlagsL |
619 // CIpsPlgSmtpService::CreateFSMessageAndSetFlagsL |
530 // --------------------------------------------------------------------------- |
620 // --------------------------------------------------------------------------- |
531 // |
621 // |
532 CFSMailMessage* CIpsPlgSmtpService::CreateFSMessageAndSetFlagsL( |
622 CFSMailMessage* CIpsPlgSmtpService::CreateFSMessageAndSetFlagsL( |
533 TMsvId aMessageId, TMsvId aOriginalMsgId,TMsvId aMailboxId ) |
623 TMsvId aMessageId, |
534 { |
624 TMsvId aOriginalMsgId, |
535 FUNC_LOG; |
625 TMsvId aMailboxId, |
536 |
626 TBool aCopyOriginalMsgProperties ) |
537 |
627 { |
538 |
628 FUNC_LOG; |
539 // tp teleca change for korean specific email encoding |
629 |
540 // Default charset |
630 // Default charset |
541 TUid charset; |
631 TUid charset; |
542 charset.iUid = KCharacterSetIdentifierUtf8; |
632 charset.iUid = KCharacterSetIdentifierUtf8; |
543 |
|
544 // korea specific charset |
|
545 if ( FeatureManager::FeatureSupported( KFeatureIdKorean )) |
|
546 { |
|
547 |
|
548 //const TUid KCRUidEMailCharsets = {0x20018441}; // korea needs different default charset |
|
549 const TInt KoreanMib = 36; // magic number to read from cen rep would be better |
|
550 |
|
551 CCnvCharacterSetConverter* charConv = NULL; |
|
552 TRAPD( err, charConv = CCnvCharacterSetConverter::NewL() ); |
|
553 if( err == KErrNone ) |
|
554 { |
|
555 TUint characterSetId = KCharacterSetIdentifierUtf8; |
|
556 RFs fs; |
|
557 TInt err = fs.Connect(); |
|
558 |
|
559 if( err == KErrNone ) |
|
560 { |
|
561 TRAP( err, characterSetId = charConv->ConvertMibEnumOfCharacterSetToIdentifierL( KoreanMib, fs )); |
|
562 if( err == KErrNone ) |
|
563 { // set korean specific charset |
|
564 charset = TUid::Uid( characterSetId ); |
|
565 } |
|
566 fs.Close(); |
|
567 } |
|
568 } |
|
569 |
|
570 delete charConv; |
|
571 |
|
572 } |
|
573 // tp teleca change END |
|
574 |
633 |
575 // set in preparation flag, altought |
634 // set in preparation flag, altought |
576 // not known where this affects |
635 // not known where this affects |
577 TMsvId dummy; |
636 TMsvId dummy; |
578 TMsvEmailEntry newEmailMsg; |
637 TMsvEmailEntry newEmailMsg; |
584 if ( aOriginalMsgId != KErrNotFound ) |
643 if ( aOriginalMsgId != KErrNotFound ) |
585 { |
644 { |
586 TMsvEntry orgMsg; |
645 TMsvEntry orgMsg; |
587 //get entry errors not handled |
646 //get entry errors not handled |
588 iSession.GetEntry( aOriginalMsgId, dummy, orgMsg ); |
647 iSession.GetEntry( aOriginalMsgId, dummy, orgMsg ); |
|
648 iSession.GetEntry( aMessageId, dummy, newEmailMsg ); |
589 const TMsvEmailEntry& orgEmailMsg(orgMsg); |
649 const TMsvEmailEntry& orgEmailMsg(orgMsg); |
590 |
650 |
591 // symbian not mark same priority to reply / forward messages |
651 // symbian not mark same priority to reply / forward messages |
592 if ( orgEmailMsg.Priority() != newEmailMsg.Priority() ) |
652 if ( aCopyOriginalMsgProperties && orgEmailMsg.Priority() != newEmailMsg.Priority() ) |
593 { |
653 { |
594 newEmailMsg.SetPriority( orgEmailMsg.Priority() ); |
654 newEmailMsg.SetPriority( orgEmailMsg.Priority() ); |
595 } |
655 } |
|
656 |
596 //get charset from original message |
657 //get charset from original message |
597 charset = GetOriginalCharsetL( aOriginalMsgId ); |
658 charset = GetOriginalCharsetL( aOriginalMsgId ); |
598 } |
659 } |
599 |
660 |
600 // set in preparation |
661 // set in preparation |
617 TFSMailMsgId( iPlugin.PluginId(), aMessageId ) ); |
678 TFSMailMsgId( iPlugin.PluginId(), aMessageId ) ); |
618 fsMsg->SetMailBoxId( TFSMailMsgId( iPlugin.PluginId(), aMailboxId ) ); |
679 fsMsg->SetMailBoxId( TFSMailMsgId( iPlugin.PluginId(), aMailboxId ) ); |
619 fsMsg->SetFolderId( |
680 fsMsg->SetFolderId( |
620 TFSMailMsgId( iPlugin.PluginId(), KMsvDraftEntryId ) ); |
681 TFSMailMsgId( iPlugin.PluginId(), KMsvDraftEntryId ) ); |
621 |
682 |
|
683 // update subject |
|
684 fsMsg->SetSubject( newEmailMsg.iDescription ); |
|
685 |
622 //update flags |
686 //update flags |
623 iMsgMapper->SetFSMessageFlagsL( newEmailMsg, *fsMsg ); |
687 iMsgMapper->SetFSMessageFlagsL( newEmailMsg, *fsMsg ); |
624 |
688 |
625 return fsMsg; |
689 return fsMsg; |
626 } |
690 } |
|
691 |
627 |
692 |
628 // --------------------------------------------------------------------------- |
693 // --------------------------------------------------------------------------- |
629 // CIpsPlgSmtpService::GetIdFromProgressL |
694 // CIpsPlgSmtpService::GetIdFromProgressL |
630 // inline static |
695 // inline static |
631 // --------------------------------------------------------------------------- |
696 // --------------------------------------------------------------------------- |