From 86355a73fdd8907a8683bfd66630779d134138ae Mon Sep 17 00:00:00 2001 From: Byounghui Date: Tue, 6 Aug 2013 14:08:16 +0900 Subject: [PATCH] Nabi_SEN_SE-48289 fixed. Change-Id: I1c5be92b3e49d21fa00f261de03707d7856f4b6c Signed-off-by: Byounghui --- inc/FMsgEmailManager.h | 1 - src/FMsg_EmailManagerImpl.cpp | 2 +- src/FMsg_MsgUtil.cpp | 26 ++++++++++++++++++++++++-- src/FMsg_MsgUtil.h | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/inc/FMsgEmailManager.h b/inc/FMsgEmailManager.h index 53938f1..5de3f04 100755 --- a/inc/FMsgEmailManager.h +++ b/inc/FMsgEmailManager.h @@ -166,7 +166,6 @@ namespace Tizen { namespace Messaging * @exception E_MAX_EXCEEDED The number of recipients has crossed the maximum limit (Maximum 20). * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1 - * @remarks The value of the flag, @c saveToSentbox, is fixed to @c false in the emulator. * @see IEmailListener::OnEmailMessageSent() */ result Send(const EmailMessage& message, const RecipientList& recipientList, bool saveToSentbox); diff --git a/src/FMsg_EmailManagerImpl.cpp b/src/FMsg_EmailManagerImpl.cpp index c7c72ab..fd4dad5 100644 --- a/src/FMsg_EmailManagerImpl.cpp +++ b/src/FMsg_EmailManagerImpl.cpp @@ -212,7 +212,7 @@ _EmailManagerImpl::Send(const EmailMessage& message, const RecipientList& recipi SysAssertf(__isConstructed == true, "The _EmailManagerImpl instance is not constructed yet."); SysLog(NID_MSG, "sending an email message."); - r = _MsgUtil::SendEmail(message, recipientList, msgId, requestId); + r = _MsgUtil::SendEmail(message, recipientList, msgId, requestId, saveToSentBox); SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to send the email message.", GetErrorMessage(r)); pTemp = new (std::nothrow) _EmailAsyncData(); diff --git a/src/FMsg_MsgUtil.cpp b/src/FMsg_MsgUtil.cpp index d33ff9c..e84d934 100644 --- a/src/FMsg_MsgUtil.cpp +++ b/src/FMsg_MsgUtil.cpp @@ -1610,13 +1610,14 @@ CATCH: return NULL; } result -_MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailId, int &requestId) +_MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailId, int &requestId, bool saveToSentBox) { email_account_t* pAccount = NULL; email_mail_data_t *pMail = null; email_mailbox_t *pMailbox = null; email_attachment_data_t **pAttach=null; + int tmpSaveToSentBox = -1; int accountId = 0; int err = EMAIL_ERROR_NONE; result r = E_SUCCESS; @@ -1630,12 +1631,18 @@ _MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientL pMailbox = (email_mailbox_t *)calloc(1,sizeof(email_mailbox_t)); SysTryCatch(NID_MSG, pMailbox != null, r = E_OUT_OF_MEMORY, r, "Insufficient memory"); - err = email_load_default_account_id(&accountId); SysTryCatch(NID_MSG, err == EMAIL_ERROR_NONE, r = E_INVALID_ACCOUNT, r, "Account Load is Failed."); err = email_get_account(accountId, GET_FULL_DATA, &pAccount); SysTryCatch(NID_MSG, err == EMAIL_ERROR_NONE, r = E_INVALID_ACCOUNT, r, "Account is Failed."); + SysLog(NID_MSG, "keep %d, save %d" , pAccount->options.keep_local_copy, saveToSentBox); + + tmpSaveToSentBox = pAccount->options.keep_local_copy; + pAccount->options.keep_local_copy = saveToSentBox; + + email_update_account(accountId, pAccount); + SysTryCatch(NID_MSG, err == EMAIL_ERROR_NONE, r = E_INVALID_ACCOUNT, r, "Account update is Failed."); fromAddr.Append(L'\"'); fromAddr.Append(pAccount->incoming_server_user_name); @@ -1691,6 +1698,13 @@ _MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientL r = AddEmailCallBackToDbus(); + if (-1 != tmpSaveToSentBox) + { + pAccount->options.keep_local_copy = (bool)tmpSaveToSentBox; + email_update_account(accountId, pAccount); + } + + if (pAttach) { if (*pAttach) @@ -1722,6 +1736,14 @@ _MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientL return r; CATCH: + + if (-1 != tmpSaveToSentBox) + { + pAccount->options.keep_local_copy = (bool)tmpSaveToSentBox; + email_update_account(accountId, pAccount); + } + + if (pAttach) { if (*pAttach) diff --git a/src/FMsg_MsgUtil.h b/src/FMsg_MsgUtil.h index 404a934..0a201f3 100644 --- a/src/FMsg_MsgUtil.h +++ b/src/FMsg_MsgUtil.h @@ -66,7 +66,7 @@ public: static SmsMessage* ConvertSmsMessageN(const SmsMessageBoxType& type, msg_struct_t& msg); static int AddMessageAddress(const RecipientList& recipientList, RecipientType type, msg_struct_t& messageMsg, _MSG_RECIPIENT_TYPE_E recipientType); static result AddEmailMessageAddress(const RecipientList& recipientList, RecipientType type, email_mail_data_t *pMail); - static result SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailboxId, int &requestId); + static result SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailboxId, int &requestId, bool saveToSentBox); static result AddEmailMessageBody(email_mail_data_t *pMail, char * pBody); static result AddEmailMessageAttachment(const EmailMessage& message, email_attachment_data_t ***pAttach, email_mail_data_t *pMail); static result AddEmailCallBackToDbus(void); -- 2.7.4