modify update mms message
authorSeunghwan Lee <sh.cat.lee@samsung.com>
Tue, 15 Oct 2013 08:06:18 +0000 (17:06 +0900)
committerSeunghwan Lee <sh.cat.lee@samsung.com>
Tue, 15 Oct 2013 08:06:18 +0000 (17:06 +0900)
Change-Id: Ic9734ae26c2e603329a393f0ebea9a7db3a4bc01

plugin/mms_plugin/MmsPluginStorage.cpp

index c32b24b..a439b85 100755 (executable)
@@ -177,7 +177,7 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
        MmsMsg mmsMsg;
        MMS_MESSAGE_DATA_S mmsMsgData = {0,};
        char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,};
-
+       char raw_filedir[MSG_FILENAME_LEN_MAX+1] = {0,};
        bzero(&mmsMsg, sizeof(mmsMsg));
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -189,6 +189,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
        if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS)
                return MSG_ERR_DB_EXEC;
 
+       MSG_DEBUG("msg sub type = [%d]", pMsgInfo->msgType.subType);
+
        if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS) {
 
                if (_MsgMmsDeserializeMessageData(&mmsMsgData, pFileData) == false) {
@@ -214,6 +216,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
                }
 
                //preview data
+               MmsPluginStorage::instance()->removePreviewInfo(pMsgInfo->msgId); //remove exist previnfo
+
                err = MmsMakePreviewInfo(pMsgInfo->msgId, &mmsMsgData);
 
                err = getMsgText(&mmsMsgData, pMsgInfo->msgText);
@@ -224,6 +228,10 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
                        }
                }
 
+               snprintf(raw_filedir, sizeof(raw_filedir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId);
+               MsgRmRf(raw_filedir);
+               rmdir(raw_filedir);
+
                int size = 0;
 
                if (MsgGetFileSize(raw_filepath, &size) == false) {
@@ -233,6 +241,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
                }
 
                pMsgInfo->dataSize = size;
+
+               MmsReadMsgBody(pMsgInfo->msgId, true, false, NULL);
        }
 
        MmsReleaseMmsMsg(&mmsMsg);