--- a/ipsservices/ipssosplugin/src/ipsplgcreatereplymessageoperation.cpp Mon May 03 12:23:15 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgcreatereplymessageoperation.cpp Fri May 14 15:41:10 2010 +0300
@@ -18,11 +18,10 @@
// <qmail>
// INCLUDE FILES
-
#include "emailtrace.h"
#include "ipsplgheaders.h"
-// LOCAL CONSTANTS AND MACROS
+// <qmail> removed description
// ================= MEMBER FUNCTIONS =======================
@@ -30,8 +29,9 @@
// CIpsPlgCreateReplyMessageOperation::CIpsPlgCreateReplyMessageOperation
// ----------------------------------------------------------------------------
//
+//<qmail> aSmtpService to reference
CIpsPlgCreateReplyMessageOperation::CIpsPlgCreateReplyMessageOperation(
- CIpsPlgSmtpService* aSmtpService,
+ CIpsPlgSmtpService& aSmtpService,
CMsvSession& aMsvSession,
TRequestStatus& aObserverRequestStatus,
TMsvPartList aPartList,
@@ -44,7 +44,6 @@
aSmtpService,
aMsvSession,
aObserverRequestStatus,
- KMsvNullIndexEntryId,
aPartList,
aMailBoxId,
aOperationObserver,
@@ -53,14 +52,15 @@
{
FUNC_LOG;
}
-
+//</qmail>
// ----------------------------------------------------------------------------
// CIpsPlgCreateReplyMessageOperation::NewL
// ----------------------------------------------------------------------------
//
+//<qmail> aSmtpService to reference
CIpsPlgCreateReplyMessageOperation* CIpsPlgCreateReplyMessageOperation::NewL(
- CIpsPlgSmtpService* aSmtpService,
+ CIpsPlgSmtpService& aSmtpService,
CMsvSession& aMsvSession,
TRequestStatus& aObserverRequestStatus,
TMsvPartList aPartList,
@@ -81,11 +81,11 @@
aOperationObserver,
aRequestId );
CleanupStack::PushL( self );
- self->ConstructL();
+ self->ConstructL(); // Use base class constructor
CleanupStack::Pop( self );
return self;
}
-
+//</qmail>
// ----------------------------------------------------------------------------
// CIpsPlgCreateReplyMessageOperation::~CIpsPlgCreateReplyMessageOperation
// ----------------------------------------------------------------------------
@@ -106,113 +106,62 @@
{
CFSMailMessage* newMessage = NULL;
+ // <qmail> removed TRAP
// new message creation has finished and we have an id...
- TMsvId msgId = TMsvId();
- TRAPD( err, msgId = GetIdFromProgressL( iOperation->FinalProgress() ) );
-
- if( err == KErrNone )
- {
- // ...so we can create an FS type message
- newMessage = iSmtpService->CreateFSMessageAndSetFlagsL(
- msgId, iOriginalMessageId, iFSMailboxId.Id() );
- CleanupStack::PushL( newMessage ); // ***
+ TMsvId msgId;
+ msgId = GetIdFromProgressL( iOperation->FinalProgress() );
+ //</qmail>
+
+ //<qmail>
+ // ...so we can create an FS type message
+ newMessage = iSmtpService.CreateFSMessageAndSetFlagsL(
+ msgId, iOriginalMessageId, iFSMailboxId.Id() );
+ CleanupStack::PushL( newMessage );
+
+ // dig out new reply message's header
+ CMsvEntry* cEntry = iMsvSession.GetEntryL( msgId );
+ CleanupStack::PushL( cEntry );
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ if( store->IsPresentL( KUidMsgFileIMailHeader ) == EFalse )
+ {
+ User::Leave(KErrCorrupt);
+ }
+ CImHeader* header = CImHeader::NewLC();
+ header->RestoreL( *store );
- // dig out new reply message's header
- CMsvEntry* cEntry = iMsvSession.GetEntryL( msgId );
- CleanupStack::PushL( cEntry ); // ***
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store ); // ***
- if( store->IsPresentL( KUidMsgFileIMailHeader ) == EFalse )
- {
- User::Leave(KErrCorrupt);
- }
- CImHeader* header = CImHeader::NewLC(); // ***
- header->RestoreL( *store );
-
- // Start handling recipients
- HBufC* emailAddr( NULL );
- CFSMailAddress* fsAddr( NULL );
-
- // copy to recipients
- TInt toRecipientCount( header->ToRecipients().Count() );
- for( TInt i = 0; i < toRecipientCount; i++ )
- {
- emailAddr = header->ToRecipients()[i].AllocLC(); // ***
- fsAddr = CFSMailAddress::NewLC(); // ***
- fsAddr->SetEmailAddress( *emailAddr ); // Copy created
- newMessage->AppendToRecipient( fsAddr ); // No copy
- CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg
- CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used
- }
+ // Start handling recipients
+ HBufC* emailAddr( NULL );
+ CFSMailAddress* fsAddr( NULL );
+
+ // copy to recipients
+ TInt toRecipientCount( header->ToRecipients().Count() );
+ for( TInt i = 0; i < toRecipientCount; i++ )
+ {
+ emailAddr = header->ToRecipients()[i].AllocLC();
+ fsAddr = CFSMailAddress::NewLC();
+ fsAddr->SetEmailAddress( *emailAddr ); // Copy created
+ newMessage->AppendToRecipient( fsAddr ); // No copy
+ CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg
+ CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used
+ }
- // get additional recipients (reply all case)
- if( iPartList & KMsvMessagePartRecipient )
- {
- // check if CC recipient read from header was present in To field
- // of original message. If so, copy it into To recipients.
- //
- CMsvEntry* tmpEntry = iMsvSession.GetEntryL( iOriginalMessageId );
- CleanupStack::PushL( tmpEntry ); // ***
- CMsvStore* tmpStore = tmpEntry->ReadStoreL();
- CleanupStack::PushL( tmpStore ); // ***
- if( tmpStore->IsPresentL( KUidMsgFileIMailHeader ) )
- {
- CImHeader* tmpHeader = CImHeader::NewLC(); // ***
- tmpHeader->RestoreL( *tmpStore );
+ // get additional recipients (reply all case)
+ if( iPartList & KMsvMessagePartRecipient )
+ {
+ // <qmail> code moved to own function
+ RecipientsCallToOrderL( header, newMessage );
+ // </qmail>
+ }
- TInt originalToRecipientsCount = tmpHeader->ToRecipients().Count();
- TBool present = EFalse;
- for( TInt i = 0; i < header->CcRecipients().Count(); i++ )
- {
- emailAddr = header->CcRecipients()[i].AllocLC(); // ***
- fsAddr = CFSMailAddress::NewLC(); // ***
- fsAddr->SetEmailAddress( *emailAddr ); // Copy created
-
- present = EFalse;
- for( TInt j = 0; j < originalToRecipientsCount; j++ )
- {
- if( emailAddr->Find( tmpHeader->ToRecipients()[j]) != KErrNotFound )
- {
- present = ETrue;
- break;
- }
- }
-
- if( present )
- {
- newMessage->AppendToRecipient( fsAddr ); // No copy
- }
- else
- {
- newMessage->AppendCCRecipient( fsAddr ); // No copy
- }
-
- CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg
- CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used
- }
- CleanupStack::PopAndDestroy( tmpHeader );
- }
- CleanupStack::PopAndDestroy( 2, tmpEntry );
-
- // copy bcc recipients
- for( TInt i = 0; i < header->BccRecipients().Count(); i++ )
- {
- emailAddr = header->BccRecipients()[i].AllocLC(); // ***
- fsAddr = CFSMailAddress::NewLC(); // ***
- fsAddr->SetEmailAddress( *emailAddr ); // Copy created
- newMessage->AppendBCCRecipient( fsAddr ); // No copy
- CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg
- CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used
- }
- }
-
- CleanupStack::PopAndDestroy( 3, cEntry ); // header, store, cEntry
- CleanupStack::Pop( newMessage ); // fsMsg is given to client
-
- // save the added recipients to the message
- newMessage->SaveMessageL();
- }
+ CleanupStack::PopAndDestroy( 3, cEntry ); // header, store, cEntry
+ CleanupStack::Pop( newMessage ); // fsMsg is given to client
+ // save the added recipients to the message
+ newMessage->SaveMessageL();
+
+ // <qmail> removed bracket
+ //</qmail>
// relay the created message (observer takes ownership)
SignalFSObserver( iStatus.Int(), newMessage );
}
@@ -232,6 +181,7 @@
delete iOperation;
iOperation = NULL;
+ // <qmail> removed useless parameter
// Start a new operation, execution continues in RunL
// once the operation has finished.
iOperation = CImEmailOperation::CreateReplyL(
@@ -242,10 +192,80 @@
iPartList,
KIpsPlgReplySubjectFormat,
KMsvEmailTypeListMHTMLMessage,
- //0,
KUidMsgTypeSMTP);
+ // </qmail>
}
-
+//<qmail>
+// ----------------------------------------------------------------------------
+// CIpsPlgCreateReplyMessageOperation::RecipientsCallToOrderL
+// ----------------------------------------------------------------------------
+//
+void CIpsPlgCreateReplyMessageOperation::RecipientsCallToOrderL(
+ CImHeader* aHeader,
+ CFSMailMessage* aNewMessage
+ )
+ {
+ // check if CC recipient read from header was present in To field
+ // of original message. If so, copy it into To recipients.
+ //
+ HBufC* emailAddr( NULL );
+ CFSMailAddress* fsAddr( NULL );
+
+ CMsvEntry* tmpEntry = iMsvSession.GetEntryL( iOriginalMessageId );
+ CleanupStack::PushL( tmpEntry );
+ CMsvStore* tmpStore = tmpEntry->ReadStoreL();
+ CleanupStack::PushL( tmpStore );
+ if( tmpStore->IsPresentL( KUidMsgFileIMailHeader ) )
+ {
+ CImHeader* tmpHeader = CImHeader::NewLC();
+ tmpHeader->RestoreL( *tmpStore );
+
+ TInt originalToRecipientsCount = tmpHeader->ToRecipients().Count();
+ TBool present = EFalse;
+ for( TInt i = 0; i < aHeader->CcRecipients().Count(); i++ )
+ {
+ emailAddr = aHeader->CcRecipients()[i].AllocLC();
+ fsAddr = CFSMailAddress::NewLC();
+ fsAddr->SetEmailAddress( *emailAddr ); // Copy created
+
+ present = EFalse;
+ for( TInt j = 0; j < originalToRecipientsCount; j++ )
+ {
+ if( emailAddr->Find( tmpHeader->ToRecipients()[j]) != KErrNotFound )
+ {
+ present = ETrue;
+ break;
+ }
+ }
+
+ if( present )
+ {
+ aNewMessage->AppendToRecipient( fsAddr ); // No copy
+ }
+ else
+ {
+ aNewMessage->AppendCCRecipient( fsAddr ); // No copy
+ }
+
+ CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg
+ CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used
+ }
+ CleanupStack::PopAndDestroy( tmpHeader );
+ }
+ CleanupStack::PopAndDestroy( 2, tmpEntry );
+
+ // copy bcc recipients
+ for( TInt i = 0; i < aHeader->BccRecipients().Count(); i++ )
+ {
+ emailAddr = aHeader->BccRecipients()[i].AllocLC();
+ fsAddr = CFSMailAddress::NewLC();
+ fsAddr->SetEmailAddress( *emailAddr ); // Copy created
+ aNewMessage->AppendBCCRecipient( fsAddr ); // No copy
+ CleanupStack::Pop( fsAddr ); // fsAddr belong now to fsMsg
+ CleanupStack::PopAndDestroy( emailAddr ); // emailAddr not used
+ }
+ }
+//</qmail>
// End of File
// </qmail>