- /*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+/*
+* Copyright 2012-2013 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.1 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
#include "MsgDebug.h"
#include "MsgUtilFile.h"
#include "MsgStorageHandler.h"
-
+#include "MsgVMessage.h"
/*==================================================================================================
IMPLEMENTATION OF MsgHandle - Storage Member Functions
==================================================================================================*/
-int MsgHandle::addMessage(const MSG_MESSAGE_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt)
+int MsgHandle::addMessage(MSG_MESSAGE_HIDDEN_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt)
{
- MSG_MESSAGE_INFO_S msgInfo = {0};
- MSG_SENDINGOPT_INFO_S sendOptInfo;
+ MSG_MESSAGE_INFO_S msgInfo = {0,};
+ MSG_SENDINGOPT_INFO_S sendOptInfo = {0,};
// Covert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S
convertMsgStruct(pMsg, &msgInfo);
// Covert MSG_SENDINGOPT_S to MSG_SENDINGOPT_INFO_S
- convertSendOptStruct(pSendOpt, &sendOptInfo, pMsg->msgType);
+ MSG_MESSAGE_TYPE_S msgType = {0,};
+
+ msgType.mainType = pMsg->mainType;
+ msgType.subType = pMsg->subType;
+ msgType.classType = pMsg->classType;
+
+ convertSendOptStruct(pSendOpt, &sendOptInfo, msgType);
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_INFO_S) + sizeof(MSG_SENDINGOPT_INFO_S);
if (pEvent->result != MSG_SUCCESS) return pEvent->result;
- MSG_MESSAGE_ID_T msgId = 0;
+ msg_message_id_t msgId = 0;
// Decode Return Data
MsgDecodeMsgId(pEvent->data, &msgId);
}
-MSG_ERROR_T MsgHandle::addSyncMLMessage(const MSG_SYNCML_MESSAGE_S *pSyncMLMsg)
+msg_error_t MsgHandle::addSyncMLMessage(const MSG_SYNCML_MESSAGE_S *pSyncMLMsg)
{
- MSG_MESSAGE_INFO_S msgInfo;
+ MSG_MESSAGE_INFO_S msgInfo = {0, };
// Covert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S
- convertMsgStruct((MSG_MESSAGE_S*)pSyncMLMsg->msg, &msgInfo);
+ msg_struct_s *msg = (msg_struct_s *)pSyncMLMsg->msg;
+ convertMsgStruct((MSG_MESSAGE_HIDDEN_S *)msg->data, &msgInfo);
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S) + sizeof(int) + sizeof(int) + sizeof(MSG_MESSAGE_INFO_S);
}
-MSG_ERROR_T MsgHandle::updateMessage(const MSG_MESSAGE_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt)
+msg_error_t MsgHandle::updateMessage(const MSG_MESSAGE_HIDDEN_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt)
{
- MSG_MESSAGE_INFO_S msgInfo;
- MSG_SENDINGOPT_INFO_S sendOptInfo;
+ MSG_MESSAGE_INFO_S msgInfo = {0, };
+ MSG_SENDINGOPT_INFO_S sendOptInfo = {0, };
// Covert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S
convertMsgStruct(pMsg, &msgInfo);
- if(pSendOpt != NULL)
- convertSendOptStruct(pSendOpt, &sendOptInfo, pMsg->msgType);
+ if(pSendOpt != NULL) {
+ MSG_MESSAGE_TYPE_S msgType = {0,};
+
+ msgType.mainType = pMsg->mainType;
+ msgType.subType = pMsg->subType;
+ msgType.classType = pMsg->classType;
+
+ convertSendOptStruct(pSendOpt, &sendOptInfo, msgType);
+ }
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_INFO_S) + sizeof(MSG_SENDINGOPT_INFO_S);
}
-MSG_ERROR_T MsgHandle::updateReadStatus(MSG_MESSAGE_ID_T MsgId, bool bRead)
+msg_error_t MsgHandle::updateReadStatus(msg_message_id_t MsgId, bool bRead)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_ID_T) + sizeof(bool);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t) + sizeof(bool);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(MSG_MESSAGE_ID_T));
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_ID_T)), &bRead, sizeof(bool));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), &bRead, sizeof(bool));
// Send Command to Messaging FW
char* pEventData = NULL;
}
-MSG_ERROR_T MsgHandle::updateProtectedStatus(MSG_MESSAGE_ID_T MsgId, bool bProtected)
+msg_error_t MsgHandle::updateProtectedStatus(msg_message_id_t MsgId, bool bProtected)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_ID_T) + sizeof(bool);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t) + sizeof(bool);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(MSG_MESSAGE_ID_T));
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_ID_T)), &bProtected, sizeof(bool));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), &bProtected, sizeof(bool));
// Send Command to Messaging FW
char* pEventData = NULL;
}
-MSG_ERROR_T MsgHandle::deleteMessage(MSG_MESSAGE_ID_T MsgId)
+msg_error_t MsgHandle::deleteMessage(msg_message_id_t MsgId)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_ID_T);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy((void*)pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(MSG_MESSAGE_ID_T));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
// Send Command to Messaging FW
char* pEventData = NULL;
}
-MSG_ERROR_T MsgHandle::deleteAllMessagesInFolder(MSG_FOLDER_ID_T FolderId, bool bOnlyDB)
+msg_error_t MsgHandle::deleteAllMessagesInFolder(msg_folder_id_t FolderId, bool bOnlyDB)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_FOLDER_ID_T);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_folder_id_t);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &FolderId, sizeof(MSG_FOLDER_ID_T));
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_FOLDER_ID_T)), &bOnlyDB, sizeof(bool));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &FolderId, sizeof(msg_folder_id_t));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_folder_id_t)), &bOnlyDB, sizeof(bool));
// Send Command to Messaging FW
char* pEventData = NULL;
}
-MSG_ERROR_T MsgHandle::moveMessageToFolder(MSG_MESSAGE_ID_T MsgId, MSG_FOLDER_ID_T DestFolderId)
+msg_error_t MsgHandle::deleteMessagesByList(msg_id_list_s *pMsgIdList)
+{
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(int) + (sizeof(int)*pMsgIdList->nCount);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_DELETE_MESSAGE_BY_LIST;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+ // Copy Command Data
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &(pMsgIdList->nCount), sizeof(int));
+ for (int i=0; i<pMsgIdList->nCount; i++) {
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+(sizeof(int)*i)), &(pMsgIdList->msgIdList[i]), sizeof(int));
+ }
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_DELETE_MESSAGE_BY_LIST) {
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
+ }
+
+ return pEvent->result;
+}
+
+
+msg_error_t MsgHandle::moveMessageToFolder(msg_message_id_t MsgId, msg_folder_id_t DestFolderId)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_ID_T) + sizeof(MSG_FOLDER_ID_T);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t) + sizeof(msg_folder_id_t);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(MSG_MESSAGE_ID_T));
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+sizeof(MSG_MESSAGE_ID_T)+MAX_COOKIE_LEN), &DestFolderId, sizeof(MSG_FOLDER_ID_T));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+sizeof(msg_message_id_t)+MAX_COOKIE_LEN), &DestFolderId, sizeof(msg_folder_id_t));
// Send Command to Messaging FW
char* pEventData = NULL;
}
-MSG_ERROR_T MsgHandle::moveMessageToStorage(MSG_MESSAGE_ID_T MsgId, MSG_STORAGE_ID_T DestStorageId)
+msg_error_t MsgHandle::moveMessageToStorage(msg_message_id_t MsgId, msg_storage_id_t DestStorageId)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_ID_T) + sizeof(MSG_STORAGE_ID_T);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t) + sizeof(msg_storage_id_t);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(MSG_MESSAGE_ID_T));
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_ID_T)), &DestStorageId, sizeof(MSG_STORAGE_ID_T));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), &DestStorageId, sizeof(msg_storage_id_t));
// Send Command to Messaging FW
char* pEventData = NULL;
}
-MSG_ERROR_T MsgHandle::countMessage(MSG_FOLDER_ID_T FolderId, MSG_COUNT_INFO_S *pCountInfo)
+msg_error_t MsgHandle::countMessage(msg_folder_id_t FolderId, MSG_COUNT_INFO_S *pCountInfo)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_FOLDER_ID_T);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_folder_id_t);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &FolderId, sizeof(MSG_FOLDER_ID_T));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &FolderId, sizeof(msg_folder_id_t));
// Send Command to Messaging FW
char* pEventData = NULL;
}
-MSG_ERROR_T MsgHandle::countMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount)
+msg_error_t MsgHandle::countMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount)
{
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_TYPE_S);
if(pEvent->result != MSG_SUCCESS) return pEvent->result;
// Decode Return Data
- memcpy(pMsgCount, (void*)((char*)pEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(MSG_ERROR_T)), sizeof(int));
+ memcpy(pMsgCount, (void*)((char*)pEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)), sizeof(int));
return MSG_SUCCESS;
}
-MSG_ERROR_T MsgHandle::countMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList)
+msg_error_t MsgHandle::countMsgByContact(const MSG_THREAD_LIST_INDEX_INFO_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList)
{
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_THREAD_LIST_INDEX_S);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pAddrInfo, sizeof(MSG_THREAD_LIST_INDEX_S));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pAddrInfo, sizeof(msg_contact_id_t));
+ msg_struct_s *pAddr = (msg_struct_s *)pAddrInfo->msgAddrInfo;
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN + sizeof(msg_contact_id_t)), pAddr->data, sizeof(MSG_ADDRESS_INFO_S));
// Send Command to Messaging FW
char* pEventData = NULL;
AutoPtr<char> eventBuf(&pEventData);
}
-MSG_ERROR_T MsgHandle::getMessage(MSG_MESSAGE_ID_T MsgId, MSG_MESSAGE_S *pMsg, MSG_SENDINGOPT_S *pSendOpt)
+msg_error_t MsgHandle::getMessage(msg_message_id_t MsgId, MSG_MESSAGE_HIDDEN_S *pMsg, MSG_SENDINGOPT_S *pSendOpt)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_ID_T);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(MSG_MESSAGE_ID_T));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
// Send Command to Messaging FW
char* pEventData = NULL;
MSG_SENDINGOPT_INFO_S sendOptInfo;
MsgDecodeMsgInfo(pEvent->data, &msgInfo, &sendOptInfo);
- // Covert MSG_MESSAGE_INFO_S to MSG_MESSAGE_S
+ // Covert MSG_MESSAGE_INFO_S to MSG_MESSAGE_HIDDEN_S
convertMsgStruct(&msgInfo, pMsg);
- if(pSendOpt != NULL)
- convertSendOptStruct(&sendOptInfo, pSendOpt, pMsg->msgType);
+ if(pSendOpt != NULL) {
+ MSG_MESSAGE_TYPE_S msgType = {0,};
+
+ msgType.mainType = pMsg->mainType;
+ msgType.subType = pMsg->subType;
+ msgType.classType = pMsg->classType;
+
+ convertSendOptStruct(&sendOptInfo, pSendOpt, msgType);
+ }
// Delete Temp File
if (msgInfo.bTextSms == false)
}
-MSG_ERROR_T MsgHandle::getFolderViewList(MSG_FOLDER_ID_T FolderId, const MSG_SORT_RULE_S *pSortRule, MSG_LIST_S *pMsgFolderViewList)
+msg_error_t MsgHandle::getFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList)
{
- MSG_ERROR_T err = MSG_SUCCESS;
+ msg_error_t err = MSG_SUCCESS;
err = MsgStoConnectDB();
}
-MSG_ERROR_T MsgHandle::addFolder(const MSG_FOLDER_INFO_S *pFolderInfo)
+msg_error_t MsgHandle::addFolder(const MSG_FOLDER_INFO_S *pFolderInfo)
{
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_FOLDER_INFO_S);
}
-MSG_ERROR_T MsgHandle::updateFolder(const MSG_FOLDER_INFO_S *pFolderInfo)
+msg_error_t MsgHandle::updateFolder(const MSG_FOLDER_INFO_S *pFolderInfo)
{
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_FOLDER_INFO_S);
}
-MSG_ERROR_T MsgHandle::deleteFolder(MSG_FOLDER_ID_T FolderId)
+msg_error_t MsgHandle::deleteFolder(msg_folder_id_t FolderId)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_FOLDER_ID_T);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_folder_id_t);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &FolderId, sizeof(MSG_FOLDER_ID_T));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &FolderId, sizeof(msg_folder_id_t));
// Send Command to Messaging FW
char* pEventData = NULL;
}
-MSG_ERROR_T MsgHandle::getFolderList(MSG_FOLDER_LIST_S *pFolderList)
+msg_error_t MsgHandle::getFolderList(msg_struct_list_s *pFolderList)
{
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S);
}
-MSG_ERROR_T MsgHandle::getThreadViewList(const MSG_SORT_RULE_S *pSortRule, MSG_THREAD_VIEW_LIST_S *pThreadViewList)
+msg_error_t MsgHandle::getThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList)
{
- MSG_ERROR_T err = MSG_SUCCESS;
+ msg_error_t err = MSG_SUCCESS;
err = MsgStoConnectDB();
return err;
}
+msg_error_t MsgHandle::getConversationViewItem(msg_message_id_t MsgId, MSG_CONVERSATION_VIEW_S *pConv)
+{
+ MSG_BEGIN();
+
+ msg_error_t err = MSG_SUCCESS;
-MSG_ERROR_T MsgHandle::getConversationViewList(MSG_THREAD_ID_T ThreadId, MSG_LIST_S *pConvViewList)
+ MsgStoConnectDB();
+ err = MsgStoGetConversationViewItem(MsgId, pConv);
+ MsgStoDisconnectDB();
+
+ return err;
+}
+
+msg_error_t MsgHandle::getConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList)
{
MSG_BEGIN();
- MSG_ERROR_T err = MSG_SUCCESS;
+ msg_error_t err = MSG_SUCCESS;
MsgStoConnectDB();
err = MsgStoGetConversationViewList(ThreadId, pConvViewList);
// Update Read Status for the Thead ID
+#if 1
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_THREAD_ID_T);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_thread_id_t);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &ThreadId, sizeof(MSG_THREAD_ID_T));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &ThreadId, sizeof(msg_thread_id_t));
// Send Command to Messaging FW
char* pEventData = NULL;
{
THROW(MsgException::INVALID_RESULT, "Event Data Error");
}
+#endif
MSG_END();
}
-MSG_ERROR_T MsgHandle::deleteThreadMessageList(MSG_THREAD_ID_T ThreadId)
+msg_error_t MsgHandle::deleteThreadMessageList(msg_thread_id_t ThreadId, bool include_protected_msg)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_THREAD_LIST_INDEX_S);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_thread_id_t) + sizeof(bool);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &ThreadId, sizeof(MSG_THREAD_ID_T));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &ThreadId, sizeof(msg_thread_id_t));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_thread_id_t)), &include_protected_msg, sizeof(bool));
// Send Command to Messaging FW
char* pEventData = NULL;
}
-MSG_ERROR_T MsgHandle::getQuickPanelData(MSG_QUICKPANEL_TYPE_T Type, MSG_MESSAGE_S *pMsg)
+msg_error_t MsgHandle::getQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE_HIDDEN_S *pMsg)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_QUICKPANEL_TYPE_T);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_quickpanel_type_t);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &Type, sizeof(MSG_QUICKPANEL_TYPE_T));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &Type, sizeof(msg_quickpanel_type_t));
// Send Command to Messaging FW
char* pEventData = NULL;
// Decode Return Data
MSG_MESSAGE_INFO_S msgInfo;
- memcpy(&msgInfo, (void*)((char*)pEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(MSG_ERROR_T)), sizeof(MSG_MESSAGE_INFO_S));
+ memcpy(&msgInfo, (void*)((char*)pEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)), sizeof(MSG_MESSAGE_INFO_S));
// Covert MSG_MESSAGE_INFO_S to MSG_MESSAGE_S
convertMsgStruct(&msgInfo, pMsg);
}
-MSG_ERROR_T MsgHandle::resetDatabase()
+msg_error_t MsgHandle::resetDatabase()
{
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S);
}
-MSG_ERROR_T MsgHandle::getMemSize(unsigned int* memsize)
+msg_error_t MsgHandle::getMemSize(unsigned int* memsize)
{
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S);
return MSG_SUCCESS;
}
-
-MSG_ERROR_T MsgHandle::searchMessage(const char *pSearchString, MSG_THREAD_VIEW_LIST_S *pThreadViewList)
+msg_error_t MsgHandle::backupMessage(msg_message_backup_type_t type, const char *backup_filepath)
{
- MSG_ERROR_T err = MSG_SUCCESS;
+ if (backup_filepath == NULL)
+ return MSG_ERR_NULL_POINTER;
+
+ //Create an empty file for writing.
+ //If a file with the same name already exists its content is erased
+ //and the file is treated as a new empty file.
+ FILE *pFile = MsgOpenFile(backup_filepath, "w");
+ if (pFile == NULL) {
+ MSG_DEBUG("File Open error");
+ return MSG_ERR_STORAGE_ERROR;
+ }
+ MsgCloseFile(pFile);
- err = MsgStoConnectDB();
+ char path[MSG_FILEPATH_LEN_MAX+1] = {0,};
+ strncpy(path, backup_filepath, MSG_FILEPATH_LEN_MAX);
- if (err != MSG_SUCCESS)
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_backup_type_t) + sizeof(path);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_BACKUP_MESSAGE;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &type, sizeof(msg_message_backup_type_t));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_backup_type_t)), (char *)path, sizeof(path));
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_BACKUP_MESSAGE)
{
- MSG_DEBUG("MsgStoConnectDB() Error!!");
- return err;
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
}
- err = MsgStoSearchMessage(pSearchString, pThreadViewList);
+ if(pEvent->result != MSG_SUCCESS) return pEvent->result;
- if (err != MSG_SUCCESS)
+ return MSG_SUCCESS;
+}
+
+msg_error_t MsgHandle::restoreMessage(const char *backup_filepath)
+{
+ if (backup_filepath == NULL)
+ return MSG_ERR_NULL_POINTER;
+
+ if (MsgAccessFile(backup_filepath, R_OK) == false) {
+ MSG_DEBUG("File access error");
+ return MSG_ERR_UNKNOWN;
+ }
+
+ char path[MSG_FILEPATH_LEN_MAX+1] = {0,};
+ strncpy(path, backup_filepath, MSG_FILEPATH_LEN_MAX);
+
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(path);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_RESTORE_MESSAGE;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), (char *)path, sizeof(path));
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_RESTORE_MESSAGE)
{
- MSG_DEBUG("MsgStoSearchMessage() Error!!");
- return err;
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
}
- MsgStoDisconnectDB();
+ if(pEvent->result != MSG_SUCCESS) return pEvent->result;
- return err;
+ return MSG_SUCCESS;
}
-MSG_ERROR_T MsgHandle::searchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, MSG_LIST_S *pMsgList)
+msg_error_t MsgHandle::searchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList)
{
- MSG_ERROR_T err = MSG_SUCCESS;
+ msg_error_t err = MSG_SUCCESS;
err = MsgStoConnectDB();
- if (err != MSG_SUCCESS) {
+ if (err != MSG_SUCCESS)
+ {
MSG_DEBUG("MsgStoConnectDB() Error!!");
return err;
}
- err = MsgStoSearchMessage(pSearchCon, offset, limit, pMsgList);
+ err = MsgStoSearchMessage(pSearchString, pThreadViewList);
- if (err != MSG_SUCCESS) {
+ if (err != MSG_SUCCESS)
+ {
MSG_DEBUG("MsgStoSearchMessage() Error!!");
return err;
}
}
-
-MSG_ERROR_T MsgHandle::getMsgIdList(MSG_REFERENCE_ID_T RefId, MSG_MSGID_LIST_S *pMsgIdList)
+msg_error_t MsgHandle::searchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList)
{
- MSG_ERROR_T err = MSG_SUCCESS;
+ msg_error_t err = MSG_SUCCESS;
err = MsgStoConnectDB();
- if (err != MSG_SUCCESS)
- {
+ if (err != MSG_SUCCESS) {
MSG_DEBUG("MsgStoConnectDB() Error!!");
return err;
}
- err = MsgStoGetMsgIdList(RefId, pMsgIdList);
+ err = MsgStoSearchMessage(pSearchCon, offset, limit, pMsgList);
- if (err != MSG_SUCCESS)
- {
+ if (err != MSG_SUCCESS) {
MSG_DEBUG("MsgStoSearchMessage() Error!!");
return err;
}
}
-MSG_ERROR_T MsgHandle::getRejectMsgList(const char *pNumber, MSG_REJECT_MSG_LIST_S *pRejectMsgList)
+msg_error_t MsgHandle::getRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList)
{
- MSG_ERROR_T err = MSG_SUCCESS;
+ msg_error_t err = MSG_SUCCESS;
err = MsgStoConnectDB();
}
-MSG_ERROR_T MsgHandle::regStorageChangeCallback(msg_storage_change_cb onStorageChange, void *pUserParam)
+msg_error_t MsgHandle::regStorageChangeCallback(msg_storage_change_cb onStorageChange, void *pUserParam)
{
if (!onStorageChange)
THROW(MsgException::INVALID_PARAM, "onStorageChange is null");
eventListener->start();
+ int clientFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+
+ if (clientFd < 0)
+ return MSG_ERR_TRANSPORT_ERROR;
+
if (eventListener->regStorageChangeEventCB(this, onStorageChange, pUserParam) == false) // callback was already registered, just return SUCCESS
return MSG_SUCCESS;
// Copy Cookie
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
- int listenerFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+ int listenerFd = clientFd;
MSG_DEBUG("remote fd %d", listenerFd);
return pEvent->result;
}
-
-MSG_ERROR_T MsgHandle::getReportStatus(MSG_MESSAGE_ID_T msg_id, MSG_REPORT_STATUS_INFO_S *pReport_status)
+msg_error_t MsgHandle::getReportStatus(msg_message_id_t msg_id, msg_struct_list_s *report_list)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_ID_T);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
// Copy Command Data
- memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &msg_id, sizeof(MSG_MESSAGE_ID_T));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &msg_id, sizeof(msg_message_id_t));
// Send Command to Messaging FW
char* pEventData = NULL;
if(pEvent->result != MSG_SUCCESS) return pEvent->result;
// Decode Return Data
- MsgDecodeReportStatus(pEvent->data, pReport_status);
+ MsgDecodeReportStatus(pEvent->data, report_list);
+
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t MsgHandle::getAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ err = MsgStoConnectDB();
+
+ if (err != MSG_SUCCESS)
+ {
+ MSG_DEBUG("MsgStoConnectDB() Error!!");
+ return err;
+ }
+
+ err = MsgStoGetAddressList(threadId, (msg_struct_list_s *)pAddrList);
+
+ if (err != MSG_SUCCESS)
+ {
+ MSG_DEBUG("MsgStoGetThreadViewList() Error!!");
+ return err;
+ }
+
+ MsgStoDisconnectDB();
+
+ return err;
+}
+
+
+msg_error_t MsgHandle::getThreadIdByAddress(msg_struct_list_s *pAddrList, msg_thread_id_t *pThreadId)
+{
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(pAddrList->nCount) + (sizeof(MSG_ADDRESS_INFO_S)*pAddrList->nCount);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_GET_THREAD_ID_BY_ADDRESS;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+ // Copy Command Data
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &pAddrList->nCount, sizeof(pAddrList->nCount));
+ int addSize = sizeof(MSG_ADDRESS_INFO_S);
+ for(int i=0; i<pAddrList->nCount; i++) {
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+sizeof(pAddrList->nCount)+(addSize*i)+MAX_COOKIE_LEN), ((msg_struct_s *)(pAddrList->msg_struct_info[i]))->data, sizeof(MSG_ADDRESS_INFO_S));
+ }
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_GET_THREAD_ID_BY_ADDRESS)
+ {
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
+ }
+
+ if(pEvent->result != MSG_SUCCESS) return pEvent->result;
+
+ // Decode Return Data
+ MsgDecodeThreadId(pEvent->data, pThreadId);
+
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t MsgHandle::getThread(msg_thread_id_t threadId, MSG_THREAD_VIEW_S* pThreadInfo)
+{
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_thread_id_t);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_GET_THREAD_INFO;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+ // Copy Command Data
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &threadId, sizeof(msg_thread_id_t));
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_GET_THREAD_INFO)
+ {
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
+ }
+
+ // Decode Return Data
+ MsgDecodeThreadInfo(pEvent->data, pThreadInfo);
+
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t MsgHandle::getMessageList(msg_folder_id_t folderId, msg_thread_id_t threadId, msg_message_type_t msgType, msg_storage_id_t storageId, msg_struct_list_s *pMsgList)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ err = MsgStoConnectDB();
+
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("MsgStoConnectDB() Error!!");
+ return err;
+ }
+
+ err = MsgStoGetMessageList(folderId, threadId, msgType, storageId, pMsgList);
+
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("MsgStoSearchMessage() Error!!");
+ return err;
+ }
+
+ MsgStoDisconnectDB();
+
+ return err;
+}
+
+
+int MsgHandle::addPushEvent(MSG_PUSH_EVENT_INFO_S *pPushEvent)
+{
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_PUSH_EVENT_INFO_S);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_ADD_PUSH_EVENT;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+ // Copy Command Data
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pPushEvent, sizeof(MSG_PUSH_EVENT_INFO_S));
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_ADD_PUSH_EVENT)
+ {
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
+ }
+
+ return pEvent->result;
+}
+
+
+int MsgHandle::deletePushEvent(MSG_PUSH_EVENT_INFO_S *pPushEvent)
+{
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_PUSH_EVENT_INFO_S);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_DELETE_PUSH_EVENT;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+ // Copy Command Data
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pPushEvent, sizeof(MSG_PUSH_EVENT_INFO_S));
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_DELETE_PUSH_EVENT)
+ {
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
+ }
+
+ return pEvent->result;
+}
+
+int MsgHandle::updatePushEvent(MSG_PUSH_EVENT_INFO_S *pSrc, MSG_PUSH_EVENT_INFO_S *pDst)
+{
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + 2 * sizeof(MSG_PUSH_EVENT_INFO_S);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_UPDATE_PUSH_EVENT;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+ // Copy Command Data
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pSrc, sizeof(MSG_PUSH_EVENT_INFO_S));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_PUSH_EVENT_INFO_S)), pDst, sizeof(MSG_PUSH_EVENT_INFO_S));
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_UPDATE_PUSH_EVENT)
+ {
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
+ }
+
+ return pEvent->result;
+}
+
+msg_error_t MsgHandle::getVobject(msg_message_id_t MsgId, void** encodedData)
+{
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
+ char *encode_data = NULL;
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_GET_MSG;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+ // Copy Command Data
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_GET_MSG)
+ {
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
+ }
+
+ if(pEvent->result != MSG_SUCCESS)
+ return pEvent->result;
+
+ // Decode Return Data
+ MSG_MESSAGE_INFO_S msgInfo = {0,};
+ MSG_SENDINGOPT_INFO_S sendOptInfo = {0,};
+
+ MsgDecodeMsgInfo(pEvent->data, &msgInfo, &sendOptInfo);
+
+ //Convert MSG_MESSAGE_INFO_S to
+ encode_data = MsgVMessageEncode(&msgInfo);
+ if (encode_data) {
+ *encodedData = (void*)encode_data;
+ } else {
+ MSG_DEBUG("Error Encode data");
+ *encodedData = NULL;
+ }
+
+ // Delete Temp File
+ if (msgInfo.bTextSms == false)
+ {
+ // Delete Temp File
+ MsgDeleteFile(msgInfo.msgData); //ipc
+ }
return MSG_SUCCESS;
}