From df5345476df9dcf6cbcb67cb75c16d70571951db Mon Sep 17 00:00:00 2001 From: Seunghwan Lee Date: Sat, 26 Jan 2013 13:29:13 +0900 Subject: [PATCH] Fixed Build Fail Problem --- plugin/mms_plugin/MmsPluginConnManWrapper.cpp | 1 + plugin/mms_plugin/MmsPluginStorage.cpp | 52 +++++++++++++++++++++++++++ plugin/mms_plugin/include/MmsPluginStorage.h | 2 ++ 3 files changed, 55 insertions(+) diff --git a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp index 0669661..e034a69 100755 --- a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp +++ b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include "MmsPluginConnManWrapper.h" #include "MmsPluginDebug.h" diff --git a/plugin/mms_plugin/MmsPluginStorage.cpp b/plugin/mms_plugin/MmsPluginStorage.cpp index 5c42c02..14eadc9 100755 --- a/plugin/mms_plugin/MmsPluginStorage.cpp +++ b/plugin/mms_plugin/MmsPluginStorage.cpp @@ -697,6 +697,16 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE MsgCloseFile(pFile); + int size = 0; + bzero(filePath, sizeof(filePath)); + snprintf((char *)filePath, MAX_FULL_PATH_SIZE+1, MSG_DATA_PATH"%d.mms", pMsgInfo->msgId); + if (MsgGetFileSize(filePath, &size) == false) { + THROW(MsgException::MMS_PLG_ERROR, "MMS Message MsgGetFileSize Error"); + } + + pMsgInfo->dataSize = size; + + MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type); MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib); @@ -1221,3 +1231,45 @@ msg_error_t MmsPluginStorage::insertPreviewInfo(int msgId, int type, char *value return MSG_SUCCESS; } + +msg_error_t MmsPluginStorage::removePreviewInfo(int msgId) +{ + char sqlQuery[MAX_QUERY_LEN + 1]; + char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; + + // remove thumbnail file + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), + "SELECT VALUE FROM %s " + "WHERE MSG_ID = %d AND (TYPE=%d OR TYPE=%d);", + MSGFW_MMS_PREVIEW_TABLE_NAME, msgId, MSG_MMS_ITEM_TYPE_IMG, MSG_MMS_ITEM_TYPE_VIDEO); + + if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) { + return MSG_ERR_DB_PREPARE; + } + + while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) { + + memset(filePath, 0x00, sizeof(filePath)); + strncpy(filePath, (char *)dbHandle.columnText(0), MSG_FILEPATH_LEN_MAX); + if (remove(filePath) == -1) + MSG_DEBUG("Fail to delete file [%s]", filePath); + else + MSG_DEBUG("Success to delete file [%s]", filePath); + } + + dbHandle.finalizeQuery(); + + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + //(MSG_ID INTEGER, TYPE INTEGER, INFO TEXT) + snprintf(sqlQuery, sizeof(sqlQuery), + "DELETE FROM %s WHERE MSG_ID= %d;", + MSGFW_MMS_PREVIEW_TABLE_NAME, msgId); + + MSG_DEBUG("QUERY : [%s]", sqlQuery); + + if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) + return MSG_ERR_DB_EXEC; + + return MSG_SUCCESS; +} diff --git a/plugin/mms_plugin/include/MmsPluginStorage.h b/plugin/mms_plugin/include/MmsPluginStorage.h index a5bd0c4..b1652fa 100755 --- a/plugin/mms_plugin/include/MmsPluginStorage.h +++ b/plugin/mms_plugin/include/MmsPluginStorage.h @@ -47,6 +47,8 @@ public: msg_error_t insertReadReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus); msg_error_t insertPreviewInfo(int msgId, int type, char *value, int count = 0); + msg_error_t removePreviewInfo(int msgId); + msg_error_t setReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus); msg_error_t plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg); msg_error_t getContentLocation(MSG_MESSAGE_INFO_S *pMsgInfo); -- 2.7.4