Merge from private.
authorSangkoo Kim <sangkoo.kim@samsung.com>
Thu, 25 Oct 2012 06:06:27 +0000 (15:06 +0900)
committerSangkoo Kim <sangkoo.kim@samsung.com>
Thu, 25 Oct 2012 17:10:43 +0000 (02:10 +0900)
Change-Id: I430d3546541d8bd946aea5e15223ef52e82edf16

96 files changed:
CMakeLists.txt
framework/deliver-handler/MsgDeliverHandler.cpp
framework/plugin-manager/MsgPluginManager.cpp
framework/setting-handler/MsgSettingHandler.cpp
framework/storage-handler/MsgStorageFilter.cpp
framework/storage-handler/MsgStorageManager.cpp
framework/storage-handler/MsgStorageMessage.cpp
framework/storage-handler/MsgStorageMms.cpp
framework/storage-handler/MsgStorageUtil.cpp
framework/submit-handler/MsgSubmitHandler.cpp
framework/transaction-manager/MsgCmdHandlerFilter.cpp
framework/transaction-manager/MsgCmdHandlerStorage.cpp
framework/transaction-manager/MsgCmdHandlerTransport.cpp
framework/transaction-manager/MsgTransManager.cpp
include/common/MsgCmdTypes.h
include/common/MsgFilterTypes.h
include/common/MsgInternalTypes.h
include/common/MsgTypes.h
include/framework/MsgCmdHandler.h
include/framework/MsgStorageHandler.h
include/mapi/msg.h
include/mapi/msg_private.h
include/mapi/msg_storage.h
include/mapi/msg_types.h
include/msg_helper/MsgHelper.h
include/proxy/MsgHandle.h
include/proxy/MsgProxyListener.h
include/utils/MsgGconfWrapper.h
include/utils/MsgIpcSocket.h
include/utils/MsgNotificationWrapper.h
include/utils/MsgSqliteWrapper.h
include/utils/MsgTextConvert.h [moved from plugin/sms_plugin/include/SmsPluginTextConvert.h with 91% similarity]
include/utils/MsgUtilFunction.h
include/utils/MsgUtilStorage.h
mapi/msg_filter.cpp
mapi/msg_message.cpp
mapi/msg_mms.cpp
mapi/msg_storage.cpp
mapi/msg_svc.cpp
mms-plugin.manifest [new file with mode: 0755]
msg-service-tools.manifest [new file with mode: 0755]
msg-service.manifest [new file with mode: 0755]
packaging/msg-service.service [new file with mode: 0644]
packaging/msg-service.spec
plugin/mms_plugin/LanguagePack/MmsPluginWmLngLatinUni.cpp
plugin/mms_plugin/MmsPluginContentCodec.cpp
plugin/mms_plugin/MmsPluginDebug.cpp
plugin/mms_plugin/MmsPluginDecode.cpp
plugin/mms_plugin/MmsPluginDrm.cpp
plugin/mms_plugin/MmsPluginEncode.cpp
plugin/mms_plugin/MmsPluginEventHandler.cpp
plugin/mms_plugin/MmsPluginHttp.cpp
plugin/mms_plugin/MmsPluginInternal.cpp
plugin/mms_plugin/MmsPluginMessage.cpp
plugin/mms_plugin/MmsPluginSmil.cpp
plugin/mms_plugin/MmsPluginStorage.cpp
plugin/mms_plugin/MmsPluginUserAgent.cpp
plugin/mms_plugin/MmsPluginUtil.cpp [new file with mode: 0755]
plugin/mms_plugin/include/MmsPluginDebug.h
plugin/mms_plugin/include/MmsPluginMessage.h
plugin/mms_plugin/include/MmsPluginStorage.h
plugin/mms_plugin/include/MmsPluginUserAgent.h
plugin/mms_plugin/include/MmsPluginUtil.h [new file with mode: 0755]
plugin/sms_plugin/CMakeLists.txt
plugin/sms_plugin/SmsPluginCallback.cpp
plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
plugin/sms_plugin/SmsPluginConcatHandler.cpp
plugin/sms_plugin/SmsPluginEventHandler.cpp
plugin/sms_plugin/SmsPluginMain.cpp
plugin/sms_plugin/SmsPluginParamCodec.cpp
plugin/sms_plugin/SmsPluginSatHandler.cpp
plugin/sms_plugin/SmsPluginSetting.cpp
plugin/sms_plugin/SmsPluginSimMsg.cpp
plugin/sms_plugin/SmsPluginStorage.cpp
plugin/sms_plugin/SmsPluginTransport.cpp
plugin/sms_plugin/SmsPluginWapPushHandler.cpp
plugin/sms_plugin/include/SmsPluginCallback.h
plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
plugin/sms_plugin/include/SmsPluginConcatHandler.h
plugin/sms_plugin/include/SmsPluginEventHandler.h
plugin/sms_plugin/include/SmsPluginSetting.h
plugin/sms_plugin/include/SmsPluginTransport.h
plugin/sms_plugin/include/SmsPluginTypes.h
proxy/MsgHandleControl.cpp
proxy/MsgHandleFilter.cpp
proxy/MsgHandleStorage.cpp
proxy/MsgProxyListener.cpp
sms-plugin.manifest [new file with mode: 0755]
utils/MsgGconfWrapper.cpp
utils/MsgIpcSocket.cpp
utils/MsgNotificationWrapper.cpp
utils/MsgSpamFilter.cpp
utils/MsgTextConvert.cpp [moved from plugin/sms_plugin/SmsPluginTextConvert.cpp with 81% similarity]
utils/MsgUtilFile.cpp
utils/MsgUtilFunction.cpp
utils/MsgUtilStorage.cpp

index d6b9892..78c3582 100755 (executable)
@@ -56,3 +56,7 @@ INSTALL(FILES ${CMAKE_BINARY_DIR}/msg-service.pc DESTINATION lib/pkgconfig)
 SET(RC_LOCAL_SCRIPT msg-server)
 INSTALL(PROGRAMS ${RC_LOCAL_SCRIPT} DESTINATION /etc/rc.d/init.d)
 
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/msg-service.service DESTINATION /usr/lib/systemd/user)
+
+# LICENSE file
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license/msg-service)
index 8e0af31..3ca4c52 100755 (executable)
@@ -133,7 +133,7 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques
                        return MSG_ERR_STORAGE_ERROR;
 
                MSG_DEBUG("pMsg->networkStatus : %d", pMsgInfo->networkStatus);
-               err = MsgStoUpdateNetworkStatus(pMsgInfo, pMsgInfo->networkStatus);
+               err = MsgStoUpdateNetworkStatus(&dbHandle, pMsgInfo, pMsgInfo->networkStatus);
                if (err != MSG_SUCCESS)
                        return MSG_ERR_STORAGE_ERROR;
 
@@ -166,6 +166,14 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti)
                {
                        MsgSoundPlayStart();
 
+                       if (pMsgInfo->msgType.subType >= MSG_MWI_VOICE_SMS && pMsgInfo->msgType.subType <= MSG_MWI_OTHER_SMS) {
+                               if (pMsgInfo->bStore == false) {
+                                       MsgInsertNoti(pMsgInfo);
+                                       *pSendNoti = false;
+                                       return err;
+                               }
+                       }
+
                        int smsCnt = 0, mmsCnt = 0;
 
                        smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE);
@@ -276,11 +284,11 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti)
                        break;
 
                        case MSG_WAP_SI_SMS:
+                               *pSendNoti = true;
+                               break;
                        case MSG_WAP_CO_SMS:
-                       {
                                *pSendNoti = false;
-                       }
-                       break;
+                               break;
                }
        } else if (pMsgInfo->msgType.subType == MSG_STATUS_REPORT_SMS) {
                msg_thread_id_t convId = 0;
index f872f65..6c0197f 100755 (executable)
@@ -63,7 +63,7 @@ void MsgSentStatusListener(MSG_SENT_STATUS_S *pSentStatus)
 
        char *temp = NULL;
        AutoPtr<char> wrap(&temp);
-       int len;
+       unsigned int len;
        client.read(&temp, &len);
 
        // close connection to msgfw daemon
@@ -107,7 +107,7 @@ void MsgStorageChangeListener(msg_storage_change_type_t storageChangeType, MSG_M
 
        char *temp = NULL;
        AutoPtr<char> wrap(&temp);
-       int len;
+       unsigned int len;
        client.read(&temp, &len);
 
        // close connection to msgfw daemon
@@ -155,7 +155,7 @@ msg_error_t MsgIncomingMessageListener(MSG_MESSAGE_INFO_S *pMsg)
 
        char* retBuf = NULL;
        AutoPtr<char> wrap(&retBuf);
-       int retSize;
+       unsigned int retSize;
 
        client.read(&retBuf, &retSize);
 
@@ -205,7 +205,7 @@ msg_error_t MsgIncomingSyncMLMessageListener(MSG_SYNCML_MESSAGE_DATA_S *pSyncMLD
        // Receive result from Transaction Manager
        char* retBuf = NULL;
        AutoPtr<char> wrap(&retBuf);
-       int retSize;
+       unsigned int retSize;
        client.read(&retBuf, &retSize);
 
        // close connection to msgfw daemon
@@ -253,7 +253,7 @@ msg_error_t MsgIncomingPushMessageListener(MSG_PUSH_MESSAGE_DATA_S *pPushData)
        // Receive result from Transaction Manager
        char* retBuf = NULL;
        AutoPtr<char> wrap(&retBuf);
-       int retSize;
+       unsigned int retSize;
        client.read(&retBuf, &retSize);
 
        // close connection to msgfw daemon
@@ -310,7 +310,7 @@ msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg)
 
        char* retBuf = NULL;
        AutoPtr<char> wrap(&retBuf);
-       int retSize;
+       unsigned int retSize;
 
        client.read(&retBuf, &retSize);
 
@@ -360,7 +360,7 @@ msg_error_t MsgIncomingLBSMessageListener(MSG_LBS_MESSAGE_DATA_S *pLBSData)
        // Receive result from Transaction Manager
        char* retBuf = NULL;
        AutoPtr<char> wrap(&retBuf);
-       int retSize;
+       unsigned int retSize;
        client.read(&retBuf, &retSize);
 
        // close connection to msgfw daemon
@@ -404,7 +404,7 @@ msg_error_t MsgInitSimBySatListener()
        // Receive result from Transaction Manager
        char* retBuf = NULL;
        AutoPtr<char> wrap(&retBuf);
-       int retSize;
+       unsigned int retSize;
        client.read(&retBuf, &retSize);
 
        // close connection to msgfw daemon
@@ -455,7 +455,7 @@ msg_error_t MsgMmsConfIncomingListener(MSG_MESSAGE_INFO_S *pMsg, msg_request_id_
        // Receive result from Transaction Manager
        char *retBuf = NULL;
        AutoPtr<char> wrap(&retBuf);
-       int retSize = 0;
+       unsigned int retSize = 0;
        client.read(&retBuf, &retSize);
 
        // close connection to msgfw daemon
@@ -485,7 +485,7 @@ MsgPlugin::MsgPlugin(MSG_MAIN_TYPE_T mainType, const char *libPath): mSupportedM
        if (libPath == NULL)
                THROW(MsgException::INVALID_PARAM, "libPath NULL");
 
-        void* libHandle = NULL;
+       void* libHandle = NULL;
 
        libHandle = dlopen(libPath, RTLD_NOW);
 
index 247dd89..a9d46a6 100755 (executable)
@@ -1094,46 +1094,46 @@ void MsgGetCBMsgOpt(MSG_SETTING_S *pSetting)
 
 void MsgGetVoiceMailOpt(MSG_SETTING_S *pSetting)
 {
-        char *tmpValue = NULL;
+       char *tmpValue = NULL;
 
-        memset(&(pSetting->option.voiceMailOpt), 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
+       memset(&(pSetting->option.voiceMailOpt), 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
 
-        tmpValue = MsgSettingGetString(VOICEMAIL_NUMBER);
-        if (tmpValue != NULL) {
-                strncpy(pSetting->option.voiceMailOpt.mailNumber, tmpValue, MAX_PHONE_NUMBER_LEN);
-                free(tmpValue);
-                tmpValue = NULL;
-        }
+       tmpValue = MsgSettingGetString(VOICEMAIL_NUMBER);
+       if (tmpValue != NULL) {
+               strncpy(pSetting->option.voiceMailOpt.mailNumber, tmpValue, MAX_PHONE_NUMBER_LEN);
+               free(tmpValue);
+               tmpValue = NULL;
+       }
 }
 
 
 void MsgGetMsgSizeOpt(MSG_SETTING_S *pSetting)
 {
-        memset(&(pSetting->option.msgSizeOpt), 0x00, sizeof(MSG_MSGSIZE_OPT_S));
+       memset(&(pSetting->option.msgSizeOpt), 0x00, sizeof(MSG_MSGSIZE_OPT_S));
 
-        pSetting->option.msgSizeOpt.nMsgSize = MsgSettingGetInt(MSGSIZE_OPTION);
+       pSetting->option.msgSizeOpt.nMsgSize = MsgSettingGetInt(MSGSIZE_OPTION);
 }
 
 
 msg_error_t MsgSetConfigInSim(const MSG_SETTING_S *pSetting)
 {
-        msg_error_t err = MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-        MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE);
+       MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE);
 
-        // Get Setting Data from SIM
-        if (plg != NULL)
-                err = plg->setConfigData(pSetting);
-        else
-                err = MSG_ERR_NULL_POINTER;
+       // Get Setting Data from SIM
+       if (plg != NULL)
+               err = plg->setConfigData(pSetting);
+       else
+               err = MSG_ERR_NULL_POINTER;
 
-        if (err != MSG_SUCCESS)
-        {
-                MSG_DEBUG("Error. Error code is %d.", err);
-                return err;
-        }
+       if (err != MSG_SUCCESS)
+       {
+               MSG_DEBUG("Error. Error code is %d.", err);
+               return err;
+       }
 
-        return err;
+       return err;
 }
 
 static char* msg_clean_country_code(char *src)
index ac18aa6..beed1d2 100755 (executable)
@@ -85,7 +85,7 @@ msg_error_t MsgStoAddFilter(const MSG_FILTER_S *pFilter)
        // Add Filter
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, ?);",
+       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, ?, 1);",
                        MSGFW_FILTER_TABLE_NAME, rowId, pFilter->filterType);
 
        MSG_DEBUG("sql : %s", sqlQuery);
@@ -183,14 +183,14 @@ msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList)
                return MSG_ERR_NULL_POINTER;
        }
 
-       int rowCnt = 0, index = 3;
+       int rowCnt = 0, index = 4;
 
        char sqlQuery[MAX_QUERY_LEN+1];
 
        // Get filters from DB
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID, FILTER_TYPE, FILTER_VALUE FROM %s;", MSGFW_FILTER_TABLE_NAME);
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID, FILTER_TYPE, FILTER_VALUE, FILTER_ACTIVE FROM %s;", MSGFW_FILTER_TABLE_NAME);
 
        msg_error_t err = MSG_SUCCESS;
 
@@ -229,6 +229,7 @@ msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList)
                pFilter->filterType = dbHandle.getColumnToInt(index++);
                memset(pFilter->filterValue, 0x00, sizeof(pFilter->filterValue));
                dbHandle.getColumnToString(index++, MAX_FILTER_VALUE_LEN, pFilter->filterValue);
+               pFilter->bActive = dbHandle.getColumnToInt(index++);
        }
 
 
@@ -238,3 +239,27 @@ msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList)
 
        return MSG_SUCCESS;
 }
+
+
+msg_error_t MsgStoSetFilterActivation(msg_filter_id_t filterId, bool bActive)
+{
+       MSG_BEGIN();
+
+       char sqlQuery[MAX_QUERY_LEN+1];
+
+       // Set Filter Activation
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+       snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET FILTER_ACTIVE = %d WHERE FILTER_ID = %d;",
+                       MSGFW_FILTER_TABLE_NAME, bActive, filterId);
+
+       MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+
+       if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+               return MSG_ERR_DB_EXEC;
+       }
+
+       MSG_END();
+
+       return MSG_SUCCESS;
+}
index 944f234..1bdb0dc 100755 (executable)
@@ -256,10 +256,6 @@ msg_error_t MsgCreateMsgTable()
                                MSG_DATA TEXT , \
                                THUMB_PATH TEXT , \
                                MSG_TEXT TEXT , \
-                               DELIVERY_REPORT_STATUS INTEGER DEFAULT 0 , \
-                               DELIVERY_REPORT_TIME DATETIME , \
-                               READ_REPORT_STATUS INTEGER DEFAULT 0 , \
-                               READ_REPORT_TIME DATETIME , \
                                ATTACHMENT_COUNT INTEGER DEFAULT 0 , \
                                FOREIGN KEY(CONV_ID) REFERENCES %s (CONV_ID) , \
                                FOREIGN KEY(FOLDER_ID) REFERENCES %s (FOLDER_ID) );",
@@ -437,7 +433,8 @@ msg_error_t MsgCreateFilterTable()
                                "CREATE TABLE %s ( \
                                FILTER_ID INTEGER PRIMARY KEY , \
                                FILTER_TYPE INTEGER NOT NULL , \
-                               FILTER_VALUE TEXT NOT NULL );",
+                               FILTER_VALUE TEXT NOT NULL , \
+                               FILTER_ACTIVE INTEGER DEFAULT 0);",
                                MSGFW_FILTER_TABLE_NAME);
 
                err = dbHandle.execQuery(sqlQuery);
@@ -862,3 +859,103 @@ msg_error_t MsgStoRestoreMessage()
 {
        return MSG_SUCCESS;
 }
+
+msg_error_t MsgStoAddPushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent)
+{
+       msg_error_t err = MSG_SUCCESS;
+       char sqlQuery[MAX_QUERY_LEN+1];
+       unsigned int rowId = 0;
+
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+       // Check whether Same record exists or not.
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s' AND (PKG_NAME LIKE '%s' OR SECURE = 1);",
+                       MSGFW_PUSH_CONFIG_TABLE_NAME, pPushEvent->contentType, pPushEvent->appId, pPushEvent->pkgName);
+
+       if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
+               MSG_DEBUG("Query Failed [%s]", sqlQuery);
+               return MSG_ERR_DB_PREPARE;
+       }
+
+       if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) {
+               dbHandle.finalizeQuery();
+               return MSG_ERR_DB_ROW;
+       }
+       dbHandle.finalizeQuery();
+
+       dbHandle.beginTrans();
+       err = dbHandle.getRowId(MSGFW_PUSH_CONFIG_TABLE_NAME, &rowId);
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, ?, ?, ?, %d, 0, 0);",
+                       MSGFW_PUSH_CONFIG_TABLE_NAME, rowId, pPushEvent->bLaunch);
+
+
+       MSG_DEBUG("QUERY : %s", sqlQuery);
+
+       if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
+               dbHandle.endTrans(false);
+               return MSG_ERR_DB_EXEC;
+       }
+
+       dbHandle.bindText(pPushEvent->contentType, 1);
+       dbHandle.bindText(pPushEvent->appId, 2);
+       dbHandle.bindText(pPushEvent->pkgName, 3);
+
+       if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) {
+               dbHandle.finalizeQuery();
+               dbHandle.endTrans(false);
+               return MSG_ERR_DB_EXEC;
+       }
+
+       dbHandle.finalizeQuery();
+       dbHandle.endTrans(true);
+
+       return MSG_SUCCESS;
+}
+
+
+msg_error_t MsgStoDeletePushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent)
+{
+       char sqlQuery[MAX_QUERY_LEN+1];
+       dbHandle.beginTrans();
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+       snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s' AND PKG_NAME LIKE '%s';",
+                       MSGFW_PUSH_CONFIG_TABLE_NAME, pPushEvent->contentType, pPushEvent->appId, pPushEvent->pkgName);
+
+       if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+               dbHandle.endTrans(false);
+               return MSG_ERR_DB_EXEC;
+       }
+       dbHandle.endTrans(true);
+       return MSG_SUCCESS;
+}
+
+msg_error_t MsgStoUpdatePushEvent(MSG_PUSH_EVENT_INFO_S* pSrc, MSG_PUSH_EVENT_INFO_S* pDst)
+{
+       char sqlQuery[MAX_QUERY_LEN+1];
+       dbHandle.beginTrans();
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+       snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET CONTENT_TYPE = ?, APP_ID = ?, PKG_NAME = ?, LAUNCH = %d WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s' AND PKG_NAME LIKE '%s';",
+                       MSGFW_PUSH_CONFIG_TABLE_NAME, pDst->bLaunch, pSrc->contentType, pSrc->appId, pSrc->pkgName);
+
+       if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
+               dbHandle.endTrans(false);
+               return MSG_ERR_DB_EXEC;
+       }
+
+       dbHandle.bindText(pDst->contentType, 1);
+       dbHandle.bindText(pDst->appId, 2);
+       dbHandle.bindText(pDst->pkgName, 3);
+
+       if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) {
+               dbHandle.finalizeQuery();
+               dbHandle.endTrans(false);
+               return MSG_ERR_DB_EXEC;
+       }
+
+       dbHandle.finalizeQuery();
+       dbHandle.endTrans(true);
+
+       return MSG_SUCCESS;
+}
index 6630f54..f5e2913 100755 (executable)
@@ -244,10 +244,10 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS
        // Add Message
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, %d, 0, %d, 0, 0);",
+       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, 0, 0, 0);",
                        MSGFW_MESSAGE_TABLE_NAME, rowId, convId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType,
                        pMsg->displayTime, pMsg->dataSize, pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction,
-                       0, pMsg->bBackup, MSG_DELIVERY_REPORT_NONE, MSG_READ_REPORT_NONE);
+                       0, pMsg->bBackup);
 
        MSG_DEBUG("QUERY : %s", sqlQuery);
 
@@ -291,18 +291,9 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS
                MMS_MESSAGE_DATA_S mmsMsg;
                memset(&mmsMsg, 0x00, sizeof(MMS_MESSAGE_DATA_S));
 
-               if (pMsg->dataSize == 0) {
-                       MSG_DEBUG("pMsg->dataSize == 0, So Making emtpy MMS body.");
-                       char * tempMmsBody = _MsgMmsSerializeMessageData(&mmsMsg, &(pMsg->dataSize));
-                       memcpy(&pMsg->msgText, tempMmsBody, pMsg->dataSize);
-                       free(tempMmsBody);
-               }
-
                if (pMsg->msgType.subType != MSG_DELIVERYIND_MMS && pMsg->msgType.subType != MSG_READORGIND_MMS) {
                        MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE);
 
-                       //pMsg->msgId = pMsg->refernceId;
-
                        err = plg->addMessage(pMsg, pSendOptInfo, pFileData);
 
                        if (err != MSG_SUCCESS)
@@ -790,7 +781,6 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication)
        } else if (msgType.mainType == MSG_MMS_TYPE) {
 
                char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
-               char thumbnailpath[MSG_FILEPATH_LEN_MAX] = {0,};
                char dirPath[MSG_FILEPATH_LEN_MAX]= {0,};
 
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -816,16 +806,6 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication)
 
                        rmdir(dirPath);
 
-                       // remove thumbnail file
-                       char *fileName = NULL;
-                       fileName = strrchr(filePath, '/');
-
-                       snprintf(thumbnailpath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.jpg", fileName+1);
-                       if(remove(thumbnailpath) == -1)
-                               MSG_DEBUG("Fail to delete thumbnail [%s]", thumbnailpath);
-                       else
-                               MSG_DEBUG("Success to delete thumbnail [%s]", thumbnailpath);
-
                } else {
                        MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery);
                        dbHandle.finalizeQuery();
@@ -835,6 +815,38 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication)
 
                dbHandle.finalizeQuery();
 
+               // 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) {
+                       dbHandle.endTrans(false);
+                       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));
+               snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
+                               MSGFW_MMS_PREVIEW_TABLE_NAME, msgId);
+
+               if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+                       dbHandle.endTrans(false);
+                       return MSG_ERR_DB_EXEC;
+               }
+
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
                                MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId);
@@ -844,6 +856,16 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication)
                        dbHandle.endTrans(false);
                        return MSG_ERR_DB_EXEC;
                }
+
+               memset(sqlQuery, 0x00, sizeof(sqlQuery));
+               snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
+                               MSGFW_REPORT_TABLE_NAME, msgId);
+
+               // Delete Data from MMS STATUS table
+               if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+                       dbHandle.endTrans(false);
+                       return MSG_ERR_DB_EXEC;
+               }
        }
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -911,7 +933,8 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD
 
        const char *tableList[] = {MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_CB_MSG_TABLE_NAME,
                                                MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_SMS_SENDOPT_TABLE_NAME, 
-                                               MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME};
+                                               MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MMS_PREVIEW_TABLE_NAME, 
+                                               MSGFW_REPORT_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME};
 
        int listCnt = sizeof(tableList)/sizeof(char *);
        int rowCnt = 0;
@@ -1031,7 +1054,6 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD
 
                        char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
                        char dirPath[MSG_FILEPATH_LEN_MAX] = {0,};
-                       char thumbnailPath[MSG_FILEPATH_LEN_MAX] = {0,};
 
                        //get mms msg id list
                        memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -1071,23 +1093,37 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD
                                MsgRmRf(dirPath);
 
                                rmdir(dirPath);
-                               // delete thumbnail
 
-                               char *fileName = NULL;
-                               fileName = strrchr(filePath, '/');
+                       }
 
-                               snprintf(thumbnailPath, sizeof(thumbnailPath), MSG_THUMBNAIL_PATH"%s.jpg", fileName+1);
+                       dbHandle.freeTable();
+               }
 
-                               if (remove(thumbnailPath) == -1)
-                                       MSG_DEBUG("Fail to delete thumbnail [%s]", thumbnailPath);
-                               else
-                                       MSG_DEBUG("Success to delete thumbnail [%s]", thumbnailPath);
+               // delete thumbnail
+               char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
+               memset(sqlQuery, 0x00, sizeof(sqlQuery));
+               snprintf(sqlQuery, sizeof(sqlQuery),
+                               "SELECT VALUE FROM %s "
+                               "WHERE (TYPE=%d OR TYPE=%d) "
+                               "AND (MSG_ID IN (SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d));",
+                               MSGFW_MMS_PREVIEW_TABLE_NAME, MSG_MMS_ITEM_TYPE_IMG, MSG_MMS_ITEM_TYPE_VIDEO, MSGFW_MESSAGE_TABLE_NAME, folderId);
 
-                       }
+               if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
+                       dbHandle.endTrans(false);
+                       return MSG_ERR_DB_PREPARE;
+               }
 
-                       dbHandle.freeTable();
+               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));
 
                snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID IN \
@@ -1212,6 +1248,244 @@ FREE_MEMORY:
 }
 
 
+msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList)
+{
+       MSG_BEGIN();
+       msg_error_t err = MSG_SUCCESS;
+
+       char sqlQuery[MAX_QUERY_LEN+1];
+       char whereQuery[MAX_QUERY_LEN+1];
+       char sqlQuerySubset[(MAX_QUERY_LEN/5)+1];
+
+       queue<msg_thread_id_t> threadList;
+
+       const char *tableList[] = {MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_CB_MSG_TABLE_NAME,
+                                               MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_SMS_SENDOPT_TABLE_NAME, 
+                                               MMS_PLUGIN_MESSAGE_TABLE_NAME,  MSGFW_MESSAGE_TABLE_NAME};
+
+       int listCnt = sizeof(tableList)/sizeof(char *);
+       int rowCnt = 0;
+
+       memset(whereQuery, 0x00, sizeof(whereQuery));
+
+       if (pMsgIdList->nCount < 1) {
+               return MSG_SUCCESS;
+       } else {
+               for (int i=0; i < pMsgIdList->nCount; i++) {
+                       memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset));
+                       if (i==0)
+                               snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "(MSG_ID = %d ", pMsgIdList->msgIdList[i]);
+                       else
+                               snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "OR MSG_ID = %d ", pMsgIdList->msgIdList[i]);
+                       strncat(whereQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(whereQuery));
+               }
+       }
+       strncat(whereQuery, ");", MAX_QUERY_LEN-strlen(whereQuery));
+
+       // Get conversation ID from Folder
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(CONV_ID) FROM %s WHERE ", MSGFW_MESSAGE_TABLE_NAME);
+       strncat(sqlQuery, whereQuery, MAX_QUERY_LEN-strlen(sqlQuery));
+
+       err = dbHandle.getTable(sqlQuery, &rowCnt);
+
+       if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+               MSG_DEBUG("sql query is %s.", sqlQuery);
+               dbHandle.freeTable();
+               return err;
+       }
+
+       if (rowCnt <= 0) {
+               dbHandle.freeTable();
+               return MSG_SUCCESS;
+       }
+
+       for (int i = 1; i <= rowCnt; i++) {
+               MSG_DEBUG("thread ID : %d", dbHandle.getColumnToInt(i));
+               threadList.push((msg_thread_id_t)dbHandle.getColumnToInt(i));
+       }
+
+       dbHandle.freeTable();
+
+       /*** Delete Sim Message In Folder **/
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE STORAGE_ID = %d AND ", MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_SIM);
+       strncat(sqlQuery, whereQuery, MAX_QUERY_LEN-strlen(sqlQuery));
+
+       rowCnt = 0;
+
+       err = dbHandle.getTable(sqlQuery, &rowCnt);
+
+       if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+               MSG_DEBUG("sql query is %s.", sqlQuery);
+               dbHandle.freeTable();
+               return err;
+       }
+
+       for (int i = 1; i <= rowCnt; i++) {
+               err = MsgStoDeleteMessage(dbHandle.getColumnToInt(i), false);
+
+               if (err != MSG_SUCCESS) {
+                       MSG_DEBUG("MsgStoDeleteMessage() Error!!!");
+                       dbHandle.freeTable();
+                       return err;
+               }
+       }
+
+       dbHandle.freeTable();
+       /*** **/
+
+       dbHandle.beginTrans();
+
+       for (int i = 0; i < listCnt; i++) {
+               if (!strcmp(tableList[i], MMS_PLUGIN_MESSAGE_TABLE_NAME)) {
+
+                       int rowCnt = 0;
+
+                       char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
+                       char dirPath[MSG_FILEPATH_LEN_MAX] = {0,};
+                       char thumbnailPath[MSG_FILEPATH_LEN_MAX] = {0,};
+
+                       //get mms msg id list
+                       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+                       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE ", MMS_PLUGIN_MESSAGE_TABLE_NAME);
+                       strncat(sqlQuery, whereQuery, MAX_QUERY_LEN-strlen(sqlQuery));
+
+                       err = dbHandle.getTable(sqlQuery, &rowCnt);
+                       MSG_DEBUG("rowCnt %d", rowCnt);
+
+                       if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+                               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+                               dbHandle.freeTable();
+                               dbHandle.endTrans(false);
+                               return err;
+                       }
+
+                       for (int i = 1; i <= rowCnt; i++) {
+                               memset(filePath, 0x00, sizeof(filePath));
+                               dbHandle.getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath);
+
+                               MSG_DEBUG("filePath [%s]", filePath);
+
+                               //delete raw file
+                               snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath);
+
+                               if (remove(filePath) == -1)
+                                       MSG_DEBUG("Fail to delete file [%s]", filePath);
+                               else
+                                       MSG_DEBUG("Success to delete file [%s]", filePath);
+
+                               MsgRmRf(dirPath);
+
+                               rmdir(dirPath);
+                               // delete thumbnail
+
+                               char *fileName = NULL;
+                               fileName = strrchr(filePath, '/');
+
+                               snprintf(thumbnailPath, sizeof(thumbnailPath), MSG_THUMBNAIL_PATH"%s.jpg", fileName+1);
+
+                               if (remove(thumbnailPath) == -1)
+                                       MSG_DEBUG("Fail to delete thumbnail [%s]", thumbnailPath);
+                               else
+                                       MSG_DEBUG("Success to delete thumbnail [%s]", thumbnailPath);
+                       }
+
+                       dbHandle.freeTable();
+               }
+
+               memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+               snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE ", tableList[i]);
+               strncat(sqlQuery, whereQuery, MAX_QUERY_LEN-strlen(sqlQuery));
+
+               // Delete Message in specific folder from table
+               err = dbHandle.execQuery(sqlQuery);
+               if (err != MSG_SUCCESS) {
+                       MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+                       dbHandle.endTrans(false);
+                       return err;
+               }
+       }
+
+       // Clear Conversation table
+       err = MsgStoClearConversationTable(&dbHandle);
+       if (err != MSG_SUCCESS) {
+               dbHandle.endTrans(false);
+               return err;
+       }
+
+       // Update Address
+       while (!threadList.empty()) {
+               err = MsgStoUpdateConversation(&dbHandle, threadList.front());
+
+               threadList.pop();
+
+               if (err != MSG_SUCCESS) {
+                       dbHandle.endTrans(false);
+                       return err;
+               }
+       }
+
+       dbHandle.endTrans(true);
+
+       int smsCnt = 0;
+       int mmsCnt = 0;
+
+       smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE);
+       mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE);
+
+       MsgSettingSetIndicator(smsCnt, mmsCnt);
+
+/*** Create thread  for noti and phone log delete. **/
+       if (pMsgIdList->nCount > 0) {
+               msg_id_list_s *pToDeleteMsgIdList = NULL;
+               pToDeleteMsgIdList = (msg_id_list_s *)new char[sizeof(msg_id_list_s)];
+               memset(pToDeleteMsgIdList, 0x00, sizeof(msg_id_list_s));
+               pToDeleteMsgIdList->nCount = pMsgIdList->nCount;
+               pToDeleteMsgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t)*pMsgIdList->nCount];
+               memcpy(pToDeleteMsgIdList->msgIdList, pMsgIdList->msgIdList, sizeof(msg_message_id_t)*pMsgIdList->nCount);
+
+               msg_id_list_s *pToDeleteMsgIdListCpy = NULL;
+               pToDeleteMsgIdListCpy = (msg_id_list_s *)new char[sizeof(msg_id_list_s)];
+               memset(pToDeleteMsgIdListCpy, 0x00, sizeof(msg_id_list_s));
+               pToDeleteMsgIdListCpy->nCount = pMsgIdList->nCount;
+               pToDeleteMsgIdListCpy->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t)*pMsgIdList->nCount];
+               memcpy(pToDeleteMsgIdListCpy->msgIdList, pMsgIdList->msgIdList, sizeof(msg_message_id_t)*pMsgIdList->nCount);
+
+               if (g_idle_add(startToDeleteNoti, (void *)pToDeleteMsgIdList) == 0) {
+                       MSG_DEBUG("startToDeleteNoti not invoked: %s", strerror(errno));
+                       // memory free
+                       if (pToDeleteMsgIdList != NULL) {
+                               //free peer info list
+                               if (pToDeleteMsgIdList->msgIdList != NULL)
+                                       delete [] pToDeleteMsgIdList->msgIdList;
+
+                               delete [] pToDeleteMsgIdList;
+                       }
+                       err = MSG_ERR_UNKNOWN;
+               }
+
+               if (g_idle_add(startToDeletePhoneLog, (void *)pToDeleteMsgIdListCpy) == 0) {
+                       MSG_DEBUG("startToDeletePhoneLog not invoked: %s", strerror(errno));
+                       // memory free
+                       if (pToDeleteMsgIdListCpy != NULL) {
+                               //free peer info list
+                               if (pToDeleteMsgIdListCpy->msgIdList != NULL)
+                                       delete [] pToDeleteMsgIdListCpy->msgIdList;
+
+                               delete [] pToDeleteMsgIdListCpy;
+                       }
+                       err = MSG_ERR_UNKNOWN;
+               }
+       }
+/*** **/
+
+       MSG_END();
+       return MSG_SUCCESS;
+}
+
+
 msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t msgId, msg_folder_id_t destFolderId)
 {
        MSG_MESSAGE_TYPE_S msgType;
@@ -1932,15 +2206,16 @@ msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct
        pThreadViewList->msg_struct_info = NULL;
 
        int rowCnt = 0;
-       int index = 10; // numbers of index
+       int index = 11; // numbers of index
 
        char sqlQuery[MAX_QUERY_LEN+1];
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONV_ID, UNREAD_CNT, SMS_CNT, MMS_CNT, \
-                       MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, DISPLAY_NAME, MSG_TEXT \
-                       FROM %s WHERE SMS_CNT > 0 OR MMS_CNT > 0 ORDER BY DISPLAY_TIME DESC;",
-                       MSGFW_CONVERSATION_TABLE_NAME);
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, \
+                       A.MAIN_TYPE, A.SUB_TYPE, A.MSG_DIRECTION, A.DISPLAY_TIME, A.DISPLAY_NAME, A.MSG_TEXT, \
+                       (SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.PROTECTED = 1) AS PROTECTED \
+                       FROM %s A WHERE A.SMS_CNT > 0 OR A.MMS_CNT > 0 ORDER BY A.DISPLAY_TIME DESC;",
+                       MSGFW_MESSAGE_TABLE_NAME, MSGFW_CONVERSATION_TABLE_NAME);
 
        msg_error_t  err = dbHandle.getTable(sqlQuery, &rowCnt);
 
@@ -1995,6 +2270,10 @@ msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct
 
                memset(pTmp->threadData, 0x00, sizeof(pTmp->threadData));
                dbHandle.getColumnToString(index++, MAX_THREAD_DATA_LEN, pTmp->threadData);
+
+               int protectedCnt = dbHandle.getColumnToInt(index++);
+               if (protectedCnt > 0)
+                       pTmp->bProtected = true;
        }
 
        dbHandle.freeTable();
@@ -2002,6 +2281,132 @@ msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct
        return MSG_SUCCESS;
 }
 
+msg_error_t MsgStoGetConversationPreview(MSG_CONVERSATION_VIEW_S *pConv)
+{
+       MsgDbHandler dbHandleForInner;
+       char sqlQuery[MAX_QUERY_LEN + 1];
+       int rowCnt;
+       int index = 3;
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+       if (pConv == NULL)
+               return MSG_ERR_NULL_POINTER;
+
+       //(MSG_ID INTEGER, TYPE INTEGER, VALUE TEXT, COUNT INTEGER)
+       snprintf(sqlQuery, sizeof(sqlQuery),
+                       "SELECT TYPE, VALUE, COUNT "
+                       "FROM %s WHERE MSG_ID=%d;",
+                       MSGFW_MMS_PREVIEW_TABLE_NAME, pConv->msgId);
+
+       MSG_DEBUG("QUERY : [%s]", sqlQuery);
+
+       msg_error_t err = dbHandleForInner.getTable(sqlQuery, &rowCnt);
+       if (err == MSG_SUCCESS) {
+               for (int i = 0; i < rowCnt; i++) {
+                       int type = dbHandleForInner.getColumnToInt(index++);
+                       if (type == MSG_MMS_ITEM_TYPE_IMG) {
+                               dbHandleForInner.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pConv->imageThumbPath);
+                               dbHandleForInner.getColumnToInt(index++);
+                       } else if (type == MSG_MMS_ITEM_TYPE_VIDEO) {
+                               dbHandleForInner.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pConv->videoThumbPath);
+                               dbHandleForInner.getColumnToInt(index++);
+                       } else if (type == MSG_MMS_ITEM_TYPE_AUDIO) {
+                               dbHandleForInner.getColumnToString(index++, MSG_FILENAME_LEN_MAX, pConv->audioFileName);
+                               dbHandleForInner.getColumnToInt(index++);
+                       } else if (type == MSG_MMS_ITEM_TYPE_ATTACH) {
+                               dbHandleForInner.getColumnToString(index++, MSG_FILENAME_LEN_MAX, pConv->attachFileName);
+                               dbHandleForInner.getColumnToInt(index++);
+                       } else if (type == MSG_MMS_ITEM_TYPE_PAGE) {
+                               index++;
+                               pConv->pageCount = dbHandleForInner.getColumnToInt(index++);
+                       } else {
+                               MSG_DEBUG("Unknown item type [%d]", type);
+                               index+=2;
+                       }
+               }
+       }
+
+       dbHandleForInner.freeTable();
+       return MSG_SUCCESS;
+}
+
+msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv)
+{
+       int rowCnt = 0;
+       int index = 16; /** numbers of index */
+       char sqlQuery[MAX_QUERY_LEN+1];
+
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \
+                       DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \
+                       MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT \
+                       FROM %s WHERE MSG_ID=%d;",
+                       MSGFW_MESSAGE_TABLE_NAME, msgId);
+
+       msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt);
+
+       if (err == MSG_ERR_DB_NORECORD) {
+               dbHandle.freeTable();
+               return MSG_SUCCESS;
+       } else if (err != MSG_SUCCESS) {
+               MSG_DEBUG("%s", sqlQuery);
+               dbHandle.freeTable();
+               return err;
+       }
+
+       memset(pConv, 0x00, sizeof(MSG_CONVERSATION_VIEW_S));
+       pConv->pText = NULL;
+
+       pConv->msgId = dbHandle.getColumnToInt(index++);
+       pConv->threadId = dbHandle.getColumnToInt(index++);
+       pConv->folderId = dbHandle.getColumnToInt(index++);
+       pConv->storageId = dbHandle.getColumnToInt(index++);
+       pConv->mainType = dbHandle.getColumnToInt(index++);
+       pConv->subType = dbHandle.getColumnToInt(index++);
+       pConv->displayTime = (time_t)dbHandle.getColumnToInt(index++);
+       pConv->textSize = dbHandle.getColumnToInt(index++);
+       pConv->networkStatus = dbHandle.getColumnToInt(index++);
+       pConv->bRead = dbHandle.getColumnToInt(index++);
+       pConv->bProtected = dbHandle.getColumnToInt(index++);
+       pConv->direction = dbHandle.getColumnToInt(index++);
+       pConv->scheduledTime = (time_t)dbHandle.getColumnToInt(index++);
+
+       dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pConv->subject);
+
+       if (pConv->mainType == MSG_MMS_TYPE &&
+               (pConv->networkStatus == MSG_NETWORK_RETRIEVING || pConv->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pConv->subType == MSG_NOTIFICATIONIND_MMS)) {
+               pConv->pText = NULL;
+               pConv->textSize = 0;
+               index++;
+       } else {
+               if (pConv->mainType == MSG_SMS_TYPE) {
+                       pConv->pText = new char[pConv->textSize+2];
+                       memset(pConv->pText, 0x00, pConv->textSize+2);
+                       dbHandle.getColumnToString(index++, pConv->textSize+1, pConv->pText);
+               } else {
+                       char tmpMmsText[MAX_MMS_TEXT_LEN+1];
+                       memset(tmpMmsText, 0x00, MAX_MMS_TEXT_LEN+1);
+
+                       dbHandle.getColumnToString(index++, MAX_MMS_TEXT_LEN, tmpMmsText);
+
+                       pConv->textSize = strlen(tmpMmsText);
+
+                       pConv->pText = new char[pConv->textSize+2];
+                       memset(pConv->pText, 0x00, pConv->textSize+2);
+
+                       strncpy(pConv->pText, tmpMmsText, pConv->textSize+1);
+
+                       MsgStoGetConversationPreview(pConv);
+               }
+       }
+
+       pConv->attachCount = dbHandle.getColumnToInt(index++);
+
+       MSG_END();
+
+       return MSG_SUCCESS;
+}
 
 msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_list_s *pConvViewList)
 {
@@ -2011,20 +2416,16 @@ msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_l
        pConvViewList->msg_struct_info = NULL;
 
        int rowCnt = 0;
-       int index = 19; /** numbers of index */
-       int order = 0;
+       int index = 16; /** numbers of index */
        char sqlQuery[MAX_QUERY_LEN+1];
 
-       // get address information.
-       order = MsgGetContactNameOrder();
-
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \
-                       DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, BACKUP, PRIORITY, \
-                       MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, THUMB_PATH \
-                       FROM %s WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d ORDER BY DISPLAY_TIME, MSG_ID ASC;",
-                       MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID);
+                       DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \
+                       MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT \
+                       FROM %s WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d ORDER BY DISPLAY_TIME, MSG_ID ASC;",
+                       MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
 
        msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt);
 
@@ -2042,22 +2443,24 @@ msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_l
        MSG_DEBUG("pConvViewList->nCount [%d]", pConvViewList->nCount);
 
        pConvViewList->msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t) * rowCnt];
+       memset(pConvViewList->msg_struct_info, 0x00, sizeof(msg_struct_t) * rowCnt);
 
-       msg_struct_s *msg = NULL;
-       MSG_MESSAGE_HIDDEN_S *pTmp = NULL;
+       msg_struct_s *conv = NULL;
+       MSG_CONVERSATION_VIEW_S *pTmp = NULL;
 
        for (int i = 0; i < rowCnt; i++) {
                pConvViewList->msg_struct_info[i] = (msg_struct_t)new char[sizeof(msg_struct_s)];;
+               memset(pConvViewList->msg_struct_info[i], 0x00, sizeof(msg_struct_s));
 
-               msg = (msg_struct_s *)pConvViewList->msg_struct_info[i];
+               conv = (msg_struct_s *)pConvViewList->msg_struct_info[i];
 
-               msg->type = MSG_STRUCT_MESSAGE_INFO;
-               msg->data = new char[sizeof(MSG_MESSAGE_HIDDEN_S)];
+               conv->type = MSG_STRUCT_CONV_INFO;
+               conv->data = new char[sizeof(MSG_CONVERSATION_VIEW_S)];
+               memset(conv->data, 0x00, sizeof(MSG_CONVERSATION_VIEW_S));
 
-               pTmp = (MSG_MESSAGE_HIDDEN_S *)msg->data;
+               pTmp = (MSG_CONVERSATION_VIEW_S *)conv->data;
 
-               pTmp->pData = NULL;
-               pTmp->pMmsData = NULL;
+               pTmp->pText = NULL;
 
                pTmp->msgId = dbHandle.getColumnToInt(index++);
                pTmp->threadId = dbHandle.getColumnToInt(index++);
@@ -2066,12 +2469,10 @@ msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_l
                pTmp->mainType = dbHandle.getColumnToInt(index++);
                pTmp->subType = dbHandle.getColumnToInt(index++);
                pTmp->displayTime = (time_t)dbHandle.getColumnToInt(index++);
-               pTmp->dataSize = dbHandle.getColumnToInt(index++);
+               pTmp->textSize = dbHandle.getColumnToInt(index++);
                pTmp->networkStatus = dbHandle.getColumnToInt(index++);
                pTmp->bRead = dbHandle.getColumnToInt(index++);
                pTmp->bProtected = dbHandle.getColumnToInt(index++);
-               pTmp->bBackup = dbHandle.getColumnToInt(index++);
-               pTmp->priority = dbHandle.getColumnToInt(index++);
                pTmp->direction = dbHandle.getColumnToInt(index++);
                index++; // This field is reserved.
 
@@ -2079,27 +2480,32 @@ msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_l
 
                if (pTmp->mainType == MSG_MMS_TYPE &&
                        (pTmp->networkStatus == MSG_NETWORK_RETRIEVING || pTmp->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pTmp->subType == MSG_NOTIFICATIONIND_MMS)) {
-                       pTmp->pData = NULL;
+                       pTmp->pText = NULL;
+                       pTmp->textSize = 0;
                        index++;
                } else {
-                       pTmp->pData = (void *)new char[pTmp->dataSize+2];
-                       memset(pTmp->pData, 0x00, pTmp->dataSize+2);
+                       if (pTmp->mainType == MSG_SMS_TYPE) {
+                               pTmp->pText = new char[pTmp->textSize+2];
+                               memset(pTmp->pText, 0x00, pTmp->textSize+2);
+                               dbHandle.getColumnToString(index++, pTmp->textSize+1, pTmp->pText);
+                       } else {
+                               char tmpMmsText[MAX_MMS_TEXT_LEN+1];
+                               memset(tmpMmsText, 0x00, MAX_MMS_TEXT_LEN+1);
 
-                       dbHandle.getColumnToString(index++, pTmp->dataSize+1, (char *)pTmp->pData);
-               }
+                               dbHandle.getColumnToString(index++, MAX_MMS_TEXT_LEN, tmpMmsText);
 
-               pTmp->attachCount = dbHandle.getColumnToInt(index++);
+                               pTmp->textSize = strlen(tmpMmsText);
 
-               dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath);
+                               pTmp->pText = new char[pTmp->textSize+2];
+                               memset(pTmp->pText, 0x00, pTmp->textSize+2);
 
-               // set address list handle.
-               msg_struct_list_s *addrlist = (msg_struct_list_s *)new msg_struct_list_s;
-               memset(addrlist, 0x00, sizeof(msg_struct_list_s));
-               MsgDbHandler dbHandleForInner;
-               MsgStoGetAddressByConvId(&dbHandleForInner, threadId, order, addrlist);
+                               strncpy(pTmp->pText, tmpMmsText, pTmp->textSize+1);
+                       }
+               }
 
-               pTmp->addr_list = addrlist;
+               pTmp->attachCount = dbHandle.getColumnToInt(index++);
 
+               MsgStoGetConversationPreview(pTmp);
        }
 
        dbHandle.freeTable();
@@ -2110,10 +2516,56 @@ msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_l
 }
 
 
-msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, msg_id_list_s *pMsgIdList)
+msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, bool bIncludeProtect, msg_id_list_s *pMsgIdList)
 {
        msg_error_t err = MSG_SUCCESS;
 
+#if 1
+       char sqlQuery[MAX_QUERY_LEN+1];
+
+       /*** Get msg id list **/
+       int rowCnt = 0;
+       int index = 1;
+
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+       if (bIncludeProtect) {
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE \
+                               CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d;",
+                               MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
+       } else {
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE \
+                               CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND PROTECTED = 0;",
+                               MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
+       }
+
+       err = dbHandle.getTable(sqlQuery, &rowCnt);
+
+       if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+               dbHandle.freeTable();
+       }
+
+       if (rowCnt <= 0) {
+               dbHandle.freeTable();
+               err = MSG_SUCCESS;
+       }
+
+       pMsgIdList->nCount = rowCnt;
+
+       MSG_DEBUG("pMsgIdList->nCount [%d]", pMsgIdList->nCount);
+
+       pMsgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t) * rowCnt];
+
+       for (int i = 0; i < rowCnt; i++)
+               pMsgIdList->msgIdList[i] = dbHandle.getColumnToInt(index++);
+
+       dbHandle.freeTable();
+       /*** **/
+
+       err = MsgStoDeleteMessageByList(pMsgIdList);
+
+#else
        char sqlQuery[MAX_QUERY_LEN+1];
        /*** Get msg id list **/
        msg_id_list_s *pToDeleteMsgIdList = NULL;
@@ -2134,7 +2586,7 @@ msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, msg_id_list_
        memset(pToDeleteMsgIdList, 0x00, sizeof(msg_id_list_s));
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE CONV_ID = %d", MSGFW_MESSAGE_TABLE_NAME, threadId);
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE CONV_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, threadId);
 
        err = dbHandle.getTable(sqlQuery, &rowCnt);
 
@@ -2377,6 +2829,7 @@ FREE_MEMORY:
                delete [] pToDeleteMsgIdList;
                pToDeleteMsgIdList = NULL;
        }
+#endif
 
        return err;
 }
@@ -2936,28 +3389,44 @@ msg_error_t MsgStoGetSyncMLExtId(msg_message_id_t msgId, int *extId)
        return MSG_SUCCESS;
 }
 
-
-msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, MSG_REPORT_STATUS_INFO_S *pReportStatus)
+msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus)
 {
        char sqlQuery[MAX_QUERY_LEN+1];
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
+       //MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME)
+       //select * from MSG_REPORT_TABLE where MSG_ID=38 order by ADDRESS_VAL DESC, STATUS_TYPE ASC;
+       snprintf(sqlQuery, sizeof(sqlQuery),
+                       "SELECT ADDRESS_VAL, STATUS_TYPE, STATUS, TIME "
+                       "FROM %s "
+                       "WHERE MSG_ID = %d "
+                       "order by ADDRESS_VAL DESC, STATUS_TYPE ASC;"
+                       , MSGFW_REPORT_TABLE_NAME, msgId);
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DELIVERY_REPORT_STATUS, \
-                       DELIVERY_REPORT_TIME, READ_REPORT_STATUS, READ_REPORT_TIME \
-                       FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId);
+       int rowCnt;
+       msg_error_t  err = dbHandle.getTable(sqlQuery, &rowCnt);
+       if (err != MSG_SUCCESS) {
+               MSG_DEBUG("%s", sqlQuery);
+               dbHandle.freeTable();
+               return err;
+       }
 
-       if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS)
-               return MSG_ERR_DB_PREPARE;
+       int index = 4;
 
-       if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) {
-               pReportStatus->deliveryStatus = (msg_delivery_report_status_t)dbHandle.columnInt(0);
-               pReportStatus->deliveryStatusTime = (time_t)dbHandle.columnInt(1);
-               pReportStatus->readStatus = (msg_read_report_status_t)dbHandle.columnInt(2);
-               pReportStatus->readStatusTime = (time_t)dbHandle.columnInt(3);
+       *count =  rowCnt;
+       MSG_REPORT_STATUS_INFO_S *report_status = (MSG_REPORT_STATUS_INFO_S*)new char[sizeof(MSG_REPORT_STATUS_INFO_S)*rowCnt];
+       memset(report_status, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S)*rowCnt);
+
+       for (int i = 0; i < rowCnt; i++) {
+               dbHandle.getColumnToString(index++, MAX_ADDRESS_VAL_LEN, report_status[i].addressVal);
+               report_status[i].type = dbHandle.getColumnToInt(index++);
+               report_status[i].status = dbHandle.getColumnToInt(index++);
+               report_status[i].statusTime = (time_t)dbHandle.getColumnToInt(index++);
+
+               MSG_DEBUG("(%d/%d) addr = %s, report_type = %d, report_status = %d, report_time = %d", i, rowCnt, report_status[i].addressVal, report_status[i].type, report_status[i].status, report_status[i].statusTime );
        }
 
-       dbHandle.finalizeQuery();
+       *pReportStatus = report_status;
 
        return MSG_SUCCESS;
 }
@@ -3029,15 +3498,16 @@ msg_error_t MsgStoGetThreadInfo(msg_thread_id_t threadId, MSG_THREAD_VIEW_S *pTh
        MSG_BEGIN();
 
        int rowCnt;
-       int index = 10; // numbers of index
+       int index = 11; // numbers of index
 
        char sqlQuery[MAX_QUERY_LEN+1];
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONV_ID, UNREAD_CNT, SMS_CNT, MMS_CNT, \
-                       MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, DISPLAY_NAME, MSG_TEXT \
-                       FROM %s WHERE CONV_ID = %d;",
-                       MSGFW_CONVERSATION_TABLE_NAME, threadId);
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, \
+                       A.MAIN_TYPE, A.SUB_TYPE, A.MSG_DIRECTION, A.DISPLAY_TIME, A.DISPLAY_NAME, A.MSG_TEXT, \
+                       (SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.PROTECTED = 1) AS PROTECTED \
+                       FROM %s A WHERE A.CONV_ID = %d;",
+                       MSGFW_MESSAGE_TABLE_NAME, MSGFW_CONVERSATION_TABLE_NAME, threadId);
 
        msg_error_t  err = dbHandle.getTable(sqlQuery, &rowCnt);
 
index dd2f5c0..80fe3a8 100755 (executable)
@@ -104,8 +104,8 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg)
                }
        } else if (pMsg->msgType.subType == MSG_SENDREQ_MMS) {
                snprintf(sqlQuery, sizeof(sqlQuery),
-                               "UPDATE %s SET MSG_DATA = '%s', MSG_TEXT = ?, THUMB_PATH = '%s' WHERE MSG_ID = %d;",
-                               MSGFW_MESSAGE_TABLE_NAME, pMsg->msgData, pMsg->thumbPath, pMsg->msgId);
+                               "UPDATE %s SET MSG_DATA = '%s', MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %d WHERE MSG_ID = %d;",
+                               MSGFW_MESSAGE_TABLE_NAME, pMsg->msgData, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId);
 
                if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
                        dbHandle.endTrans(false);
index 52fa76f..a529fa6 100755 (executable)
@@ -29,7 +29,6 @@
 #include "MsgUtilStorage.h"
 #include "MsgStorageHandler.h"
 
-
 /*==================================================================================================
                                      VARIABLES
 ==================================================================================================*/
index 3fde433..8d0eccb 100755 (executable)
@@ -19,6 +19,7 @@
 
 #include "MsgDebug.h"
 #include "MsgUtilFile.h"
+#include "MsgUtilStorage.h"
 #include "MsgException.h"
 #include "MsgGconfWrapper.h"
 #include "MsgPluginManager.h"
@@ -26,6 +27,8 @@
 #include "MsgSubmitHandler.h"
 
 
+extern MsgDbHandler dbHandle;
+
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
@@ -108,7 +111,7 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo)
 
        if(!plg)
        {
-               MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
+               MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
                MSG_DEBUG("No Plugin for %d type", msgMainType);
 
                return MSG_ERR_INVALID_PLUGIN_HANDLE;
@@ -136,7 +139,7 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo)
                if(err != MSG_SUCCESS)
                {
                        MSG_DEBUG("Update Network Status : [%d]", err);
-                       MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo),MSG_NETWORK_SEND_FAIL);
+                       MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo),MSG_NETWORK_SEND_FAIL);
                }
 
                return err;
@@ -174,7 +177,7 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo)
                        pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID;
                        err = MsgStoUpdateMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo));
 
-                       MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus);
+                       MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus);
                } else {
                        //new message case
                        MSG_DEBUG("New Message");
@@ -215,7 +218,7 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo)
        }
        else if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS)
        {
-               MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus);
+               MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus);
        }
 
        /* reject_msg_support */
@@ -256,7 +259,7 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo)
        if(simStatus == MSG_SIM_STATUS_NOT_FOUND)
        {
                MSG_DEBUG("SIM is not present...");
-               MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
+               MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
 
                return MSG_ERR_NO_SIM;
        }
@@ -270,9 +273,9 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo)
        if (err != MSG_SUCCESS)
        {
                if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS )
-                       MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_RETRIEVE_FAIL);
+                       MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_RETRIEVE_FAIL);
                else
-                       MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
+                       MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
        }
 
 
index 7034931..36dcd56 100755 (executable)
@@ -111,6 +111,40 @@ int MsgDeleteFilterHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 }
 
 
+int MsgSetFilterActivationHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+       msg_error_t err = MSG_SUCCESS;
+
+       int eventSize = 0;
+
+       // Get Filter Structure
+       msg_filter_id_t  *pFilterId = (msg_filter_id_t *)pCmd->cmdData;
+
+       bool setFlag = false;
+
+       memcpy(&setFlag, pCmd->cmdData+sizeof(msg_filter_id_t), sizeof(bool));
+
+       MSG_DEBUG("Filter id : %d", *pFilterId);
+
+       // Delete Filter
+       err = MsgStoSetFilterActivation(*pFilterId, setFlag);
+
+       if (err == MSG_SUCCESS)
+       {
+               MSG_DEBUG("Command Handle Success : MsgStoSetFilterActivation()");
+       }
+       else
+       {
+               MSG_DEBUG("Command Handle Fail : MsgStoSetFilterActivation()");
+       }
+
+       // Make Event Data
+       eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_SET_FILTER_ACTIVATION, err, (void**)ppEvent);
+
+       return eventSize;
+}
+
+
 int MsgGetFilterListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 {
        msg_error_t err = MSG_SUCCESS;
index a661a90..6c40024 100755 (executable)
@@ -341,6 +341,45 @@ int MsgDeleteAllMessageInFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 }
 
 
+int MsgDeleteMessageByListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+       msg_error_t err = MSG_SUCCESS;
+
+       int eventSize = 0;
+
+       msg_id_list_s msgIdList;
+       memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
+
+       msgIdList.nCount = *((int *)pCmd->cmdData);
+
+       MSG_DEBUG("msgIdList.nCount [%d]", msgIdList.nCount);
+
+       msg_message_id_t msgIds[msgIdList.nCount];
+       memset(msgIds, 0x00, sizeof(msgIds));
+
+       msgIdList.msgIdList = msgIds;
+
+       for (int i=0; i<msgIdList.nCount; i++) {
+               msgIds[i] = *(msg_message_id_t *)(((char*)pCmd->cmdData) + (sizeof(int)*(i+1)));
+       }
+
+       // Delete Message
+       err = MsgStoDeleteMessageByList(&msgIdList);
+
+       if (err == MSG_SUCCESS) {
+               MSG_DEBUG("Command Handle Success : MsgStoDeleteMessageByList()");
+               MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_DELETE, &msgIdList);
+       } else {
+               MSG_DEBUG("Command Handle Fail : MsgStoDeleteMessageByList()");
+       }
+
+       // Make Event Data
+       eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_MESSAGE_BY_LIST, err, (void**)ppEvent);
+
+       return eventSize;
+}
+
+
 int MsgMoveMessageToFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 {
        msg_error_t err = MSG_SUCCESS;
@@ -843,9 +882,11 @@ int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        msg_error_t err = MSG_SUCCESS;
 
        msg_thread_id_t threadId;
+       bool bIncludeProtect = false;
        bool isSyncMLMsg = false;
 
        memcpy(&threadId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_thread_id_t));
+       memcpy(&bIncludeProtect, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_thread_id_t)), sizeof(bool));
 
        int eventSize = 0;
 
@@ -854,7 +895,7 @@ int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        msg_id_list_s msgIdList;
        memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
 
-       err = MsgStoDeleteThreadMessageList(threadId, &msgIdList);
+       err = MsgStoDeleteThreadMessageList(threadId, bIncludeProtect, &msgIdList);
 
        if (err == MSG_SUCCESS) {
                MSG_DEBUG("Command Handle Success : MsgStoDeleteThreadMessageList()");
@@ -871,6 +912,8 @@ int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        else
        {
                MSG_DEBUG("Command Handle Fail : MsgStoDeleteThreadMessageList()");
+               if(msgIdList.msgIdList != NULL)
+                       delete [] (char*)msgIdList.msgIdList;
        }
 
        // Make Event Data
@@ -1055,18 +1098,17 @@ int MsgGetReportStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 
        int dataSize = 0, eventSize = 0;
 
-       MSG_REPORT_STATUS_INFO_S reportStatus;
-
-       memset(&reportStatus, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S));
+       MSG_REPORT_STATUS_INFO_S *reportStatus = NULL;
+       int report_count = 0;
 
-       err = MsgStoGetReportStatus(*msgId, &reportStatus);
+       err = MsgStoGetReportStatus(*msgId, &report_count, &reportStatus);
 
        if (err == MSG_SUCCESS)
        {
                MSG_DEBUG("Command Handle Success : MsgGetReportStatusHandler()");
 
                // Encoding Report Status Data
-               dataSize = MsgEncodeReportStatus(&reportStatus, &encodedData);
+               dataSize = MsgEncodeReportStatus(reportStatus, report_count, &encodedData);
        }
        else
        {
@@ -1156,3 +1198,77 @@ int MsgGetThreadInfoHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 
        return eventSize;
 }
+
+int MsgAddPushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+       msg_error_t err = MSG_SUCCESS;
+
+       int eventSize = 0;
+
+       // Get Message Info
+       MSG_PUSH_EVENT_INFO_S* pPushEvent = (MSG_PUSH_EVENT_INFO_S*)pCmd->cmdData;
+
+       // Add Message
+       err = MsgStoAddPushEvent(pPushEvent);
+
+       if (err == MSG_SUCCESS) {
+               MSG_DEBUG("Command Handle Success : MsgStoAddPushEvent()");
+       } else {
+               MSG_DEBUG("Command Handle Fail : MsgStoAddMessage()");
+       }
+
+       // Make Event Data
+       eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_ADD_PUSH_EVENT, err, (void**)ppEvent);
+
+       return eventSize;
+}
+
+int MsgDeletePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+       msg_error_t err = MSG_SUCCESS;
+
+       int eventSize = 0;
+
+       // Get Message Info
+       MSG_PUSH_EVENT_INFO_S* pPushEvent = (MSG_PUSH_EVENT_INFO_S*)pCmd->cmdData;
+
+       // Add Message
+       err = MsgStoDeletePushEvent(pPushEvent);
+
+       if (err == MSG_SUCCESS) {
+               MSG_DEBUG("Command Handle Success : MsgStoDeletePushEvent()");
+       } else {
+               MSG_DEBUG("Command Handle Fail : MsgStoDeletePushEvent()");
+       }
+
+       // Make Event Data
+       eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_PUSH_EVENT, err, (void**)ppEvent);
+
+       return eventSize;
+}
+
+int MsgUpdatePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+       msg_error_t err = MSG_SUCCESS;
+
+
+       int eventSize = 0;
+
+       // Get Message Info
+       MSG_PUSH_EVENT_INFO_S* pSrc = (MSG_PUSH_EVENT_INFO_S*)pCmd->cmdData;
+       MSG_PUSH_EVENT_INFO_S* pDst = (MSG_PUSH_EVENT_INFO_S*)(pCmd->cmdData + sizeof(MSG_PUSH_EVENT_INFO_S));
+
+       // Add Message
+       err = MsgStoUpdatePushEvent(pSrc, pDst);
+
+       if (err == MSG_SUCCESS) {
+               MSG_DEBUG("Command Handle Success : MsgStoUpdatePushEvent()");
+       } else {
+               MSG_DEBUG("Command Handle Fail : MsgStoUpdatePushEvent()");
+       }
+
+       // Make Event Data
+       eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_PUSH_EVENT, err, (void**)ppEvent);
+
+       return eventSize;
+}
index 113e6ff..6f24787 100755 (executable)
@@ -207,6 +207,44 @@ int MsgRegIncomingMMSConfMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEven
        return eventSize;
 }
 
+int MsgRegIncomingPushMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+       // input check
+       if( !pCmd || !ppEvent)
+               THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
+
+       // Get Message Request
+       MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S*) pCmd->cmdData;
+       MSG_DEBUG("Registering incoming Push Msg CB for fd:%d mType:%d appId:%s", pCmdData->listenerFd, pCmdData->msgType, pCmdData->appId);
+
+       // storing dst fd in list
+       MsgTransactionManager::instance()->setPushMsgCB(pCmdData);
+
+       // Make Event Data
+       int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_PUSH_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
+
+       return eventSize;
+}
+
+int MsgRegIncomingCBMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+       // input check
+       if( !pCmd || !ppEvent)
+               THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
+
+       // Get Message Request
+       MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_CB_MSG_CB_S*) pCmd->cmdData;
+       MSG_DEBUG("Registering incoming Push Msg CB for fd:%d mType:%d", pCmdData->listenerFd, pCmdData->msgType);
+
+       // storing dst fd in list
+       MsgTransactionManager::instance()->setCBMsgCB(pCmdData);
+
+       // Make Event Data
+       int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_CB_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
+
+       return eventSize;
+}
+
 
 int MsgRegIncomingSyncMLMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 {
@@ -522,6 +560,69 @@ __BYPASS_UPDATE:
        return eventsize;
 }
 
+int MsgIncomingPushMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+       MSG_BEGIN();
+       // input check
+       if (!pCmd || !ppEvent)
+               THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
+
+       MSG_PUSH_MESSAGE_DATA_S pushData;
+       memset(&pushData, 0x00, sizeof(MSG_PUSH_MESSAGE_DATA_S));
+
+       // Get Incoming Message
+       memcpy(&pushData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_PUSH_MESSAGE_DATA_S));
+
+       int eventSize = 0;
+
+       // broadcast to listener threads, here
+       MsgTransactionManager::instance()->broadcastPushMsgCB(MSG_SUCCESS, &pushData);
+
+       // Make Event Data
+       eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND, MSG_SUCCESS, (void**)ppEvent);
+
+       MSG_END();
+       return eventSize;
+}
+
+int MsgIncomingCBMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+       MSG_BEGIN();
+
+       msg_error_t err = MSG_SUCCESS;
+       int eventSize = 0;
+
+       // input check
+       if (!pCmd || !ppEvent)
+               THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
+
+       // Get Incoming Message
+       MSG_CB_MSG_S cbMsg;
+       memset(&cbMsg, 0x00, sizeof(MSG_CB_MSG_S));
+
+       memcpy(&cbMsg, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_CB_MSG_S));
+
+       msg_id_list_s msgIdList;
+       msg_message_id_t msgIds[1];
+       memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
+
+       MsgTransactionManager::instance()->broadcastCBMsgCB(err, &cbMsg);
+
+       bool bSave = false;
+       MsgSettingGetBool(CB_SAVE, &bSave);
+
+       if(bSave && cbMsg.type!= MSG_ETWS_SMS) {
+               msgIdList.nCount = 1;
+               msgIds[0] = (msg_message_id_t)cbMsg.messageId;
+               msgIdList.msgIdList = msgIds;
+               MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
+       }
+       eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_CB_MSG_IND, err, (void**)ppEvent);
+
+       MSG_END();
+
+       return eventSize;
+}
 
 int MsgIncomingSyncMLMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 {
index 6e23018..0c31928 100755 (executable)
@@ -93,6 +93,7 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv()
        handlerMap[MSG_CMD_GET_FILTERLIST]              = &MsgGetFilterListHandler;
        handlerMap[MSG_CMD_SET_FILTER_OPERATION]        = &MsgSetFilterOperationHandler;
        handlerMap[MSG_CMD_GET_FILTER_OPERATION]        = &MsgGetFilterOperationHandler;
+       handlerMap[MSG_CMD_SET_FILTER_ACTIVATION] = &MsgSetFilterActivationHandler;
 
        handlerMap[MSG_CMD_GET_MSG_TYPE]                        = &MsgGetMsgTypeHandler;
 
@@ -104,6 +105,8 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv()
        handlerMap[MSG_CMD_REG_INCOMING_MSG_CB] = &MsgRegIncomingMsgCallbackHandler;
        handlerMap[MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB]        = &MsgRegIncomingMMSConfMsgCallbackHandler;
        handlerMap[MSG_CMD_REG_INCOMING_SYNCML_MSG_CB]  = &MsgRegIncomingSyncMLMsgCallbackHandler;
+       handlerMap[MSG_CMD_REG_INCOMING_PUSH_MSG_CB]    = &MsgRegIncomingPushMsgCallbackHandler;
+       handlerMap[MSG_CMD_REG_INCOMING_CB_MSG_CB]      = &MsgRegIncomingCBMsgCallbackHandler;
        handlerMap[MSG_CMD_REG_INCOMING_LBS_MSG_CB]     = &MsgRegIncomingLBSMsgCallbackHandler;
        handlerMap[MSG_CMD_REG_SYNCML_MSG_OPERATION_CB] = &MsgRegSyncMLMsgOperationCallbackHandler;
 
@@ -111,6 +114,8 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv()
        handlerMap[MSG_CMD_PLG_STORAGE_CHANGE_IND]      = &MsgStorageChangeHandler;
        handlerMap[MSG_CMD_PLG_INCOMING_MSG_IND]        = &MsgIncomingMsgHandler;
        handlerMap[MSG_CMD_PLG_INCOMING_MMS_CONF]       = &MsgIncomingMMSConfMsgHandler;
+       handlerMap[MSG_CMD_PLG_INCOMING_PUSH_IND]       = &MsgIncomingPushMsgHandler;
+       handlerMap[MSG_CMD_PLG_INCOMING_CB_IND] = &MsgIncomingCBMsgHandler;
 
        handlerMap[MSG_CMD_PLG_INCOMING_SYNCML_IND] = &MsgIncomingSyncMLMsgHandler;
        handlerMap[MSG_CMD_PLG_INCOMING_LBS_IND] = &MsgIncomingLBSMsgHandler;
@@ -156,6 +161,11 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv()
        handlerMap[MSG_CMD_SET_VOICE_MSG_OPT] = &MsgSetConfigHandler;
        handlerMap[MSG_CMD_SET_GENERAL_MSG_OPT] = &MsgSetConfigHandler;
        handlerMap[MSG_CMD_SET_MSG_SIZE_OPT] = &MsgSetConfigHandler;
+
+       handlerMap[MSG_CMD_ADD_PUSH_EVENT] = &MsgAddPushEventHandler;
+       handlerMap[MSG_CMD_DELETE_PUSH_EVENT] = &MsgDeletePushEventHandler;
+       handlerMap[MSG_CMD_UPDATE_PUSH_EVENT] = &MsgUpdatePushEventHandler;
+       handlerMap[MSG_CMD_DELETE_MESSAGE_BY_LIST] = &MsgDeleteMessageByListHandler;
 }
 
 
@@ -194,9 +204,8 @@ void MsgTransactionManager::run()
                // set Status;
                setTMStatus();
 
-               if( select(nfds, &readfds, NULL, NULL, NULL) == -1)
-               {
-                       THROW(MsgException::SELECT_ERROR, strerror(errno));
+               if(select(nfds, &readfds, NULL, NULL, NULL) == -1) {
+                       THROW(MsgException::SELECT_ERROR, "select error : %s", strerror(errno));
                }
 
                try
@@ -296,8 +305,8 @@ void MsgTransactionManager::handleRequest(int fd)
                return;
        }
 
-       if (len == 0)
-               THROW(MsgException::INVALID_RESULT, "read buffer size = 0");
+       if (len <= 0)
+               THROW(MsgException::INVALID_RESULT, "read buffer size <= 0");
 
        char* pEventData = NULL;
        AutoPtr<char> eventBuf(&pEventData);
@@ -440,6 +449,39 @@ void MsgTransactionManager::cleanup(int fd)
                }
        }
 
+       // remove all newPushMsgCBs for fd
+       pushmsg_list::iterator pushmsg_it = newPushMsgCBList.begin();
+
+       while (pushmsg_it != newPushMsgCBList.end())
+       {
+               if (pushmsg_it->listenerFd == fd)
+               {
+                       pushmsg_it = newPushMsgCBList.erase(pushmsg_it);
+               }
+               else
+               {
+                       ++pushmsg_it;
+               }
+       }
+
+       // remove all newCBMsgCBs for fd
+       cbmsg_list::iterator cbmsg_it = newCBMsgCBList.begin();
+       bool bSave = false;
+
+       while (cbmsg_it != newCBMsgCBList.end())
+       {
+               if (cbmsg_it->listenerFd == fd)
+               {
+                       cbmsg_it = newCBMsgCBList.erase(cbmsg_it);
+               }
+               else
+               {
+                       if(cbmsg_it->bsave == true)
+                               bSave = true;
+                       ++cbmsg_it;
+               }
+       }
+
        // remove all operationSyncMLMsgCBs for fd
        syncmlop_list::iterator syncmlop_it = operationSyncMLMsgCBList.begin();
 
@@ -585,6 +627,54 @@ void MsgTransactionManager::setMMSConfMsgCB(MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB
 }
 
 
+void MsgTransactionManager::setPushMsgCB(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCbInfo)
+{
+       if (!pCbInfo)
+       {
+               MSG_FATAL("cbinfo NULL");
+               return;
+       }
+
+       pushmsg_list::iterator it = newPushMsgCBList.begin();
+
+       for (; it != newPushMsgCBList.end(); it++)
+       {
+               if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType))
+               {
+                       MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType);
+                       return;
+               }
+       }
+
+       newPushMsgCBList.push_back(*pCbInfo);
+}
+
+void MsgTransactionManager::setCBMsgCB(MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCbInfo)
+{
+       if (!pCbInfo)
+       {
+               MSG_FATAL("cbinfo NULL");
+               return;
+       }
+
+       cbmsg_list::iterator it = newCBMsgCBList.begin();
+
+       for (; it != newCBMsgCBList.end(); it++)
+       {
+               if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType))
+               {
+                       MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType);
+                       return;
+               }
+       }
+
+       if(pCbInfo->bsave)
+               MsgSettingSetBool(CB_SAVE, pCbInfo->bsave);
+
+
+       newCBMsgCBList.push_back(*pCbInfo);
+}
+
 void MsgTransactionManager::setSyncMLMsgCB(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCbInfo)
 {
        if (!pCbInfo)
@@ -762,6 +852,48 @@ void MsgTransactionManager::broadcastMMSConfCB(const msg_error_t err, const MSG_
        MSG_END();
 }
 
+void MsgTransactionManager::broadcastPushMsgCB(const msg_error_t err, const MSG_PUSH_MESSAGE_DATA_S *pushData)
+{
+       MSG_BEGIN();
+
+       char* pEventData = NULL;
+       AutoPtr<char> eventBuf(&pEventData);
+
+       int eventSize = MsgMakeEvent(pushData, sizeof(MSG_PUSH_MESSAGE_DATA_S), MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND, err, (void**)(&pEventData));
+
+       pushmsg_list::iterator it = newPushMsgCBList.begin();
+
+       for (; it != newPushMsgCBList.end(); it++)
+       {
+               if (!strcmp(it->appId, pushData->pushAppId))
+               {
+                       MSG_DEBUG("Send incoming Push information to listener %d", it->listenerFd);
+                       write(it->listenerFd, pEventData, eventSize);
+               }
+       }
+
+       MSG_END();
+}
+
+void MsgTransactionManager::broadcastCBMsgCB(const msg_error_t err, const MSG_CB_MSG_S *cbMsg)
+{
+       MSG_BEGIN();
+
+       char* pEventData = NULL;
+       AutoPtr<char> eventBuf(&pEventData);
+
+       int eventSize = MsgMakeEvent(cbMsg, sizeof(MSG_CB_MSG_S), MSG_EVENT_PLG_INCOMING_CB_MSG_IND, err, (void**)(&pEventData));
+
+       cbmsg_list::iterator it = newCBMsgCBList.begin();
+
+       for (; it != newCBMsgCBList.end(); it++)
+       {
+               MSG_DEBUG("Send incoming CB information to listener %d", it->listenerFd);
+               write(it->listenerFd, pEventData, eventSize);
+       }
+
+       MSG_END();
+}
 
 void MsgTransactionManager::broadcastSyncMLMsgCB(const msg_error_t err, const MSG_SYNCML_MESSAGE_DATA_S *syncMLData)
 {
index c20ca3d..304c70a 100755 (executable)
@@ -164,8 +164,12 @@ enum _MSG_CMD_TYPE_E
        MSG_CMD_REG_INCOMING_CB_MSG_CB,
        MSG_CMD_PLG_INCOMING_CB_IND,
        MSG_CMD_ADD_PUSH_EVENT,
+
+// 80
        MSG_CMD_DELETE_PUSH_EVENT,
        MSG_CMD_UPDATE_PUSH_EVENT,
+       MSG_CMD_DELETE_MESSAGE_BY_LIST,
+       MSG_CMD_SET_FILTER_ACTIVATION,
 
 // end of MSG_CMD; new CMD should be defined before MSG_CMD_NUM
        MSG_CMD_NUM
@@ -270,14 +274,18 @@ enum _MSG_EVENT_TYPE_E
        MSG_EVENT_SET_VOICE_MSG_OPT,
        MSG_EVENT_SET_GENERAL_MSG_OPT,
        MSG_EVENT_SET_MSG_SIZE_OPT,
+
        MSG_EVENT_REG_INCOMING_PUSH_MSG_CB,
        MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND,
        MSG_EVENT_REG_INCOMING_CB_MSG_CB,
        MSG_EVENT_PLG_INCOMING_CB_MSG_IND,
        MSG_EVENT_ADD_PUSH_EVENT,
 
+// 80
        MSG_EVENT_DELETE_PUSH_EVENT,
        MSG_EVENT_UPDATE_PUSH_EVENT,
+       MSG_EVENT_DELETE_MESSAGE_BY_LIST,
+       MSG_EVENT_SET_FILTER_ACTIVATION,
 
 // end of MSG_EVENT; new EVENT should be defined before MSG_EVENT_NUM
        MSG_EVENT_NUM
index 047f0b1..46ac21d 100755 (executable)
@@ -54,7 +54,8 @@ typedef struct
 {
        msg_filter_id_t                 filterId;                       /**< Indicates the filter ID. */
        msg_filter_type_t               filterType;             /**< Indicates the filter type. */
-       char                                            filterValue[MAX_FILTER_VALUE_LEN+1];    /**< The value of a filter. */
+       char                                                    filterValue[MAX_FILTER_VALUE_LEN+1];    /**< The value of a filter. */
+       bool                                                    bActive;
 } MSG_FILTER_S;
 
 
index edeadf8..5c5dda5 100755 (executable)
@@ -32,7 +32,7 @@
 /*==================================================================================================
                                     DEFINES
 ==================================================================================================*/
-#define MSG_DATA_ROOT_PATH             "/opt/data/msg-service/"
+#define MSG_DATA_ROOT_PATH             "/opt/usr/data/msg-service/"
 #define MSG_DATA_PATH                          MSG_DATA_ROOT_PATH"msgdata/"
 #define MSG_SMIL_FILE_PATH             MSG_DATA_ROOT_PATH"smildata/"
 #define MSG_IPC_DATA_PATH                      MSG_DATA_ROOT_PATH"ipcdata/"
@@ -44,6 +44,7 @@
 #define MAX_THREAD_NAME_LEN    195
 #define MAX_THREAD_DATA_LEN    128
 #define MAX_CB_MSG_TEXT_LEN    4200    // 1page max char(93)*max page(15)*max bytes of UTF8 1 char(3)
+#define MAX_CB_MSG_LANGUAGE_TYPE_LEN   3
 #define MAX_ETWS_WARNING_SECURITY_INFO_LEN     50
 
 #define SMS_MINIMUM_SPACE      (3 * 1024)
 #define CB_LANGUAGE                                    DEFAULT_CB_MSG_OPT_PATH"/language"
 
 #define VOICEMAIL_NUMBER                               DEFAULT_VOICE_MAIL_OPT_PATH"/voice_mail_number"
+#define VOICEMAIL_COUNT                                DEFAULT_VOICE_MAIL_OPT_PATH"/voice_mail_count"
 
 #define MSGSIZE_OPTION                                 DEFAULT_MSGSIZE_OPT_PATH"/msg_size"
 
@@ -204,29 +206,30 @@ typedef struct
  */
 typedef struct
 {
-       msg_message_id_t                        msgId;                                                                                                                          /**< Indicates the message ID of this message. */
-       msg_thread_id_t                         threadId;                                                                                                                       /**< Indicates the thread ID. */
-       msg_folder_id_t                         folderId;                                                                                                                       /**< Indicates the folder ID. */
-       MSG_MESSAGE_TYPE_S              msgType;                                                                                                                        /**< Indicates the message type such as SMS and MMS */
-       msg_storage_id_t                        storageId;                                                                                                                      /**< Indicates where the message is saved. */
-       int                                                                             nAddressCnt;                                                                                                    /**< Indicates the count of addresses. */
+       msg_message_id_t                msgId;                                                                                  /**< Indicates the message ID of this message. */
+       msg_thread_id_t                 threadId;                                                                               /**< Indicates the thread ID. */
+       msg_folder_id_t                 folderId;                                                                               /**< Indicates the folder ID. */
+       MSG_MESSAGE_TYPE_S              msgType;                                                                                /**< Indicates the message type such as SMS and MMS */
+       msg_storage_id_t                storageId;                                                                              /**< Indicates where the message is saved. */
+       int                                             nAddressCnt;                                                                    /**< Indicates the count of addresses. */
        MSG_ADDRESS_INFO_S              addressList[MAX_TO_ADDRESS_CNT];                                /**< Indicates the address information list. */
-       char                                                                            replyAddress[MAX_PHONE_NUMBER_LEN+1];   /**< Indicates the reply address. */
-       char                                                                            subject[MAX_SUBJECT_LEN+1];                                             /**< Indicates the message subject. */
-       time_t                                                                  displayTime;                                                                                                    /**< Indicates the display time related to the specific operation. */
+       char                                    replyAddress[MAX_PHONE_NUMBER_LEN+1];   /**< Indicates the reply address. */
+       char                                    subject[MAX_SUBJECT_LEN+1];                                             /**< Indicates the message subject. */
+       time_t                                  displayTime;                                                                                                    /**< Indicates the display time related to the specific operation. */
        msg_network_status_t    networkStatus;                                                                                                  /**< Indicates the network status of the message. */
        msg_encode_type_t               encodeType;                                                                                                     /**< Indicates the string encoding type. */
-       bool                                                                            bRead;                                                                                                                          /**< Indicates whether the message is read or not. */
-       bool                                                                            bProtected;                                                                                                             /**< Indicates whether the message is protected or not. */
-       bool                                                                            bBackup;                                                                                                                        /**< Indicates whether the message was restored from PC. */
+       bool                                    bRead;                                                                                                                          /**< Indicates whether the message is read or not. */
+       bool                                    bProtected;                                                                                                             /**< Indicates whether the message is protected or not. */
+       bool                                    bBackup;                                                                                                                        /**< Indicates whether the message was restored from PC. */
        msg_priority_type_t             priority;                                                                                                                       /**< Indicates the priority of the message. */
        msg_direction_type_t    direction;                                                                                                                      /**< Indicates whether the message is MO or MT (affecting address). */
-       MSG_PORT_INFO_S                         msgPort;                                                                                                                        /**< Indicates the port number information. */
-       bool                                                                            bTextSms;                                                                                                               /**< Indicates whether the message is just a text message or not. */
-       size_t                                                                  dataSize;                                                                                                                       /**< Indicates the data size. The unit is byte. */
-       char                                                                            msgData[MAX_MSG_DATA_LEN+1];                                    /**< Indicates the message payload information as a body. */
-       char                                                                            msgText[MAX_MSG_TEXT_LEN+1];
+       MSG_PORT_INFO_S                 msgPort;                                                                                                                        /**< Indicates the port number information. */
+       bool                                            bTextSms;                                                                                                               /**< Indicates whether the message is just a text message or not. */
+       size_t                                  dataSize;                                                                                                                       /**< Indicates the data size. The unit is byte. */
+       char                                    msgData[MAX_MSG_DATA_LEN+1];                                    /**< Indicates the message payload information as a body. */
+       char                                    msgText[MAX_MSG_TEXT_LEN+1];
        char                                                                            thumbPath[MSG_FILEPATH_LEN_MAX];
+       bool                                    bStore;
 } MSG_MESSAGE_INFO_S;
 
 typedef struct
@@ -253,7 +256,7 @@ typedef struct
        unsigned short                  dstPort;                                                                /**< Recipient port number, not greater than 16 bit */
        unsigned short                  srcPort;                                                                /**< Sender port number, not greater than 16 bit */
        int                                             attachCount;                                                    /**< Indicates the count of attached files in mms. */
-       char                                    thumbPath[MSG_FILEPATH_LEN_MAX];
+       char                                    thumbPath[MSG_FILEPATH_LEN_MAX+1];
        size_t                                  dataSize;                                                               /**< Indicates the data size. The unit is byte. */
        void                                    *pData;                                                                 /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
        void                                    *pMmsData;                                                              /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
@@ -274,10 +277,40 @@ typedef struct
        int                                             unreadCnt;                                                                                                              /**< Indicates the unread messages from the Peer. */
        int                                             smsCnt;                                                                                                                 /**< Indicates the SMS messages from the Peer. */
        int                                             mmsCnt;                                                                                                                 /**< Indicates the MMS messages from the Peer. */
+       bool                                    bProtected;                                                                                                             /**< Indicates whether the thread includes protected messages.  */
 } MSG_THREAD_VIEW_S;
 
 
 /**
+ *     @brief  Represents message information for conversation view.
+ */
+typedef struct
+{
+       msg_message_id_t                        msgId;                                                                  /**< Indicates the message ID of this message. */
+       msg_thread_id_t                 threadId;                                                               /**< Indicates the thread ID of this peer. */
+       MSG_MAIN_TYPE_T                 mainType;                                                       /**< Message main type. See enum _MSG_MAIN_TYPE_E */
+       MSG_SUB_TYPE_T                  subType;                                                                /**< Message sub type. See enum _MSG_SUB_TYPE_E */
+       msg_folder_id_t                 folderId;                                                               /**< Indicates the folder ID. see enum _MSG_FOLDER_TYPE_E */
+       msg_storage_id_t                                storageId;                                                              /**< Indicates where the message is saved. see enum _MSG_FOLDER_TYPE_E*/
+       time_t                                                          displayTime;                                            /**< Indicates the display time related to the specific operation. */
+       time_t                                                          scheduledTime;                                  /**< Indicates the time to send scheduled message. */
+       msg_network_status_t            networkStatus;                                          /**< Indicates the network status of the message. */
+       bool                                                                    bRead;                                                                  /**< Indicates whether the message is read or not. */
+       bool                                                                    bProtected;                                                     /**< Indicates whether the message is protected or not. */
+       msg_direction_type_t            direction;                                                              /**< Indicates whether the message is MO or MT, affecting address. */
+       int                                                                     pageCount;                                              /**< Indicates the count of pageCount in mms. */
+       int                                                                     attachCount;                                            /**< Indicates the count of attached files in mms. */
+       char                                                                    attachFileName[MSG_FILENAME_LEN_MAX+1]; /**< Indicates the thumbnail path. */
+       char                                                                    audioFileName[MSG_FILENAME_LEN_MAX+1];  /**< Indicates the thumbnail path. */
+       char                                                                    imageThumbPath[MSG_FILEPATH_LEN_MAX+1]; /**< Indicates the thumbnail path. */
+       char                                                                    videoThumbPath[MSG_FILEPATH_LEN_MAX+1];         /**< Indicates the thumbnail path. */
+       char                                                                    subject[MAX_SUBJECT_LEN+1];                                                     /**< Indicates the message subject. */
+       size_t                                                          textSize;                                                               /**< Indicates the data size. The unit is byte. */
+       char                                                                    *pText;                                                                 /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
+} MSG_CONVERSATION_VIEW_S;
+
+
+/**
  *     @brief  Represents sim message informatioin list.
  */
 typedef struct
@@ -426,6 +459,7 @@ typedef struct
 
        unsigned short                  etwsWarningType;
        unsigned char                   etwsWarningSecurityInfo[MAX_ETWS_WARNING_SECURITY_INFO_LEN];
+       unsigned char                   language_type[MAX_CB_MSG_LANGUAGE_TYPE_LEN];
 } MSG_CB_MSG_S;
 
 
@@ -511,5 +545,17 @@ enum _MSG_MMS_TRANSACTION_TYPE_E
        MSG_MMS_UNKNOWN,
 };
 
+/**
+ *     @brief  Represents the values of File Type of MMS. \n
+ *     This enum is used as the value of .
+ */
+enum _MSG_MMS_ITEM_TYPE_E
+{
+       MSG_MMS_ITEM_TYPE_IMG,                  /**< Indicates the image media */
+       MSG_MMS_ITEM_TYPE_AUDIO,                /**< Indicates the audio media */
+       MSG_MMS_ITEM_TYPE_VIDEO,                /**< Indicates the video media */
+       MSG_MMS_ITEM_TYPE_ATTACH,               /**< Indicates the attach file */
+       MSG_MMS_ITEM_TYPE_PAGE, /**< Indicates the page count */
+};
 #endif
 
index 2037e62..33c9bdf 100755 (executable)
@@ -311,13 +311,14 @@ typedef struct
 /**
  *     @brief  Represents the Report Status Data.
  */
- typedef struct
+typedef struct
 {
-       msg_delivery_report_status_t    deliveryStatus;         /**< Indicates the message ID of this message. */
-       time_t                                                  deliveryStatusTime;     /**< Indicates the display time related to the specific operation. */   //MAX_DISPLAY_TIME_LEN
-       msg_read_report_status_t                readStatus;                     /**< Indicates the message ID of this message. */
-       time_t                                                  readStatusTime;         /**< Indicates the display time related to the specific operation. */   //MAX_DISPLAY_TIME_LEN
-}MSG_REPORT_STATUS_INFO_S;
+       char addressVal[MAX_ADDRESS_VAL_LEN+1];
+       int type;
+       int status;
+       time_t statusTime;
+} MSG_REPORT_STATUS_INFO_S;
+
 
 typedef struct
 {
index e76ebb4..fbeea3a 100755 (executable)
@@ -35,6 +35,7 @@ int MsgUpdateThreadReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgUpdateProtectedStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgDeleteMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgDeleteAllMessageInFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgDeleteMessageByListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgMoveMessageToFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgMoveMessageToStorageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgCountMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
@@ -97,17 +98,11 @@ int MsgDeleteFilterHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgGetFilterListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgSetFilterOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgGetFilterOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgSetFilterActivationHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+
 int MsgAddPushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgDeletePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgUpdatePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 
-int MsgGetSMSCListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetCBInfoHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetSmsSendOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetMmsSendOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetMmsRecvOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetPushMsgOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetVoiceMsgOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetGeneralOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 
 #endif // MSG_CMD_HANDLER_H
index fe541b2..17dfaf9 100755 (executable)
@@ -60,11 +60,13 @@ msg_error_t MsgStoUpdateThreadReadStatus(msg_thread_id_t ThreadId);
 msg_error_t MsgStoUpdateProtectedStatus(msg_message_id_t MsgId, bool bProtected);
 msg_error_t MsgStoDeleteMessage(msg_message_id_t MsgId, bool bCheckIndication);
 msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t FolderId, bool bOnlyDB, msg_id_list_s *pMsgIdList);
+msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList);
 msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t MsgId, msg_folder_id_t DestFolderId);
 msg_error_t MsgStoMoveMessageToStorage(const msg_message_id_t MsgId, const msg_storage_id_t DestStorageId);
 msg_error_t MsgStoCountMessage(msg_folder_id_t FolderId, MSG_COUNT_INFO_S *pCountInfo);
 msg_error_t MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount);
 msg_error_t MsgStoGetMessage(msg_message_id_t MsgId, MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo);
+msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv);
 msg_error_t MsgStoGetFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList);
 msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int ExtId, int PinCode);
 msg_error_t MsgStoGetMsgType(msg_message_id_t msgId, MSG_MESSAGE_TYPE_S* pMsgType);
@@ -72,12 +74,12 @@ msg_error_t MsgStoGetText(msg_message_id_t MsgId, char *pSubject, char *pMsgText
 msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE_INFO_S *pMsg);
 msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList);
 msg_error_t MsgStoGetConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList);
-msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t ThreadId, msg_id_list_s *pMsgIdList);
+msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t ThreadId, bool bIncludeProtect, msg_id_list_s *pMsgIdList);
 msg_error_t MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pThreadCountInfo);
 msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList);
 msg_error_t MsgStoSearchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList);
 msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList);
-msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, MSG_REPORT_STATUS_INFO_S* pReportStatus);
+msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus);
 msg_error_t MsgStoGetThreadIdByAddress(const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t *pThreadId);
 msg_error_t MsgStoGetThreadUnreadCnt(msg_thread_id_t ThreadId, int *cnt);
 msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList);
@@ -95,6 +97,7 @@ msg_error_t MsgStoAddFilter(const MSG_FILTER_S *pFilter);
 msg_error_t MsgStoUpdateFilter(const MSG_FILTER_S *pFilter);
 msg_error_t MsgStoDeleteFilter(msg_filter_id_t FilterId);
 msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList);
+msg_error_t MsgStoSetFilterActivation(msg_filter_id_t filterId, bool bActive);
 
 // Sim Operation related Functions
 msg_error_t MsgInitSimMessage(MSG_SIM_STATUS_T SimStatus);
@@ -117,7 +120,6 @@ msg_error_t MsgStoSetReadReportSendStatus(msg_message_id_t msgId, int readReport
 ///////////////////////////////////////////////////////////////////////////////////
 // For MMS - will be removed
 msg_error_t MsgStoGetOrgAddressList(MSG_MESSAGE_INFO_S *pMsg);
-msg_error_t MsgStoUpdateNetworkStatus(MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t Status);
 msg_error_t MsgStoGetSubject(msg_message_id_t MsgId, char* pSubject);
 msg_error_t MsgStoGetRecipientList(msg_message_id_t msgId, MSG_RECIPIENTS_LIST_S *pRecipientList);
 msg_error_t MsgStoGetReadStatus(msg_message_id_t MsgId, bool *pReadStatus);
index cf23937..4497d4d 100755 (executable)
@@ -203,6 +203,7 @@ int msg_delete_filter(msg_handle_t handle, msg_filter_id_t filter_id);
 int msg_get_filter_list(msg_handle_t handle, msg_struct_list_s *filter_list);
 int msg_set_filter_operation(msg_handle_t handle, bool set_flag);
 int msg_get_filter_operation(msg_handle_t handle, bool *set_flag);
+int msg_set_filter_active(msg_handle_t handle, msg_filter_id_t filter_id, bool active);
 
 //setting
 int msg_get_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct);
index b6771e4..1a76929 100755 (executable)
@@ -57,8 +57,10 @@ int msg_cb_message_get_str_value(void *data, int field, char *value, int size);
 
 
 // filter
+bool msg_get_filter_info_bool(void *filter, int field);
 int msg_get_filter_info_int(void *filter, int field);
 char *msg_get_filter_info_str(void *filter, int field);
+int msg_set_filter_info_bool(void *filter, int field, bool value);
 int msg_set_filter_info_int(void *filter, int field, int value);
 int msg_set_filter_info_str(void *filter, int field, char *value, int size);
 
@@ -152,6 +154,7 @@ char* msg_push_config_get_str(void *event_info, int field, int size);
 bool msg_push_config_get_bool(void *event_info, int field);
 int msg_push_config_set_str(void *event_info, int field, char *value, int size);
 int msg_push_config_set_bool(void *event, int field, bool value);
+
 /* added internal apis for new managed api (storage) */
 int msg_syncml_info_get_int(void *syncml_info, int field);
 int msg_count_info_get_int(void *count_info, int field);
@@ -160,13 +163,18 @@ int msg_thread_index_get_int(void *index_info, int field);
 int msg_sortrule_get_int(void *sort_info, int field);
 int msg_folder_info_get_int(void *folder_info, int field);
 int msg_thread_info_get_int(void *data, int field);
+int msg_conv_info_get_int(void *data, int field);
 int msg_search_condition_get_int(void *condition_info, int field);
 int msg_report_status_get_int(void *report_info, int field);
+char* msg_report_status_get_str(void *report_info, int field);
 char* msg_folder_info_get_str(void *folder_info, int field);
 char *msg_thread_info_get_str(void *data, int field);
+char *msg_conv_info_get_str(void *data, int field);
 char* msg_search_condition_get_str(void *condition_info, int field, int size);
 bool msg_sendopt_get_bool(void *send_opt, int field);
 bool msg_sortrule_get_bool(void *sort_rule, int field);
+bool msg_conv_get_bool(void *data, int field);
+bool msg_thread_info_get_bool(void *data, int field);
 int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
 int msg_syncml_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
 int msg_thread_index_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
index 0c2300d..e6351c1 100755 (executable)
@@ -913,6 +913,7 @@ handle is Message handle.
 /*================================================================================================*/
 int msg_get_message(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t msg, msg_struct_t send_opt);
 
+int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t conv);
 
 /**
 
@@ -1165,7 +1166,7 @@ int msg_get_conversation_view_list(msg_handle_t handle, msg_thread_id_t thread_i
  * \endcode
  */
 /*================================================================================================*/
-int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id);
+int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id, bool include_protected_msg);
 
 
 /**
@@ -2078,27 +2079,24 @@ int msg_reg_storage_change_callback(msg_handle_t handle, msg_storage_change_cb c
  * \endcode
  */
 /*================================================================================================*/
-int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t report_status);
-
-
-
+int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list);
 
 int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_address_list);
 
-
 int msg_get_thread_id_by_address(msg_handle_t handle, msg_struct_list_s *msg_address_list, msg_thread_id_t *thread_id);
 
-
 int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_t msg_thread);
 
-
 int msg_get_message_list(msg_handle_t handle, msg_folder_id_t folder_id, msg_thread_id_t thread_id, msg_message_type_t msg_type, msg_storage_id_t storage_id, msg_struct_list_s *msg_list);
 
+
 int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_event);
 
 int msg_delete_push_event(msg_handle_t handle, const msg_struct_t push_event);
 
 int msg_update_push_event(msg_handle_t handle, const msg_struct_t src_event, const msg_struct_t dst_event);
+
+int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_id_list);
 /**
  *     @}
  */
index c2b067f..86d6e4b 100755 (executable)
@@ -51,6 +51,8 @@
 
 #define MAX_COMMON_INFO_SIZE   20
 
+#define MAX_SEGMENT_NUM                        15
+
 /**
  *     @brief  Defines the maximum file path length
  */
 #define MMS_TR_ID_LEN          40
 #define MMS_MSG_ID_LEN         40
 #define MMS_LOCATION_LEN       100
+
+#define MAX_MMS_TEXT_LEN               2000
 /*==================================================================================================
                                          TYPES
 ==================================================================================================*/
@@ -270,6 +274,13 @@ typedef unsigned int msg_contact_id_t;
 
 
 /**
+  *  @brief    Represents a Report Type.
+ *     The values for this type SHOULD be in _MSG_REPORT_TYPE_E
+  */
+typedef int msg_report_type_t;
+
+
+/**
   *  @brief    Represents a Delivery Report Status.
  *     The values for this type SHOULD be in _MSG_DELIVERY_REPORT_STATUS_E
   */
@@ -320,7 +331,7 @@ enum _MSG_STRUCT_E {
 
        MSG_STRUCT_MESSAGE_INFO = 0x0200,                               /**< Indicates the MSG_STRUCT_MESSAGE_INFO */
        MSG_STRUCT_THREAD_INFO = 0x0300,
-
+       MSG_STRUCT_CONV_INFO = 0x0400,
        MSG_STRUCT_MMS = 0x0500,                                                                /**< Indicates the MSG_STRUCT_MMS */
        MSG_STRUCT_MMS_PAGE = 0x0600,                                           /**< Indicates the MSG_STRUCT_MMS_PAGE */
        MSG_STRUCT_MMS_MEDIA = 0x0700,                                  /**< Indicates the MSG_STRUCT_MMS_MEDIA */
@@ -394,7 +405,8 @@ enum _MSG_MESSAGE_INFO_E_ {
 enum MSG_FILTER_INFO_E {
        MSG_FILTER_ID_INT = MSG_STRUCT_FILTER+1,                /**< Indicates the filter ID. */
        MSG_FILTER_TYPE_INT,                                    /**< Indicates the filter type. See enum _MSG_FILTER_TYPE_E */
-       MSG_FILTER_VALUE_STR,                                   /**< The value of a filter. */
+       MSG_FILTER_VALUE_STR,                                   /**< The value of the filter. */
+       MSG_FILTER_ACTIVE_BOOL,                                 /**< Indicates the activation of the filter. */
 };
 
 enum MSG_STRUCT_THREAD_INFO_E {
@@ -406,7 +418,31 @@ enum MSG_STRUCT_THREAD_INFO_E {
        MSG_THREAD_DIRECTION_INT,                               /**< The latest message direction See enum _MSG_DIRECTION_TYPE_E */
        MSG_THREAD_UNREAD_COUNT_INT,                            /**< Indicates unread count of thread */
        MSG_THREAD_SMS_COUNT_INT,                               /**< Indicates sms message count of thread */
-       MSG_THREAD_MMS_COUNT_INT                                /**< Indicates mms message count of thread */
+       MSG_THREAD_MMS_COUNT_INT,                               /**< Indicates mms message count of thread */
+       MSG_THREAD_PROTECTED_BOOL               /**< Indicates whether thread includes protected messages. */
+};
+
+enum MSG_STRUCT_CONV_INFO_E {
+       MSG_CONV_MSG_ID_INT = MSG_STRUCT_CONV_INFO+1,           /**< Indicates the message ID of this message. */
+       MSG_CONV_MSG_THREAD_ID_INT,                             /**< Indicates the thread ID. */
+       MSG_CONV_MSG_TYPE_INT,                                                                                                  /**< Indicates the message type. See enum _MSG_MESSAGE_TYPE_E */
+       MSG_CONV_MSG_FOLDER_ID_INT,                             /**< Indicates the folder ID. see enum _MSG_FOLDER_TYPE_E */
+       MSG_CONV_MSG_STORAGE_ID_INT,                                                                            /**< Indicates where the message is saved. see enum _MSG_STORAGE_ID_E*/
+       MSG_CONV_MSG_SUBJECT_STR,                                                                                       /**< Indicates the message subject. */
+       MSG_CONV_MSG_DISPLAY_TIME_INT,                                                                  /**< Indicates the display time related to the specific operation. */
+       MSG_CONV_MSG_SCHEDULED_TIME_INT,                                                                /**< Indicates the time to send scheduled message. */
+       MSG_CONV_MSG_NETWORK_STATUS_INT,                                                        /**< Indicates the network status of the message. See enum _MSG_NETWORK_STATUS_E */
+       MSG_CONV_MSG_READ_BOOL,                                                                                         /**< Indicates whether the message is read or not. */
+       MSG_CONV_MSG_PROTECTED_BOOL,                                                                    /**< Indicates whether the message is protected or not. */
+       MSG_CONV_MSG_DIRECTION_INT,                                                                                     /**< Indicates whether the message is MO or MT, affecting address. See enum _MSG_DIRECTION_TYPE_E */
+       MSG_CONV_MSG_PAGE_COUNT_INT,                                                                    /**< Indicates the count of pages in mms. */
+       MSG_CONV_MSG_ATTACH_COUNT_INT,                                                                  /**< Indicates the count of attached files in mms. */
+       MSG_CONV_MSG_ATTACH_NAME_STR,                                                           /**< Indicates the attached file name of message. */
+       MSG_CONV_MSG_AUDIO_NAME_STR,                                                                    /**< Indicates the audio file name of message. */
+       MSG_CONV_MSG_IMAGE_THUMB_PATH_STR,                                              /**< Indicates the image thumbnail path of message. */
+       MSG_CONV_MSG_VIDEO_THUMB_PATH_STR,                                              /**< Indicates the video thumbnail path of message. */
+       MSG_CONV_MSG_TEXT_SIZE_INT,                                                                                     /**< Indicates the data size. The unit is byte. */
+       MSG_CONV_MSG_TEXT_STR                                                                                                   /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
 };
 
 enum _MSG_STRUCT_SETTING_SMSC_OPT_E {
@@ -655,12 +691,13 @@ enum MSG_SEARCH_CONDITION_E {
        MSG_SEARCH_CONDITION_RESERVED_INT,
 };
 
-enum MSG_REPORT_STATUS_E {
-       MSG_REPORT_STATUS_DELIVERY_STATUS_INT = MSG_STRUCT_REPORT_STATUS_INFO+1,        /**< Indicates the message ID of this message. */
-       MSG_REPORT_STATUS_DELIVERY_TIME_INT,                                            /**< Indicates the display time related to the specific operation. */
-       MSG_REPORT_STATUS_READ_STATUS_INT,                                              /**< Indicates the message ID of this message. */
-       MSG_REPORT_STATUS_READ_TIME_INT,                                                /**< Indicates the display time related to the specific operation. */
+enum MSG_REPORT_E {
+       MSG_REPORT_ADDRESS_STR = MSG_STRUCT_REPORT_STATUS_INFO+1,       /**< Indicates Report address */
+       MSG_REPORT_TYPE_INT,                                                    /**< Indicates Report type. See the msg_report_type_t type*/
+       MSG_REPORT_STATUS_INT,                                          /**< Indicates Report status. See the msg_delivery_report_status_t or msg_read_report_status_t type*/
+       MSG_REPORT_TIME_INT,                                                    /**< Indicates Report time */
 };
+
 enum MSG_ADDRESS_INFO_E {
        MSG_ADDRESS_INFO_ADDRESS_TYPE_INT = MSG_STRUCT_ADDRESS_INFO+1,                  /**< The type of an address in case of an Email or a mobile phone. See enum _MSG_ADDRESS_TYPE_E */
        MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT,                                            /**< The type of recipient address in case of To, Cc, and Bcc. See enum _MSG_RECIPIENT_TYPE_E */
@@ -715,6 +752,7 @@ enum MSG_CB_MSG_E {
        MSG_CB_MSG_CB_TEXT_STR,                                                 /**< CB text */
        MSG_CB_MSG_ETWS_WARNING_TYPE_INT,                               /**< warning type of ETWS Primary Noti. : 2 bytes binary data */
        MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR,                  /**< warning security information of ETWS Primary Noti. : 50 bytes binary data */
+       MSG_CB_MSG_LANGUAGE_TYPE_STR,                                   /**< Language type of CB message data */
 };
 
 /**
@@ -734,7 +772,7 @@ enum _MSG_CLASS_TYPE_E
  *     @brief  Represents the type of Message. More members maybe added if needed \n
  *     This enum is used as the value of msg_message_type_t.
  */
- enum _MSG_MESSAGE_TYPE_E
+enum _MSG_MESSAGE_TYPE_E
 {
        MSG_TYPE_INVALID = 0,                   /** < Invalid Type Message */
 
@@ -745,6 +783,7 @@ enum _MSG_CLASS_TYPE_E
        MSG_TYPE_SMS_MWI,                               /** < MWI SMS Message */
        MSG_TYPE_SMS_SYNCML,                    /** < SyncML CP SMS Message */
        MSG_TYPE_SMS_REJECT,                    /** < Reject Message */
+
        MSG_TYPE_MMS,                                   /** < Normal MMS Message */
        MSG_TYPE_MMS_JAVA,                      /** < JAVA MMS Message */
        MSG_TYPE_MMS_NOTI,                      /** < MMS Notification Message */
@@ -996,6 +1035,16 @@ enum _MSG_READ_REPORT_STATUS_E
         MSG_READ_REPORT_IS_DELETED     =       1         /**< Indicates the message is deleted */
  };
 
+/**
+ *     @brief  Represents the values of a Report Type. \n
+ *     This enum is used as the value of msg_read_report_status_t.
+*/
+enum _MSG_REPORT_TYPE_E
+ {
+        MSG_REPORT_TYPE_DELIVERY       =       0,        /**< Indicates the type is delivery report*/
+        MSG_REPORT_TYPE_READ   =       1,        /**< Indicates the type is read report */
+
+ };
 
 // filter
 /**
index 0bfef12..fb45a21 100755 (executable)
@@ -30,7 +30,7 @@
 #define MAX_SOUND_FILE_LEN 1024
 
 #define DEFAULT_FILE           "/usr/share/media/Sherbet.wav"
-#define ALERT_ON_CALL_TONE     "/opt/etc/msg-service/alert_on_call.mp3"
+//#define ALERT_ON_CALL_TONE   "/opt/etc/msg-service/alert_on_call.mp3"
 
 #define HAPTIC_TEST_ITERATION 1
 #define MSG_VIBRATION_INTERVAL 3000
index a8c0c26..9e6a608 100755 (executable)
@@ -69,12 +69,14 @@ class MsgHandle
                msg_error_t updateProtectedStatus(msg_message_id_t MsgId, bool bProtected);
                msg_error_t deleteMessage(msg_message_id_t MsgId);
                msg_error_t deleteAllMessagesInFolder(msg_folder_id_t FolderId, bool bOnlyDB);
+               msg_error_t deleteMessagesByList(msg_id_list_s *pMsgIdList);
                msg_error_t moveMessageToFolder(msg_message_id_t MsgId, msg_folder_id_t DestFolderId);
                msg_error_t moveMessageToStorage(msg_message_id_t MsgId, msg_storage_id_t DestStorageId);
                msg_error_t countMessage(msg_folder_id_t FolderId, MSG_COUNT_INFO_S *pCountInfo);
                msg_error_t countMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount);
                msg_error_t countMsgByContact(const MSG_THREAD_LIST_INDEX_INFO_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList);
                msg_error_t getMessage(msg_message_id_t MsgId, MSG_MESSAGE_HIDDEN_S *pMsg, MSG_SENDINGOPT_S *pSendOpt);
+               msg_error_t getConversationViewItem(msg_message_id_t MsgId, MSG_CONVERSATION_VIEW_S *pConv);
                msg_error_t getFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList);
                msg_error_t addFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
                msg_error_t updateFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
@@ -83,7 +85,7 @@ class MsgHandle
 
                msg_error_t getThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList);
                msg_error_t getConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList);
-               msg_error_t deleteThreadMessageList(msg_thread_id_t thread_id);
+               msg_error_t deleteThreadMessageList(msg_thread_id_t thread_id, bool include_protected_msg);
                msg_error_t getQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE_HIDDEN_S *pMsg);
                msg_error_t resetDatabase();
                msg_error_t getMemSize(unsigned int* memsize);
@@ -97,6 +99,7 @@ class MsgHandle
                msg_error_t getFilterList(msg_struct_list_s *pFilterList);
                msg_error_t setFilterOperation(bool bSetFlag);
                msg_error_t getFilterOperation(bool *pSetFlag);
+               msg_error_t setFilterActivation(msg_filter_id_t filter_id, bool active);
 
                //setting
                msg_error_t getSMSCOption(msg_struct_t msg_struct);
@@ -127,10 +130,11 @@ class MsgHandle
                msg_error_t searchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList);
                msg_error_t getRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList);
                msg_error_t regStorageChangeCallback(msg_storage_change_cb onStorageChange, void *pUserParam);
-               msg_error_t getReportStatus(msg_message_id_t msg_id, MSG_REPORT_STATUS_INFO_S *pReport_status);
+               msg_error_t getReportStatus(msg_message_id_t msg_id, msg_struct_list_s *report_list);
                msg_error_t getThreadIdByAddress(msg_struct_list_s *pAddrList, msg_thread_id_t *pThreadId);
                msg_error_t getThread(msg_thread_id_t threadId, MSG_THREAD_VIEW_S* pThreadInfo);
                msg_error_t 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);
+
                // Push Event
                msg_error_t addPushEvent(MSG_PUSH_EVENT_INFO_S *push_event);
                msg_error_t deletePushEvent(MSG_PUSH_EVENT_INFO_S *push_event);
index 47385dd..c4735be 100755 (executable)
@@ -139,7 +139,7 @@ public:
        void handleEvent(const MSG_EVENT_S* ptr);
 
        int getRemoteFd();
-       int readFromSocket(char** buf, int* len);
+       int readFromSocket(char** buf, unsigned int* len);
 
 private:
        MsgProxyListener();
index 6aee579..82c3212 100755 (executable)
@@ -62,6 +62,8 @@ bool  MsgSettingGetUnknownAutoReject();
 
 void   MsgSettingRegVconfCB();
 void   MsgSettingRemoveVconfCB();
+
 void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb);
+void MsgSettingRemoveVconfCBCommon(const char *pKey, _vconf_change_cb pCb);
 
 #endif // MSG_GCONF_WRAPPER_H
index 683f26e..a4866f0 100755 (executable)
@@ -65,14 +65,14 @@ public:
        msg_error_t connect(const char *path);
        msg_error_t close();
        /* write msg to ipc server */
-       int     write(const char* buf, int len);
+       int     write(const char* buf, unsigned int len);
        /* read msg from ipc server */
-       int     read(char** buf, int* len);
+       int     read(char** buf, unsigned int* len);
        void    addfd(int fd);
        int             getRemoteFd() {return remotefd; }
 private:
-       int readn(char *buf, int len );
-       int writen (const char *buf, int len);
+       int readn(char *buf, unsigned int len );
+       int writen (const char *buf, unsigned int len);
 
        int sockfd, remotefd, maxfd;
        fd_set fds;
@@ -95,13 +95,13 @@ public:
        /* read msg from client of fd */
        int     read(int fd, char** buf, int* len );
        /* write msg to ipc client */
-       int     write(int fd, const char* buf, int len);
+       int     write(int fd, const char* buf, unsigned int len);
        void    addfd(int fd);
        void    setSockfd(int fd) { sockfd = fd; }
 
 private:
-       int readn(int fd, char *buf, int len );
-       int writen (int fd, const char *buf, int len);
+       int readn(int fd, char *buf, unsigned int len );
+       int writen (int fd, const char *buf, unsigned int len);
 
        /* server socket fd */
        int sockfd;
index 8eb6173..1704d6f 100755 (executable)
@@ -47,6 +47,8 @@
 
 msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg);
 
+msg_error_t MsgInsertNoti(MSG_MESSAGE_INFO_S* pMsg);
+
 msg_error_t MsgInsertSmsReportToNoti(MsgDbHandler *pDbHandle, msg_message_id_t MsgId, msg_delivery_report_status_t Status);
 
 msg_error_t MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg);
index 55defbc..75426c2 100755 (executable)
@@ -26,7 +26,7 @@
 /*==================================================================================================
                                     DEFINES
 ==================================================================================================*/
-#define MSGFW_DB_NAME                  "/opt/dbspace/.msg_service.db"
+#define MSGFW_DB_NAME                  "/opt/usr/dbspace/.msg_service.db"
 
 #define MSGFW_MESSAGE_TABLE_NAME                               "MSG_MESSAGE_TABLE"
 #define MSGFW_FOLDER_TABLE_NAME                                        "MSG_FOLDER_TABLE"
@@ -39,8 +39,9 @@
 #define MMS_PLUGIN_MESSAGE_TABLE_NAME          "MSG_MMS_MESSAGE_TABLE"
 #define MSGFW_SYNCML_MSG_TABLE_NAME            "MSG_SYNCML_TABLE"
 #define MSGFW_SMS_SENDOPT_TABLE_NAME           "MSG_SMS_SENDOPT_TABLE"
-
+#define MSGFW_REPORT_TABLE_NAME                                "MSG_REPORT_TABLE"
 #define MSGFW_PUSH_CONFIG_TABLE_NAME                   "MSG_PUSHCFG_TABLE"
+#define MSGFW_MMS_PREVIEW_TABLE_NAME                   "MSG_MMS_PREVIEW_INFO_TABLE"
 #define MAX_QUERY_LEN                                  3072
 #define MAX_FOLDER_NAME_LEN            20
 #define MAX_ACCOUNT_NAME_LEN   51
similarity index 91%
rename from plugin/sms_plugin/include/SmsPluginTextConvert.h
rename to include/utils/MsgTextConvert.h
index 08cee2b..d15bc4c 100755 (executable)
@@ -14,8 +14,8 @@
 * limitations under the License.
 */
 
-#ifndef SMS_PLUGIN_TEXT_CONVERT_H
-#define SMS_PLUGIN_TEXT_CONVERT_H
+#ifndef MSG_TEXT_CONVERT_H
+#define MSG_TEXT_CONVERT_H
 
 
 /*==================================================================================================
@@ -23,7 +23,7 @@
 ==================================================================================================*/
 #include <map>
 
-#include "SmsPluginTypes.h"
+//#include "SmsPluginTypes.h"
 
 
 /*==================================================================================================
 
 typedef unsigned short WCHAR;
 
-typedef unsigned char SMS_CHAR_TYPE_T;
+typedef unsigned char MSG_CHAR_TYPE_T;
+
+typedef unsigned char MSG_LANGUAGE_ID_T;
 
 
 /*==================================================================================================
                                 ENUMS
 ==================================================================================================*/
-enum _SMS_CHAR_TYPE_E
+enum _MSG_CHAR_TYPE_E
 {
-       SMS_CHAR_DEFAULT = 0,
-       SMS_CHAR_GSM7EXT,
-       SMS_CHAR_TURKISH,
-       SMS_CHAR_SPANISH,
-       SMS_CHAR_PORTUGUESE
+       MSG_CHAR_DEFAULT = 0,
+       MSG_CHAR_GSM7EXT,
+       MSG_CHAR_TURKISH,
+       MSG_CHAR_SPANISH,
+       MSG_CHAR_PORTUGUESE
 };
 
+enum _MSG_LANGUAGE_ID_E
+{
+       MSG_LANG_ID_RESERVED = 0,
+       MSG_LANG_ID_TURKISH,
+       MSG_LANG_ID_SPANISH,
+       MSG_LANG_ID_PORTUGUESE,
+       MSG_LANG_ID_BENGALI,
+       MSG_LANG_ID_GUJARATI,
+       MSG_LANG_ID_HINDI,
+       MSG_LANG_ID_KANNADA,
+       MSG_LANG_ID_MALAYALAM,
+       MSG_LANG_ID_ORIYA,
+       MSG_LANG_ID_PUNJABI,
+       MSG_LANG_ID_TAMIL,
+       MSG_LANG_ID_TELUGU,
+       MSG_LANG_ID_URDU,
+};
 
 /*==================================================================================================
                                      STRUCTURES
 ==================================================================================================*/
+
+typedef struct _MSG_LANG_INFO_S
+{
+       bool                                                    bSingleShift;
+       bool                                                    bLockingShift;
+
+       MSG_LANGUAGE_ID_T                       singleLang;
+       MSG_LANGUAGE_ID_T                       lockingLang;
+} MSG_LANG_INFO_S;
+
+
+typedef struct _MSG_SINGLE_SHIFT_S
+{
+       MSG_LANGUAGE_ID_T       langId;
+} MSG_SINGLE_SHIFT_S;
+
+
+typedef struct _MSG_LOCKING_SHIFT_S
+{
+       MSG_LANGUAGE_ID_T       langId;
+} MSG_LOCKING_SHIFT_S;
+
+
 // ETSI GSM 03.38 GSM 7 bit Default Alphabet Table -> UCS2
 static const WCHAR g_GSM7BitToUCS2[] =
 {
@@ -209,29 +251,25 @@ static const WCHAR g_PortuLockingToUCS2[] =
 /*==================================================================================================
                                 CLASS DEFINITIONS
 ==================================================================================================*/
-class SmsPluginTextConvert
+class MsgTextConvert
 {
 public:
-       static SmsPluginTextConvert* instance();
+       MsgTextConvert();
+       ~MsgTextConvert();
 
-       int convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT SMS_LANGUAGE_ID_T *pLangId);
+       int convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId);
        int convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen);
        int convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT msg_encode_type_t *pCharType);
 
-       int convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, IN SMS_LANG_INFO_S *pLangInfo);
+       int convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo);
        int convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN  int srcTextLen);
        int convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN  int srcTextLen);
 
 private:
-       SmsPluginTextConvert();
-       virtual ~SmsPluginTextConvert();
-
-       static SmsPluginTextConvert* pInstance;
-
-       int convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT SMS_LANGUAGE_ID_T *pLangId);
+       int convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId);
        int convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown);
 
-       int convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN SMS_LANG_INFO_S *pLangInfo);
+       int convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo);
 
        void convertDumpTextToHex(const unsigned char *pText, int length);
 
@@ -243,5 +281,5 @@ private:
        std::map<unsigned short, unsigned char> ucs2toPortuList;
 };
 
-#endif //SMS_PLUGIN_TEXT_CONVERT_H
+#endif //MSG_TEXT_CONVERT_H
 
index 0d11260..51bc9d0 100755 (executable)
@@ -68,7 +68,7 @@ int MsgEncodeSyncMLOperationData(int msgId, int extId, char **ppDest);
 
 int MsgEncodeStorageChangeData(const msg_storage_change_type_t storageChangeType, const msg_id_list_s *pMsgIdList, char **ppDest);
 
-int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, char **ppDest);
+int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, int count, char **ppDest);
 
 int MsgEncodeThreadId(msg_thread_id_t *pThreadId, char **ppDest);
 
@@ -100,7 +100,7 @@ void        MsgDecodeContactCount(char *pSrc,  MSG_THREAD_COUNT_INFO_S *pMsgThreadCount
 
 void MsgDecodeMemSize(char *pSrc, unsigned int *memsize);
 
-void   MsgDecodeReportStatus(char *pSrc,  MSG_REPORT_STATUS_INFO_S *pReportStatus);
+void MsgDecodeReportStatus(char *pSrc,  msg_struct_list_s *report_list);
 
 void MsgDecodeThreadId(char *pSrc, msg_thread_id_t *pThreadId);
 
index d0ab5d9..65cce9a 100755 (executable)
@@ -55,6 +55,7 @@ msg_error_t MsgStoClearContactInfo(MsgDbHandler *pDbHandle, int ContactId, const
 msg_error_t MsgStoGetMmsRawFilePath(MsgDbHandler *pDbHandle, msg_message_id_t msgId, char *pFilePath);
 bool MsgStoCheckReadReportRequested(MsgDbHandler *pDbHandle, msg_message_id_t MsgId);
 bool MsgStoCheckReadReportIsSent(MsgDbHandler *pDbHandle, msg_message_id_t MsgId);
+msg_error_t MsgStoUpdateNetworkStatus(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t status);
 char *MsgStoReplaceString(const char *org_str, const char *old_str, const char *new_str);
 
 #endif // MSG_UTIL_STORAGE_H
index cf862e0..62a41a8 100755 (executable)
@@ -191,6 +191,51 @@ EXPORT_API int msg_get_filter_operation(msg_handle_t handle, bool *set_flag)
 }
 
 
+EXPORT_API int msg_set_filter_active(msg_handle_t handle, msg_filter_id_t filter_id, bool active)
+{
+       msg_error_t err =  MSG_SUCCESS;
+
+       if (handle == NULL)
+       {
+               return -EINVAL;
+       }
+
+       MsgHandle* pHandle = (MsgHandle*)handle;
+
+       try
+       {
+               err = pHandle->setFilterActivation(filter_id, active);
+       }
+       catch (MsgException& e)
+       {
+               MSG_FATAL("%s", e.what());
+               return MSG_ERR_FILTER_ERROR;
+       }
+
+       return err;
+}
+
+
+bool msg_get_filter_info_bool(void *filter, int field)
+{
+       if (!filter)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = 0;
+
+       MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter;
+
+       switch (field)
+       {
+       case MSG_FILTER_ACTIVE_BOOL :
+               ret = filter_data->bActive;
+               break;
+       default :
+               return MSG_ERR_INVALID_PARAMETER;
+       }
+
+       return ret;
+}
 
 
 int msg_get_filter_info_int(void *filter, int field)
@@ -239,6 +284,26 @@ char *msg_get_filter_info_str(void *filter, int field)
        return ret_str;
 }
 
+int msg_set_filter_info_bool(void *filter, int field, bool value)
+{
+       if (!filter)
+               return MSG_ERR_NULL_POINTER;
+
+       msg_error_t err =  MSG_SUCCESS;
+       MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter;
+
+       switch (field)
+       {
+       case MSG_FILTER_ACTIVE_BOOL :
+               filter_data->bActive = value;
+               break;
+       default :
+               return MSG_ERR_INVALID_PARAMETER;
+       }
+
+       return err;
+}
+
 int msg_set_filter_info_int(void *filter, int field, int value)
 {
        if (!filter)
index d69bdbd..b813f2e 100755 (executable)
@@ -265,7 +265,7 @@ int msg_message_get_str_value(void *data, int field, char *value, int size)
                if (msg_data->pData)
                {
                        int data_len = 0;
-                       (size >= msg_data->dataSize)? (data_len = msg_data->dataSize) : data_len = size;
+                       ((size_t)size >= msg_data->dataSize)? (data_len = msg_data->dataSize) : data_len = size;
                        memset(value, 0, size);
                        memcpy(value, msg_data->pData, data_len);
                }
@@ -285,8 +285,6 @@ int msg_message_get_struct_hnd(void *data, int field, void **value)
 
        int ret = MSG_SUCCESS;
 
-       MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data;
-
        switch (field) {
        default :
                ret = MSG_ERR_INVALID_PARAMETER;
@@ -354,7 +352,10 @@ int msg_message_set_int_value(void *data, int field, int value)
         } else if (value == MSG_TYPE_SMS_REJECT) {
                msg_data->mainType = MSG_SMS_TYPE;
                msg_data->subType = MSG_REJECT_SMS;
-        }
+        }      else if (value == MSG_TYPE_SMS_ETWS_PRIMARY) {
+                       msg_data->mainType = MSG_SMS_TYPE;
+                       msg_data->subType = MSG_ETWS_SMS;
+               }
         break;
        }
        case MSG_MESSAGE_CLASS_TYPE_INT :
@@ -473,8 +474,6 @@ int msg_message_set_struct_hnd(void *data, int field, void *value)
 
        int ret = MSG_SUCCESS;
 
-       MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data;
-
        switch (field) {
        default :
                ret = MSG_ERR_INVALID_PARAMETER;
@@ -598,9 +597,17 @@ int msg_cb_message_get_str_value(void *data, int field, char *value, int size)
                                value[copylen] = '\0';
                        }
                        break;
+               case MSG_CB_MSG_LANGUAGE_TYPE_STR:
+                       {
+                               int     copylen = 0;
+                               copylen = ((size_t)size > strlen((const char*)cb_msg->language_type)) ? strlen((const char*)cb_msg->language_type) : size - 1;
+                               memcpy (value, cb_msg->language_type, copylen);
+                               value[copylen] = '\0';
+                       }
+                       break;
                case MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR:
                        {
-                               if (size < sizeof(cb_msg->etwsWarningSecurityInfo))
+                               if ((size_t)size < sizeof(cb_msg->etwsWarningSecurityInfo))
                                        ret = MSG_ERR_INVALID_PARAMETER;
                                else
                                        memcpy (value, cb_msg->etwsWarningSecurityInfo, sizeof(cb_msg->etwsWarningSecurityInfo));
index 218f643..7231f24 100755 (executable)
@@ -1065,7 +1065,6 @@ EXPORT_API int msg_mms_add_item(msg_struct_t msg_struct_handle, int field, msg_s
        msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        msg_struct_s *msg_struct_item = NULL;
-       void *data = NULL;
        switch(msg_struct->type) {
        case MSG_STRUCT_MMS:
        {
index 76bf5f4..ee4a065 100755 (executable)
@@ -25,7 +25,7 @@
 #include "msg_storage.h"
 
 
-static int msg_thread_get_msg_type(int mainType, int subType);
+static int msg_get_msg_type(int mainType, int subType);
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
@@ -218,6 +218,31 @@ EXPORT_API int msg_delete_all_msgs_in_folder(msg_handle_t handle, msg_folder_id_
 }
 
 
+EXPORT_API int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_id_list)
+{
+       msg_error_t err =  MSG_SUCCESS;
+
+       if (handle == NULL)
+       {
+               return -EINVAL;
+       }
+
+       MsgHandle* pHandle = (MsgHandle*)handle;
+
+       try
+       {
+               err = pHandle->deleteMessagesByList(msg_id_list);
+       }
+       catch (MsgException& e)
+       {
+               MSG_FATAL("%s", e.what());
+               return MSG_ERR_STORAGE_ERROR;
+       }
+
+       return err;
+}
+
+
 EXPORT_API int msg_move_msg_to_folder(msg_handle_t handle, msg_message_id_t msg_id, msg_folder_id_t dest_folder_id)
 {
        msg_error_t err =  MSG_SUCCESS;
@@ -499,7 +524,7 @@ EXPORT_API int msg_get_conversation_view_list(msg_handle_t handle, msg_thread_id
 }
 
 
-EXPORT_API int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id)
+EXPORT_API int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id, bool include_protected_msg)
 {
        msg_error_t err =  MSG_SUCCESS;
 
@@ -512,7 +537,7 @@ EXPORT_API int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id
 
        try
        {
-               err = pHandle->deleteThreadMessageList(thread_id);
+               err = pHandle->deleteThreadMessageList(thread_id, include_protected_msg);
        }
        catch (MsgException& e)
        {
@@ -1101,22 +1126,20 @@ EXPORT_API int msg_reg_storage_change_callback(msg_handle_t handle, msg_storage_
        return err;
 }
 
-
-EXPORT_API int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t report_status)
+EXPORT_API int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list)
 {
        msg_error_t err =  MSG_SUCCESS;
 
-       if (handle == NULL || msg_id < 1)
+       if (handle == NULL || msg_id < 1 || report_list == NULL)
        {
                return -EINVAL;
        }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
-       msg_struct_s *pStruct = (msg_struct_s *)report_status;
 
        try
        {
-               err = pHandle->getReportStatus(msg_id, (MSG_REPORT_STATUS_INFO_S *)pStruct->data);
+               err = pHandle->getReportStatus(msg_id, report_list);
        }
        catch (MsgException& e)
        {
@@ -1232,7 +1255,7 @@ EXPORT_API int msg_get_message_list(msg_handle_t handle, msg_folder_id_t folder_
        return err;
 }
 
-static int msg_thread_get_msg_type(int mainType, int subType)
+static int msg_get_msg_type(int mainType, int subType)
 {
        if (mainType == MSG_SMS_TYPE)
        {
@@ -1268,7 +1291,7 @@ static int msg_thread_get_msg_type(int mainType, int subType)
 
 int msg_syncml_info_get_int(void *syncml_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)syncml_info;
        switch(field)
        {
@@ -1279,7 +1302,7 @@ int msg_syncml_info_get_int(void *syncml_info, int field)
                result = pSync->pinCode;
                break;
        default:
-               result = -1;
+               result = MSG_ERR_INVALID_PARAMETER;
                break;
        }
        return result;
@@ -1287,7 +1310,7 @@ int msg_syncml_info_get_int(void *syncml_info, int field)
 
 int msg_count_info_get_int(void *count_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_COUNT_INFO_S *pCount = (MSG_COUNT_INFO_S *)count_info;
        switch(field)
        {
@@ -1304,7 +1327,7 @@ int msg_count_info_get_int(void *count_info, int field)
                result = pCount->nMms;
                break;
        default:
-               result = -1;
+               result = MSG_ERR_INVALID_PARAMETER;
                break;
        }
        return result;
@@ -1312,7 +1335,7 @@ int msg_count_info_get_int(void *count_info, int field)
 
 int msg_thread_count_get_int(void *count_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_THREAD_COUNT_INFO_S *pCount = (MSG_THREAD_COUNT_INFO_S *)count_info;
        switch(field)
        {
@@ -1329,7 +1352,7 @@ int msg_thread_count_get_int(void *count_info, int field)
                result = pCount->mmsMsgCount;
                break;
        default:
-               result = -1;
+               result = MSG_ERR_INVALID_PARAMETER;
                break;
        }
        return result;
@@ -1337,7 +1360,7 @@ int msg_thread_count_get_int(void *count_info, int field)
 
 int msg_thread_index_get_int(void *index_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_THREAD_LIST_INDEX_S *pIndex = (MSG_THREAD_LIST_INDEX_S *)index_info;
        switch(field)
        {
@@ -1345,7 +1368,7 @@ int msg_thread_index_get_int(void *index_info, int field)
                result = pIndex->contactId;
                break;
        default:
-               result = -1;
+               result = MSG_ERR_INVALID_PARAMETER;
                break;
        }
        return result;
@@ -1353,7 +1376,7 @@ int msg_thread_index_get_int(void *index_info, int field)
 
 int msg_sortrule_get_int(void *sort_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_info;
        switch(field)
        {
@@ -1361,7 +1384,7 @@ int msg_sortrule_get_int(void *sort_info, int field)
                result = pSort->sortType;
                break;
        default:
-               result = -1;
+               result = MSG_ERR_INVALID_PARAMETER;
                break;
        }
        return result;
@@ -1369,7 +1392,7 @@ int msg_sortrule_get_int(void *sort_info, int field)
 
 int msg_folder_info_get_int(void *folder_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
        switch(field)
        {
@@ -1380,7 +1403,7 @@ int msg_folder_info_get_int(void *folder_info, int field)
                result = pFolder->folderType;
                break;
        default:
-               result = -1;
+               result = MSG_ERR_INVALID_PARAMETER;
                break;
        }
        return result;
@@ -1388,7 +1411,7 @@ int msg_folder_info_get_int(void *folder_info, int field)
 
 int msg_thread_info_get_int(void *data, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_THREAD_VIEW_S *pThread = (MSG_THREAD_VIEW_S *)data;
 
        switch(field)
@@ -1397,7 +1420,7 @@ int msg_thread_info_get_int(void *data, int field)
                result = pThread->threadId;
                break;
        case MSG_THREAD_MSG_TYPE_INT :
-               result = msg_thread_get_msg_type(pThread->mainType, pThread->subType);
+               result = msg_get_msg_type(pThread->mainType, pThread->subType);
                break;
        case MSG_THREAD_MSG_TIME_INT :
                result = pThread->threadTime;
@@ -1415,15 +1438,67 @@ int msg_thread_info_get_int(void *data, int field)
                result = pThread->mmsCnt;
                break;
        default:
-               result = -1;
+               result = MSG_ERR_INVALID_PARAMETER;
+               break;
+       }
+       return result;
+}
+
+
+int msg_conv_info_get_int(void *data, int field)
+{
+       int result = MSG_ERR_INVALID_PARAMETER;
+       MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
+
+       switch(field)
+       {
+       case MSG_CONV_MSG_ID_INT :
+               result = pConv->msgId;
+               break;
+       case MSG_CONV_MSG_THREAD_ID_INT :
+               result = pConv->threadId;
+               break;
+       case MSG_CONV_MSG_FOLDER_ID_INT :
+               result = pConv->folderId;
+               break;
+       case MSG_CONV_MSG_TYPE_INT :
+               result = msg_get_msg_type(pConv->mainType, pConv->subType);
+               break;
+       case MSG_CONV_MSG_STORAGE_ID_INT :
+               result = pConv->storageId;
+               break;
+       case MSG_CONV_MSG_DISPLAY_TIME_INT :
+               result = pConv->displayTime;
+               break;
+       case MSG_CONV_MSG_SCHEDULED_TIME_INT :
+               result = pConv->scheduledTime;
+               break;
+       case MSG_CONV_MSG_NETWORK_STATUS_INT :
+               result = pConv->networkStatus;
+               break;
+       case MSG_CONV_MSG_DIRECTION_INT :
+               result = pConv->direction;
+               break;
+       case MSG_CONV_MSG_ATTACH_COUNT_INT :
+               result = pConv->attachCount;
+               break;
+       case MSG_CONV_MSG_TEXT_SIZE_INT :
+               result = pConv->textSize;
+               break;
+       case MSG_CONV_MSG_PAGE_COUNT_INT :
+               result = pConv->pageCount;
+               break;
+       default:
+               result = MSG_ERR_INVALID_PARAMETER;
                break;
        }
        return result;
 }
 
+
 int msg_search_condition_get_int(void *condition_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_SEARCH_CONDITION_S *pCond = (MSG_SEARCH_CONDITION_S *)condition_info;
        switch(field)
        {
@@ -1437,7 +1512,7 @@ int msg_search_condition_get_int(void *condition_info, int field)
                result = pCond->reserved;
                break;
        default:
-               result = -1;
+               result = MSG_ERR_INVALID_PARAMETER;
                break;
        }
        return result;
@@ -1445,24 +1520,39 @@ int msg_search_condition_get_int(void *condition_info, int field)
 
 int msg_report_status_get_int(void *report_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
        switch(field)
        {
-       case MSG_REPORT_STATUS_DELIVERY_STATUS_INT:
-               result = pReport->deliveryStatus;
+       case MSG_REPORT_TYPE_INT:
+               result = pReport->type;
                break;
-       case MSG_REPORT_STATUS_DELIVERY_TIME_INT:
-               result = pReport->deliveryStatusTime;
+       case MSG_REPORT_STATUS_INT:
+               result = pReport->status;
                break;
-       case MSG_REPORT_STATUS_READ_STATUS_INT:
-               result = pReport->readStatus;
+       case MSG_REPORT_TIME_INT:
+               result = pReport->statusTime;
                break;
-       case MSG_REPORT_STATUS_READ_TIME_INT:
-               result = pReport->readStatusTime;
+
+       default:
+               result = MSG_ERR_INVALID_PARAMETER;
                break;
+       }
+       return result;
+}
+
+char* msg_report_status_get_str(void *report_info, int field)
+{
+       char *result = NULL;
+       MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
+       switch(field)
+       {
+
+       case MSG_REPORT_ADDRESS_STR:
+               result = pReport->addressVal;
+               break;
+
        default:
-               result = -1;
                break;
        }
        return result;
@@ -1504,6 +1594,40 @@ char *msg_thread_info_get_str(void *data, int field)
        return ret_str;
 }
 
+
+char *msg_conv_info_get_str(void *data, int field)
+{
+       char *ret_str = NULL;
+       MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
+
+       switch(field)
+       {
+       case MSG_CONV_MSG_SUBJECT_STR :
+               ret_str = pConv->subject;
+               break;
+       case MSG_CONV_MSG_ATTACH_NAME_STR :
+               ret_str = pConv->attachFileName;
+               break;
+       case MSG_CONV_MSG_AUDIO_NAME_STR :
+               ret_str = pConv->audioFileName;
+               break;
+       case MSG_CONV_MSG_IMAGE_THUMB_PATH_STR :
+               ret_str = pConv->imageThumbPath;
+               break;
+       case MSG_CONV_MSG_VIDEO_THUMB_PATH_STR :
+               ret_str = pConv->videoThumbPath;
+               break;
+       case MSG_CONV_MSG_TEXT_STR :
+               ret_str = pConv->pText;
+               break;
+       default:
+               break;
+       }
+
+       return ret_str;
+}
+
+
 char* msg_search_condition_get_str(void *condition_info, int field, int size)
 {
        char *result = NULL;
@@ -1560,6 +1684,39 @@ bool msg_sortrule_get_bool(void *sort_rule, int field)
        return result;
 }
 
+bool msg_conv_get_bool(void *data, int field)
+{
+       bool result = false;
+       MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
+       switch(field)
+       {
+       case MSG_CONV_MSG_READ_BOOL:
+               result = pConv->bRead;
+               break;
+       case MSG_CONV_MSG_PROTECTED_BOOL:
+               result = pConv->bProtected;
+               break;
+       default:
+               break;
+       }
+       return result;
+}
+
+bool msg_thread_info_get_bool(void *data, int field)
+{
+       bool result = false;
+       MSG_THREAD_VIEW_S *pthreadInfo = (MSG_THREAD_VIEW_S *)data;
+       switch(field)
+       {
+       case MSG_THREAD_PROTECTED_BOOL:
+               result = pthreadInfo->bProtected;
+               break;
+       default:
+               break;
+       }
+       return result;
+}
+
 int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
 {
        msg_error_t err =  MSG_SUCCESS;
@@ -1627,7 +1784,7 @@ int msg_thread_index_get_struct_handle(msg_struct_s *msg_struct, int field, void
 
 int msg_address_info_get_int(void *addr_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addr_info;
        switch(field)
        {
@@ -1647,7 +1804,7 @@ int msg_address_info_get_int(void *addr_info, int field)
 }
 int msg_mms_sendopt_get_int(void *opt_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)opt_info;
        switch(field)
        {
@@ -1668,7 +1825,7 @@ int msg_mms_sendopt_get_int(void *opt_info, int field)
 
 int msg_reject_message_get_int(void *msg_info, int field)
 {
-       int result = -1;
+       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
        switch(field)
        {
@@ -1929,25 +2086,23 @@ int msg_report_status_set_int(void *report_info, int field, int value)
        if(!report_info)
                return MSG_ERR_NULL_POINTER;
 
-    MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
-    switch(field)
-    {
-    case MSG_REPORT_STATUS_DELIVERY_STATUS_INT:
-               pReport->deliveryStatus = value;
-               break;
-    case MSG_REPORT_STATUS_DELIVERY_TIME_INT:
-               pReport->deliveryStatusTime = value;
+       MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
+       switch(field)
+       {
+               case MSG_REPORT_TYPE_INT:
+                       pReport->type = value;
                break;
-    case MSG_REPORT_STATUS_READ_STATUS_INT:
-               pReport->readStatus = value;
+               case MSG_REPORT_STATUS_INT:
+                       pReport->status = value;
                break;
-    case MSG_REPORT_STATUS_READ_TIME_INT:
-               pReport->readStatusTime = value;
+               case MSG_REPORT_TIME_INT:
+                       pReport->statusTime = value;
                break;
-    default:
+
+               default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
 
        return err;
 }
index f05138c..b7461d7 100755 (executable)
 
 #include <string.h>
 
+#include "MsgDebug.h"
 #include "MsgTypes.h"
 #include "MsgHandle.h"
+#include "MsgTextConvert.h"
 #include "MsgException.h"
 
 #include "msg_private.h"
@@ -42,6 +44,12 @@ EXPORT_API msg_struct_t msg_create_struct(int field)
        case MSG_STRUCT_MESSAGE_INFO :
                msg_message_create_struct(msg_struct);
                break;
+       case MSG_STRUCT_CONV_INFO:
+       {
+               msg_struct->data = (void *)new MSG_CONVERSATION_VIEW_S;
+               memset(msg_struct->data, 0x00, sizeof(MSG_CONVERSATION_VIEW_S));
+               break;
+       }
        case MSG_STRUCT_FILTER:
        {
                msg_struct->data = (void *)new MSG_FILTER_S;
@@ -339,6 +347,22 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle)
                *msg_struct_handle = NULL;
                break;
        }
+       case MSG_STRUCT_CONV_INFO:
+       {
+               MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S*)(msg_struct->data);
+
+               if (pConv->pText) {
+                       delete [] pConv->pText;
+                       pConv->pText = NULL;
+               }
+
+               delete pConv;
+               msg_struct->data = NULL;
+
+               delete msg_struct;
+               *msg_struct_handle = NULL;
+               break;
+       }
        case MSG_STRUCT_THREAD_INFO:
        {
                delete (MSG_THREAD_VIEW_S*)(msg_struct->data);
@@ -643,6 +667,15 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle)
                *msg_struct_handle = NULL;
                break;
        }
+       case MSG_STRUCT_ADDRESS_INFO :
+       {
+               delete (MSG_ADDRESS_INFO_S*)(msg_struct->data);
+               msg_struct->data = NULL;
+
+               delete msg_struct;
+               *msg_struct_handle = NULL;
+               break;
+       }
        case MSG_STRUCT_PUSH_CONFIG_INFO:
        {
                delete (MSG_PUSH_EVENT_INFO_S*)(msg_struct->data);
@@ -674,7 +707,21 @@ int msg_release_list_struct(msg_struct_list_s *msg_struct_list)
        }
 
        if(msg_struct_list->nCount > 0) {
-               for(int i = 0; i < msg_struct_list->nCount; i++) {
+               int structType = ((msg_struct_s *)msg_struct_list->msg_struct_info[0])->type;
+               int listCnt = msg_struct_list->nCount;
+
+               switch (structType)
+               {
+               case MSG_STRUCT_ADDRESS_INFO :
+               {
+                       listCnt = MAX_TO_ADDRESS_CNT;
+                       break;
+               }
+               default :
+                       break;
+               }
+
+               for(int i = 0; i < listCnt; i++) {
                        msg_release_struct(&(msg_struct_list->msg_struct_info[i]));
                }
        }
@@ -729,6 +776,9 @@ EXPORT_API int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int
        case MSG_STRUCT_THREAD_INFO :
                *value = msg_thread_info_get_int(msg_struct->data, field);
                break;
+       case MSG_STRUCT_CONV_INFO :
+               *value = msg_conv_info_get_int(msg_struct->data, field);
+               break;
        case MSG_STRUCT_SEARCH_CONDITION :
                *value = msg_search_condition_get_int(msg_struct->data, field);
                break;
@@ -824,6 +874,13 @@ EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char
                else
                        strncpy(src, ret_str, size);
                break;
+       case MSG_STRUCT_CONV_INFO :
+               ret_str = msg_conv_info_get_str(msg_struct->data, field);
+               if (ret_str == NULL)
+                       err = MSG_ERR_UNKNOWN;
+               else
+                       strncpy(src, ret_str, size);
+               break;
        case MSG_STRUCT_SEARCH_CONDITION :
                ret_str = msg_search_condition_get_str(msg_struct->data, field, size);
                if (ret_str == NULL)
@@ -870,8 +927,16 @@ EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char
                else
                        strncpy(src, ret_str, size);
                break;
+       case MSG_STRUCT_REPORT_STATUS_INFO:
+               ret_str = msg_report_status_get_str(msg_struct->data, field);
+               if (ret_str == NULL)
+                       err = MSG_ERR_UNKNOWN;
+               else
+                       strncpy(src, ret_str, size);
+               break;
        case MSG_STRUCT_CB_MSG :
                err = msg_cb_message_get_str_value(msg_struct->data, field, src, size);
+               break;
        default :
                err = MSG_ERR_INVALID_PARAMETER;
                break;
@@ -894,9 +959,18 @@ EXPORT_API int msg_get_bool_value(msg_struct_t msg_struct_handle, int field, boo
 
        switch (msg_struct->type)
        {
+       case MSG_STRUCT_FILTER :
+               *value = msg_get_filter_info_bool(msg_struct->data, field);
+               break;
        case MSG_STRUCT_MESSAGE_INFO :
                err = msg_message_get_bool_value(msg_struct->data, field, value);
                break;
+       case MSG_STRUCT_THREAD_INFO :
+               *value = msg_thread_info_get_bool(msg_struct->data, field);
+               break;
+       case MSG_STRUCT_CONV_INFO:
+               *value = msg_conv_get_bool(msg_struct->data, field);
+               break;
        case MSG_STRUCT_SENDOPT:
                *value = msg_sendopt_get_bool(msg_struct->data, field);
                break;
@@ -1170,6 +1244,9 @@ EXPORT_API int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, boo
 
        switch (msg_struct->type)
        {
+       case MSG_STRUCT_FILTER :
+               err = msg_set_filter_info_bool(msg_struct->data, field, value);
+               break;
        case MSG_STRUCT_MESSAGE_INFO :
                err = msg_message_set_bool_value(msg_struct->data, field, value);
                break;
@@ -1286,3 +1363,95 @@ EXPORT_API int msg_list_length(msg_list_handle_t list_handle)
 {
        return (int)g_list_length((GList *)list_handle);
 }
+
+
+EXPORT_API int msg_calculate_text_length(msg_handle_t handle, const char* msg_text, msg_encode_type_t msg_encode_type, unsigned int *text_size, unsigned int *segment_size)
+{
+       msg_error_t err = MSG_SUCCESS;
+
+       try
+       {
+               if (msg_text == NULL || strlen(msg_text) == 0) {
+                       err = MSG_ERR_INVALID_PARAMETER;
+                       return err;
+               }
+       }
+       catch (exception& e)
+       {
+               MSG_FATAL("%s", e.what());
+               err = MSG_ERR_INVALID_PARAMETER;
+               return err;
+       }
+
+       msg_encode_type_t encodeType = MSG_ENCODE_AUTO;
+       MSG_LANGUAGE_ID_T langId = MSG_LANG_ID_RESERVED;
+
+       int decodeLen = 0;
+       int bufSize = (160*MAX_SEGMENT_NUM) + 1;
+       int textSize = 0;
+
+       textSize = strlen(msg_text);
+
+       unsigned char decodeData[bufSize];
+       memset(decodeData, 0x00, sizeof(decodeData));
+
+       MsgTextConvert textCvt;
+
+       *text_size = 0;
+       *segment_size = 0;
+
+       switch (msg_encode_type)
+       {
+       case MSG_ENCODE_GSM7BIT :
+               decodeLen = textCvt.convertUTF8ToGSM7bit(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &langId);
+               break;
+       case MSG_ENCODE_UCS2 :
+               decodeLen = textCvt.convertUTF8ToUCS2(decodeData, bufSize, (const unsigned char*)msg_text, textSize);
+               break;
+       case MSG_ENCODE_AUTO :
+               decodeLen = textCvt.convertUTF8ToAuto(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &encodeType);
+               break;
+       default :
+               err = MSG_ERR_INVALID_PARAMETER;
+               break;
+       }
+
+       // calculate segment size.
+       int headerLen = 1;
+       int concat = 5;
+       int lang = 3;
+
+       int headerSize = 0;
+       int segSize = 0;
+
+       if (langId != MSG_LANG_ID_RESERVED) {
+               MSG_DEBUG("National Language Exists");
+               headerSize += lang;
+       }
+
+       if (msg_encode_type == MSG_ENCODE_GSM7BIT || encodeType == MSG_ENCODE_GSM7BIT) {
+               MSG_DEBUG("MSG_ENCODE_GSM7BIT");
+
+               if (((decodeLen+headerSize)/160) > 1)
+                       segSize = ((140*8) - ((headerLen + concat + headerSize)*8)) / 7;
+               else
+                       segSize = 160;
+
+       } else if (msg_encode_type == MSG_ENCODE_UCS2 || encodeType == MSG_ENCODE_UCS2) {
+               MSG_DEBUG("MSG_ENCODE_UCS2");
+
+               if (((decodeLen+headerSize)/140) > 1)
+                       segSize = 140 - (headerLen + concat + headerSize);
+               else
+                       segSize = 140;
+       } else {
+               MSG_DEBUG("Unsupported encode type.");
+               err = MSG_ERR_INVALID_PARAMETER;
+               return err;
+       }
+
+       *text_size = decodeLen;
+       *segment_size = segSize;
+
+       return err;
+}
diff --git a/mms-plugin.manifest b/mms-plugin.manifest
new file mode 100755 (executable)
index 0000000..2a0cec5
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+  <request>
+    <domain name="_"/>
+  </request>
+</manifest>
diff --git a/msg-service-tools.manifest b/msg-service-tools.manifest
new file mode 100755 (executable)
index 0000000..66724ca
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+  <request>
+    <domain name="msg-service"/>
+  </request>
+</manifest>
diff --git a/msg-service.manifest b/msg-service.manifest
new file mode 100755 (executable)
index 0000000..be242d5
--- /dev/null
@@ -0,0 +1,11 @@
+<manifest>
+       <define>
+               <domain name="msg-service" policy="restricted" plist="msg-service-tools"/>
+               <provide>
+                       <label name="msg-service::db"/>
+               </provide>
+       </define>
+       <request>
+               <domain name="msg-service"/>
+       </request>
+</manifest>
diff --git a/packaging/msg-service.service b/packaging/msg-service.service
new file mode 100644 (file)
index 0000000..cd27b1b
--- /dev/null
@@ -0,0 +1,10 @@
+
+[Unit]
+Description=Start the msg-server
+
+[Service]
+ExecStart=/usr/bin/msg-server
+
+[Install]
+WantedBy=tizen-middleware.target
+
index d35a666..0004cb6 100755 (executable)
@@ -1,5 +1,5 @@
 Name:           msg-service
-Version:        0.9.0
+Version:        0.9.2
 Release:        1
 License:        Samsung
 Summary:        Messaging Framework Library
@@ -10,6 +10,8 @@ Requires(post): /usr/bin/sqlite3
 Requires(post): /usr/bin/vconftool
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
+Requires(post): systemd
+Requires(postun): systemd
 BuildRequires: cmake
 BuildRequires: pkgconfig(alarm-service)
 BuildRequires: pkgconfig(aul)
@@ -44,7 +46,7 @@ Description: Messaging Framework Library
 
 
 %package devel
-License:        Apache License v2.0
+License:        Flora License v1.0
 Summary:        Messaging Framework Library (development)
 Requires:       %{name} = %{version}-%{release}
 Group:          Development/Libraries
@@ -54,7 +56,7 @@ Description: Messaging Framework Library (development)
 
 
 %package tools
-License:        Apache License v2.0
+License:        Flora License v1.0
 Summary:        Messaging server application
 Requires:       %{name} = %{version}-%{release}
 Group:          TO_BU / FILL_IN
@@ -68,7 +70,7 @@ Description:  Messaging server application
 
 
 %package -n sms-plugin
-License:        Apache License v2.0
+License:        Flora License v1.0
 Summary:        SMS plugin library
 Requires:       %{name} = %{version}-%{release}
 Group:          System/Libraries
@@ -79,7 +81,7 @@ Requires(postun): /sbin/ldconfig
 Description: SMS plugin library
 
 %package -n mms-plugin
-License:        Apache License v2.0
+License:        Flora License v1.0
 Summary:        MMS plugin library
 Requires:       %{name} = %{version}-%{release}
 Group:          System/Libraries
@@ -98,18 +100,20 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
 make %{?jobs:-j%jobs}
 
 %install
-
 rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+
 %make_install
 
+mkdir -p %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants
+ln -s %{_libdir}/systemd/user/msg-service.service %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants/msg-service.service
+
 mkdir -p  %{buildroot}%{_sysconfdir}/rc.d/rc3.d
 ln -s %{_sysconfdir}/rc.d/init.d/msg-server  %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S70msg-server
 mkdir -p  %{buildroot}%{_sysconfdir}/rc.d/rc5.d
 ln -s %{_sysconfdir}/rc.d/init.d/msg-server  %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S70msg-server
 
-
-
-mkdir -p %{buildroot}/opt/data/msg-service
+mkdir -p %{buildroot}/opt/usr/data/msg-service
 
 %post tools -p /sbin/ldconfig
 %post -n sms-plugin -p /sbin/ldconfig
@@ -118,21 +122,24 @@ mkdir -p %{buildroot}/opt/data/msg-service
 %post
 /sbin/ldconfig
 
-if [ ! -f /opt/dbspace/.msg_service.db ]
+if [ ! -f /opt/usr/dbspace/.msg_service.db ]
 then
-    sqlite3 /opt/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST;
+    mkdir -p %{buildroot}/opt/usr/dbspace/
+    sqlite3 /opt/usr/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST;
 
     CREATE TABLE MSG_CONVERSATION_TABLE ( CONV_ID INTEGER NOT NULL , UNREAD_CNT INTEGER DEFAULT 0 , SMS_CNT INTEGER DEFAULT 0 , MMS_CNT INTEGER DEFAULT 0 , MAIN_TYPE INTEGER NOT NULL , SUB_TYPE INTEGER NOT NULL , MSG_DIRECTION INTEGER NOT NULL , DISPLAY_TIME INTEGER , DISPLAY_NAME TEXT , MSG_TEXT TEXT );
     CREATE TABLE MSG_ADDRESS_TABLE ( ADDRESS_ID INTEGER PRIMARY KEY , CONV_ID INTEGER  NOT NULL , ADDRESS_TYPE INTEGER , RECIPIENT_TYPE INTEGER , ADDRESS_VAL TEXT , CONTACT_ID INTEGER , DISPLAY_NAME TEXT , FIRST_NAME TEXT , LAST_NAME TEXT , IMAGE_PATH TEXT , SYNC_TIME DATETIME , FOREIGN KEY (CONV_ID) REFERENCES MSG_CONVERSATION_TABLE (CONV_ID) );
     CREATE TABLE MSG_FOLDER_TABLE ( FOLDER_ID INTEGER PRIMARY KEY , FOLDER_NAME TEXT NOT NULL , FOLDER_TYPE INTEGER DEFAULT 0 );
-    CREATE TABLE MSG_MESSAGE_TABLE ( MSG_ID INTEGER PRIMARY KEY , CONV_ID INTEGER NOT NULL , FOLDER_ID INTEGER NOT NULL , STORAGE_ID INTEGER NOT NULL , MAIN_TYPE INTEGER NOT NULL , SUB_TYPE INTEGER NOT NULL , DISPLAY_TIME DATETIME , DATA_SIZE INTEGER DEFAULT 0 , NETWORK_STATUS INTEGER DEFAULT 0 , READ_STATUS INTEGER DEFAULT 0 , PROTECTED INTEGER DEFAULT 0 , PRIORITY INTEGER DEFAULT 0 , MSG_DIRECTION INTEGER NOT NULL , SCHEDULED_TIME DATETIME , BACKUP INTEGER DEFAULT 0 , SUBJECT TEXT , MSG_DATA TEXT , THUMB_PATH TEXT , MSG_TEXT TEXT , DELIVERY_REPORT_STATUS INTEGER DEFAULT 0 , DELIVERY_REPORT_TIME DATETIME , READ_REPORT_STATUS INTEGER DEFAULT 0 , READ_REPORT_TIME DATETIME , ATTACHMENT_COUNT INTEGER DEFAULT 0 , FOREIGN KEY (CONV_ID) REFERENCES MSG_CONVERSATION_TABLE (CONV_ID) , FOREIGN KEY (FOLDER_ID) REFERENCES MSG_FOLDER_TABLE (FOLDER_ID) );
+    CREATE TABLE MSG_MESSAGE_TABLE ( MSG_ID INTEGER PRIMARY KEY , CONV_ID INTEGER NOT NULL , FOLDER_ID INTEGER NOT NULL , STORAGE_ID INTEGER NOT NULL , MAIN_TYPE INTEGER NOT NULL , SUB_TYPE INTEGER NOT NULL , DISPLAY_TIME DATETIME , DATA_SIZE INTEGER DEFAULT 0 , NETWORK_STATUS INTEGER DEFAULT 0 , READ_STATUS INTEGER DEFAULT 0 , PROTECTED INTEGER DEFAULT 0 , PRIORITY INTEGER DEFAULT 0 , MSG_DIRECTION INTEGER NOT NULL , SCHEDULED_TIME DATETIME , BACKUP INTEGER DEFAULT 0 , SUBJECT TEXT , MSG_DATA TEXT , THUMB_PATH TEXT , MSG_TEXT TEXT , ATTACHMENT_COUNT INTEGER DEFAULT 0 , FOREIGN KEY (CONV_ID) REFERENCES MSG_CONVERSATION_TABLE (CONV_ID) , FOREIGN KEY (FOLDER_ID) REFERENCES MSG_FOLDER_TABLE (FOLDER_ID) );
     CREATE TABLE MSG_SIM_TABLE ( MSG_ID INTEGER , SIM_ID INTEGER NOT NULL , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
     CREATE TABLE MSG_PUSH_TABLE ( MSG_ID INTEGER , ACTION INTEGER , CREATED INTEGER , EXPIRES INTEGER , ID TEXT , HREF TEXT , CONTENT TEXT , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
     CREATE TABLE MSG_CBMSG_TABLE ( MSG_ID INTEGER , CB_MSG_ID INTEGER NOT NULL , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
     CREATE TABLE MSG_SYNCML_TABLE ( MSG_ID INTEGER , EXT_ID INTEGER NOT NULL , PINCODE INTEGER NOT NULL , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
     CREATE TABLE MSG_SMS_SENDOPT_TABLE ( MSG_ID INTEGER , DELREP_REQ INTEGER NOT NULL , KEEP_COPY INTEGER NOT NULL , REPLY_PATH INTEGER NOT NULL , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
-    CREATE TABLE MSG_FILTER_TABLE ( FILTER_ID INTEGER PRIMARY KEY , FILTER_TYPE INTEGER NOT NULL , FILTER_VALUE TEXT NOT NULL );
+    CREATE TABLE MSG_FILTER_TABLE ( FILTER_ID INTEGER PRIMARY KEY , FILTER_TYPE INTEGER NOT NULL , FILTER_VALUE TEXT NOT NULL , FILTER_ACTIVE INTEGER DEFAULT 0);
     CREATE TABLE MSG_MMS_MESSAGE_TABLE ( MSG_ID INTEGER , TRANSACTION_ID TEXT , MESSAGE_ID TEXT , FWD_MESSAGE_ID TEXT , CONTENTS_LOCATION TEXT , FILE_PATH TEXT , VERSION INTEGER NOT NULL , DATA_TYPE INTEGER DEFAULT -1 , DATE DATETIME , HIDE_ADDRESS INTEGER DEFAULT 0 , ASK_DELIVERY_REPORT INTEGER DEFAULT 0 , REPORT_ALLOWED INTEGER DEFAULT 0 , READ_REPORT_ALLOWED_TYPE INTEGER DEFAULT 0 , ASK_READ_REPLY INTEGER DEFAULT 0 , READ INTEGER DEFAULT 0 , READ_REPORT_SEND_STATUS INTEGER DEFAULT 0 , READ_REPORT_SENT INTEGER DEFAULT 0 , PRIORITY INTEGER DEFAULT 0 , KEEP_COPY INTEGER DEFAULT 0 , MSG_SIZE INTEGER NOT NULL , MSG_CLASS INTEGER DEFAULT -1 , EXPIRY_TIME DATETIME , CUSTOM_DELIVERY_TIME INTEGER DEFAULT 0 , DELIVERY_TIME DATETIME , MSG_STATUS INTEGER DEFAULT -1 , FOREIGN KEY (MSG_ID) REFERENCES MSG_MESSAGE_TABLE (MSG_ID) );
+    CREATE TABLE MSG_MMS_PREVIEW_INFO_TABLE ( MSG_ID INTEGER, TYPE INTEGER, VALUE TEXT, COUNT INTEGER, PRIMARY KEY (MSG_ID, TYPE)  ON CONFLICT REPLACE FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) ON DELETE CASCADE);
+    CREATE TABLE MSG_REPORT_TABLE ( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME);
     CREATE TABLE MSG_PUSHCFG_TABLE ( PUSH_ID INTEGER , CONTENT_TYPE TEXT, APP_ID TEXT, PKG_NAME TEXT, LAUNCH INTEGER, APPCODE INTEGER, SECURE INTEGER);
 
     CREATE INDEX MSG_CONVERSATION_INDEX ON MSG_CONVERSATION_TABLE(CONV_ID);
@@ -191,17 +198,16 @@ then
        INSERT INTO MSG_PUSHCFG_TABLE VALUES (35, 'application/vnd.wap.emn+wbxml', 'X-oma-docomo:xmd.mail.ua', '', 0, 45, 1);"
 fi
 
-chown :6011 /opt/dbspace/.msg_service.db
-chown :6011 /opt/dbspace/.msg_service.db-journal
-
-
-chmod 660 /opt/dbspace/.msg_service.db
-chmod 660 /opt/dbspace/.msg_service.db-journal
-
+chown :6011 /opt/usr/dbspace/.msg_service.db
+chown :6011 /opt/usr/dbspace/.msg_service.db-journal
+chmod 660 /opt/usr/dbspace/.msg_service.db
+chmod 660 /opt/usr/dbspace/.msg_service.db-journal
+mkdir -p /opt/usr/data/msg-service
+chgrp db_msg_service /opt/usr/data/msg-service
 
 ########## Setting Config Value (Internal keys) ##########
 # Message Server Status
-vconftool set -t bool memory/msg/ready 0 -i
+vconftool set -t bool memory/msg/ready 0 -i -g 5000
 
 # SMS Send Options
 vconftool set -t int db/msg/network_mode 2
@@ -214,7 +220,7 @@ vconftool set -t int db/msg/recv_mms 0
 # General Options
 vconftool set -t bool db/private/msg-service/general/keep_copy 1
 vconftool set -t bool db/private/msg-service/general/auto_erase 0
-vconftool set -t bool db/private/msg-service/general/block_msg 0
+vconftool set -t bool db/private/msg-service/general/block_msg 1
 vconftool set -t int db/private/msg-service/general/contact_sync_time 0
 
 # SMS Send Options
@@ -312,7 +318,8 @@ vconftool set -t bool db/private/msg-service/cb_msg/language/8 0
 vconftool set -t bool db/private/msg-service/cb_msg/language/9 0
 
 # Voice Mail Options
-vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number ""
+vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number "5500" -f
+vconftool set -t int db/private/msg-service/voice_mail/voice_mail_count 0
 
 # MMS Size Options
 vconftool set -t int db/private/msg-service/size_opt/msg_size 300
@@ -326,6 +333,12 @@ vconftool set -t int memory/private/msg-service/sim_changed 0 -i
 vconftool set -t string memory/private/msg-service/sim_imsi "" -i
 vconftool set -t bool memory/private/msg-service/national_sim 0 -i
 
+/sbin/ldconfig
+/bin/systemctl daemon-reload
+if [ "$1" = "1" ]; then
+    systemctl stop msg-service.service
+fi
+
 %postun -p /sbin/ldconfig
 
 %postun tools -p /sbin/ldconfig
@@ -333,17 +346,16 @@ vconftool set -t bool memory/private/msg-service/national_sim 0 -i
 %postun -n mms-plugin -p /sbin/ldconfig
 
 %files
+%manifest msg-service.manifest
 %defattr(-,root,root,-)
-%dir /opt/data/msg-service
+%dir %attr(775,root,db_msg_service) /opt/usr/data/msg-service
 %{_libdir}/libmsg_plugin_manager.so
 %{_libdir}/libmsg_mapi.so.*
 %{_libdir}/libmsg_framework_handler.so
 %{_libdir}/libmsg_transaction_manager.so
 %{_libdir}/libmsg_utils.so
 %{_libdir}/libmsg_transaction_proxy.so
-%{_sysconfdir}/rc.d/init.d/msg-server
-%{_sysconfdir}/rc.d/rc3.d/S70msg-server
-%{_sysconfdir}/rc.d/rc5.d/S70msg-server
+/usr/share/license/msg-service/LICENSE
 
 %files devel
 %defattr(-,root,root,-)
@@ -352,22 +364,36 @@ vconftool set -t bool memory/private/msg-service/national_sim 0 -i
 %{_includedir}/msg-service/*
 
 %files tools
+%manifest msg-service-tools.manifest
 %defattr(-,root,root,-)
 %{_bindir}/msg-helper
 %{_bindir}/msg-server
 %{_datadir}/media/Sherbet.wav
 %attr(0644,root,root)/usr/share/msg-service/plugin.cfg
+%{_sysconfdir}/rc.d/init.d/msg-server
+%{_sysconfdir}/rc.d/rc3.d/S70msg-server
+%{_sysconfdir}/rc.d/rc5.d/S70msg-server
+%{_libdir}/systemd/user/msg-service.service
+%{_libdir}/systemd/user/tizen-middleware.target.wants/msg-service.service
+/usr/share/license/msg-service/LICENSE
 
 %files -n sms-plugin
+%manifest sms-plugin.manifest
 %defattr(-,root,root,-)
 %{_libdir}/libmsg_sms_plugin.so
+/usr/share/license/msg-service/LICENSE
 
 %files -n mms-plugin
+%manifest mms-plugin.manifest
 %defattr(-,root,root,-)
 %{_libdir}/libmsg_mms_plugin.so
 %{_libdir}/libmsg_mms_language_pack.so
+/usr/share/license/msg-service/LICENSE
 
 %changelog
+* Wed Oct 25 2012 Sangkoo Kim <sangkoo.kim@samsung.com>
+- New release version
+
 * Wed Aug 8 2012 KeeBum Kim <keebum.kim@samsung.com>
 - Apply New TAPI.
 - Modify transaction data size of sos recipient list.
index 1a34a55..9e2d2dc 100755 (executable)
@@ -23,7 +23,7 @@
 #define                MAX_ASCII                       256
 #define                MAX_ASCII_NUM           255
 
-static void     __WmLngReverseKeyCode(UCHAR *pOutStr, MCHAR *pInputStr, UINT len);
+//static void   __WmLngReverseKeyCode(UCHAR *pOutStr, MCHAR *pInputStr, UINT len);
 static UINT     __WmLngLatin12UnicodeN(MCHAR *pOutStr, UCHAR *pInputStr, UINT len);
 static int      __WmLngConvertLatin12Unicode (MCHAR *des, UCHAR *str, UINT len);
 
@@ -1055,6 +1055,7 @@ bool WmConvertLatinCode2PCodeN(MCHAR *pmszOutText, int outBufSize, char *szInTex
  *
  * @see
  */
+/* Unused....
 static void __WmLngReverseKeyCode(UCHAR *pOutStr, MCHAR *pInputStr, UINT len)
 {
        UCHAR *rear=NULL;
@@ -1083,7 +1084,7 @@ static void __WmLngReverseKeyCode(UCHAR *pOutStr, MCHAR *pInputStr, UINT len)
                pInputStr = p;
        }
 }
-
+*/
 
 /*
  * This function convert character Localcode(Latin1) to Processcode(Unicode)
index b372ecf..4d9cbb6 100755 (executable)
@@ -22,7 +22,7 @@
 #include "MmsPluginMIME.h"
 #include "MmsPluginMessage.h"
 #include "MmsPluginWmLngPack.h"
-
+#include "MmsPluginUtil.h"
 const int MSG_MAX_CH_PER_LINE = 75;
 
 /* ==================================================================
index c27fd33..7b56160 100755 (executable)
@@ -545,821 +545,3 @@ const char *MmsDebugGetDataType(MmsDataType dataType)
                return MmsDebugPrintUnknownValue(dataType);
        }
 }
-
-#ifdef MMS_PLUGIN_DEBUG_ENABLE
-bool
-MmsDebugPrintMsgAttributes(char *pszFunc, MmsAttrib *pAttrib, bool bAll)
-{
-       SysRequireEx(pAttrib != NULL, false);
-
-       if (pszFunc)
-               SysDebug((MID_MMS|DBG_MMS_COMMON,"%s ========= \n", pszFunc));
-
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "szSubject = %s \n", pAttrib->szSubject));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "contentType=%s \n", MmsDebugGetMimeType(pAttrib->contentType)));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "dataType=%s \n", MmsDebugGetDataType(pAttrib->dataType)));
-
-       if (pAttrib->specialMsgType != MMS_SPECIAL_MSG_TYPE_NONE)
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "spcialMsgType = %lu \n", pAttrib->specialMsgType));
-
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "date=%lu, msgSize=%lu, bRead=%lu\n", pAttrib->date, pAttrib->msgSize, pAttrib->bRead));
-
-       if (!bAll)
-               return true;
-
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "msgClass=%s, priority=%lu \n", MmsDebugGetMsgClass(pAttrib->msgClass), pAttrib->priority ));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "deliveryTime.type = %lu, time = %lu\n", pAttrib->deliveryTime.type, pAttrib->deliveryTime.time));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "expiryTime.type = %lu, time = %lu\n", pAttrib->expiryTime.type, pAttrib->expiryTime.time));
-
-       if (pAttrib->szTo && pAttrib->szTo[0] != 0)
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "szTo = %s \n", pAttrib->szTo));
-       if (pAttrib->szCc && pAttrib->szCc[0] != 0)
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "szCc = %s \n", pAttrib->szCc));
-       if (pAttrib->szBcc && pAttrib->szBcc[0] != 0)
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "szBcc = %s \n", pAttrib->szBcc));
-
-#if defined(_MMS_SUPPORT_RECEIVING_OPTION_PROMPT)
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "readReportAllowedType = %lu \n", pAttrib->readReportAllowedType));
-#endif
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "bAskDeliveryReport=%lu, bReportAllowed=%lu, bAskReadReply=%lu, bLeaveCopy=%lu \n",
-                       pAttrib->bAskDeliveryReport, pAttrib->bReportAllowed, pAttrib->bAskReadReply, pAttrib->bLeaveCopy));
-
-       if (pAttrib->bHideAddress)
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "bHideAddress=true\n"));
-
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "msgStatus = %s \n", MmsDebugGetMsgStatus(pAttrib->msgStatus)));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "responseStatus = %s \n", MmsDebugGetResponseStatus(pAttrib->responseStatus)));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "retrieveStatus = %s \n", MmsDebugGetRetrieveStatus(pAttrib->retrieveStatus)));
-
-       if (pAttrib->szResponseText && pAttrib->szResponseText[0] != 0)
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "szResponseText = %s \n", pAttrib->szResponseText));
-
-       if (pAttrib->szRetrieveText && pAttrib->szRetrieveText[0] != 0)
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "szRetrieveText = %s \n", pAttrib->szRetrieveText));
-
-       return true;
-}
-
-char *MmsDebugGetMsgDrmType(MsgDrmType drmType)
-{
-       switch (drmType) {
-       case MSG_DRM_TYPE_NONE:
-               return "MSG_DRM_TYPE_NONE";
-       case MSG_DRM_TYPE_FL:
-               return "MSG_DRM_TYPE_FL";
-       case MSG_DRM_TYPE_CD:
-               return "MSG_DRM_TYPE_CD";
-       case MSG_DRM_TYPE_SD:
-               return "MSG_DRM_TYPE_SD";
-       case MSG_DRM_TYPE_SSD:
-               return "MSG_DRM_TYPE_SSD";
-       }
-
-       return MmsDebugPrintUnknownValue(drmType);
-}
-
-char *MmsDebugGetDrmDeliveryMode(DrmDeliveryMode deliveryMode)
-{
-       switch (deliveryMode) {
-       case DRM_DELIVERYMODE_FORWARD_LOCK:
-               return "DRM_DELIVERYMODE_FORWARD_LOCK";
-       case DRM_DELIVERYMODE_COMBINED_DELIVERY:
-               return "DRM_DELIVERYMODE_COMBINED_DELIVERY";
-       case DRM_DELIVERYMODE_SEPARATE_DELIVERY:
-               return "DRM_DELIVERYMODE_SEPARATE_DELIVERY";
-       case DRM_DELIVERYMODE_SPECIAL_SEPARATE:
-               return "DRM_DELIVERYMODE_SPECIAL_SEPARATE";
-       }
-
-       return MmsDebugPrintUnknownValue(deliveryMode);
-}
-
-char *MmsDebugGetDrmRightState(DrmRightState rightState)
-{
-       switch (rightState) {
-       case DRMRIGHT_STATE_NORIGHTS:
-               return "DRMRIGHT_STATE_NORIGHTS";
-       case DRMRIGHT_STATE_INVALID_RIGHTS:
-               return "DRMRIGHT_STATE_INVALID_RIGHTS";
-       case DRMRIGHT_STATE_VALID_RIGHTS:
-               return "DRMRIGHT_STATE_VALID_RIGHTS";
-       case DRMRIGHT_STATE_EXPIRED_RIGHTS:
-               return "DRMRIGHT_STATE_EXPIRED_RIGHTS";
-       }
-
-       return MmsDebugPrintUnknownValue(rightState);
-}
-
-
-bool MmsDebugPrintDrmRight(DrmRight *pDrmRight)
-{
-       if (!pDrmRight)
-               return true;
-
-       if (pDrmRight->rightStatus == DRMRIGHT_STATE_NORIGHTS) {
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "rightStatus = %s \n", MmsDebugGetDrmRightState(pDrmRight->rightStatus)));
-               return true;
-       }
-
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "iDeliveryType = %s \n", MmsDebugGetDrmDeliveryMode(pDrmRight->iDeliveryType)));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "bestConstraint = %s \n", MmsDebugGetDrmConsumeMode(pDrmRight->bestConstraint)));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "bFirstIntervalRender = %d \n", pDrmRight->bFirstIntervalRender));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "rightStatus = %s \n", MmsDebugGetDrmRightState(pDrmRight->rightStatus)));
-
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "bValidIssuer = %d \n", pDrmRight->bValidIssuer));
-
-       return true;
-}
-
-char *MmsDebugPrintMsgDRMStatus(MsgDRMStatus status)
-{
-       switch (status) {
-       case MSG_DRM_STATUS_INVALID:
-               return "MSG_DRM_STATUS_INVALID";
-       case MSG_DRM_STATUS_VALID:
-               return "MSG_DRM_STATUS_VALID";
-       case MSG_DRM_STATUS_EXPIRED:
-               return "MSG_DRM_STATUS_EXPIRED";
-       }
-
-       return MmsDebugPrintUnknownValue(status);
-}
-
-
-bool MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index)
-{
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "------------------------------\n"));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "%dth multipart info\n", index));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "header size=%d\n", pMultipart->type.size));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "body size=%d\n", pMultipart->type.contentSize));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "content type=%s\n", MmsDebugGetMimeType(pMultipart->type.type)));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "content ID=%s\n", pMultipart->type.szContentID));
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "content location=%s\n", pMultipart->type.szContentLocation));
-
-       if (pMultipart->type.type == MIME_TEXT_PLAIN) {
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "text info\n"));
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "charset=%d\n", pMultipart->type.param.charset));
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "text file name=%s\n", pMultipart->type.param.szName));
-       }
-
-       if (pMultipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) {
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "drm info\n"));
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "drm type=%s\n", MmsDebugGetMsgDrmType(pMultipart->type.drmInfo.drmType)));
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "drm content type=%s\n", MmsDebugGetMimeType(pMultipart->type.drmInfo.contentType)));
-               SysDebug((MID_MMS|DBG_MMS_COMMON, "drm content URI=%s\n", pMultipart->type.drmInfo.szContentURI));
-       }
-       SysDebug((MID_MMS|DBG_MMS_COMMON, "------------------------------\n"));
-       return true;
-}
-
-
-bool MmsDebugPrintCurrentEventHandler(char *pszFunc, MmsDebugEvType evType)
-{
-       HEventHandler hMmsEH;
-       HEventHandler hSmsEH;
-       HEventHandler hEmailEH;
-       HEventHandler hCommonEH;
-       HEventHandler hCurrentEH;
-
-       hMmsEH          = WmGetEventHandlerByName(EHN_MMS);
-       hSmsEH          = WmGetEventHandlerByName(EHN_SMS);
-       hEmailEH        = WmGetEventHandlerByName(EHN_EMAIL);
-       hCommonEH       = WmGetEventHandlerByName(EHN_MESSENGER);
-       hCurrentEH      = WmGetCurrentEventHandler();
-
-       switch (evType) {
-       case MMS_DEBUG_EV_MMS:
-               SysRequireExf(hCurrentEH == hMmsEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n",     \
-                                                       pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH));
-               break;
-
-       case MMS_DEBUG_EV_SMS:
-               SysRequireExf(hCurrentEH == hSmsEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n",     \
-                                                       pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH));
-               break;
-
-       case MMS_DEBUG_EV_COMMON:
-               SysRequireExf(hCurrentEH == hCommonEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n",  \
-                                                       pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH));
-               break;
-
-       case MMS_DEBUG_EV_EMAIL:
-               SysRequireExf(hCurrentEH == hEmailEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n",   \
-                                                       pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH));
-               break;
-
-       case MMS_DEBUG_EV_NONE:
-       default:
-               SysDebug((MID_MMS,"%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n",       \
-                                                       pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH));
-               break;
-       }
-       return true;
-}
-
-
-char *DebugPrintGetRmResultInd(MmsRmResultInd indType)
-{
-       switch (indType) {
-       case RM_RESULTIND_NONE:
-               return "RM_RESULTIND_NONE";
-
-       case RM_RESULTIND_MANUAL_SEND:
-               return "RM_RESULTIND_MANUAL_SEND";
-
-       case RM_RESULTIND_AUTO_SEND:
-               return "RM_RESULTIND_AUTO_SEND";
-
-       case RM_RESULTIND_MANUAL_GET:
-               return "RM_RESULTIND_MANUAL_GET";
-
-       case RM_RESULTIND_AUTO_GET:
-               return "RM_RESULTIND_AUTO_GET";
-
-       case RM_RESULTIND_MANUAL_FORWARD:
-               return "RM_RESULTIND_MANUAL_FORWARD";
-       }
-
-       return MmsDebugPrintUnknownValue(indType);
-}
-
-
-char *DebugPrintHttpStatusCode(int status)
-{
-       switch (status) {
-       case HTTP_STATUS_100:
-               return "HTTP_STATUS_100";
-       case HTTP_STATUS_101:
-               return "HTTP_STATUS_101";
-
-       case HTTP_STATUS_200:
-               return "HTTP_STATUS_200";
-       case HTTP_STATUS_201:
-               return "HTTP_STATUS_201";
-       case HTTP_STATUS_202:
-               return "HTTP_STATUS_202";
-       case HTTP_STATUS_203:
-               return "HTTP_STATUS_203";
-       case HTTP_STATUS_204:
-               return "HTTP_STATUS_204";
-       case HTTP_STATUS_205:
-               return "HTTP_STATUS_205";
-       case HTTP_STATUS_206:
-               return "HTTP_STATUS_206";
-
-       case HTTP_STATUS_300:
-               return "HTTP_STATUS_300";
-       case HTTP_STATUS_301:
-               return "HTTP_STATUS_301";
-       case HTTP_STATUS_302:
-               return "HTTP_STATUS_302";
-       case HTTP_STATUS_303:
-               return "HTTP_STATUS_303";
-       case HTTP_STATUS_304:
-               return "HTTP_STATUS_304";
-       case HTTP_STATUS_305:
-               return "HTTP_STATUS_305";
-
-       case HTTP_STATUS_400:
-               return "HTTP_STATUS_400";
-       case HTTP_STATUS_401:
-               return "HTTP_STATUS_401";
-       case HTTP_STATUS_402:
-               return "HTTP_STATUS_402";
-       case HTTP_STATUS_403:
-               return "HTTP_STATUS_403";
-       case HTTP_STATUS_404:
-               return "HTTP_STATUS_404";
-       case HTTP_STATUS_405:
-               return "HTTP_STATUS_405";
-       case HTTP_STATUS_406:
-               return "HTTP_STATUS_406";
-       case HTTP_STATUS_407:
-               return "HTTP_STATUS_407";
-       case HTTP_STATUS_408:
-               return "HTTP_STATUS_408";
-       case HTTP_STATUS_409:
-               return "HTTP_STATUS_409";
-       case HTTP_STATUS_410:
-               return "HTTP_STATUS_410";
-       case HTTP_STATUS_411:
-               return "HTTP_STATUS_411";
-       case HTTP_STATUS_412:
-               return "HTTP_STATUS_412";
-       case HTTP_STATUS_413:
-               return "HTTP_STATUS_413";
-       case HTTP_STATUS_414:
-               return "HTTP_STATUS_414";
-       case HTTP_STATUS_415:
-               return "HTTP_STATUS_415";
-
-       case HTTP_STATUS_500:
-               return "HTTP_STATUS_500";
-       case HTTP_STATUS_501:
-               return "HTTP_STATUS_501";
-       case HTTP_STATUS_502:
-               return "HTTP_STATUS_502";
-       case HTTP_STATUS_503:
-               return "HTTP_STATUS_503";
-       case HTTP_STATUS_504:
-               return "HTTP_STATUS_504";
-       case HTTP_STATUS_505:
-               return "HTTP_STATUS_505";
-
-       case REASON_WTP_UNKNOWN:
-               return "REASON_WTP_UNKNOWN";
-       case REASON_WTP_PROTO_ERR:
-               return "REASON_WTP_PROTO_ERR";
-       case REASON_WTP_INVALID_TID:
-               return "REASON_WTP_INVALID_TID";
-       case REASON_WTP_NOT_IMPLEMENTED_CL2:
-               return "REASON_WTP_NOT_IMPLEMENTED_CL2";
-       case REASON_WTP_NOT_IMPLEMENTED_SAR:
-               return "REASON_WTP_NOT_IMPLEMENTED_SAR";
-       case REASON_WTP_NOT_IMPLEMENTEDU_ACK:
-               return "REASON_WTP_NOT_IMPLEMENTEDU_ACK";
-       case REASON_WTP_VERSIONONE:
-               return "REASON_WTP_VERSIONONE";
-       case REASON_WTP_CAPTEMP_EXCEED:
-               return "REASON_WTP_CAPTEMP_EXCEED";
-       case REASON_WTP_NO_RESPONSE:
-               return "REASON_WTP_NO_RESPONSE";
-       case REASON_WTP_MESSAGE_TOO_LARGE:
-               return "REASON_WTP_MESSAGE_TOO_LARGE";
-
-       case REASON_PROTOERR:
-               return "REASON_PROTOERR";       //  = 0xE0
-       case REASON_DISCONNECT:
-               return "REASON_DISCONNECT";
-       case REASON_SUSPEND:
-               return "REASON_SUSPEND";
-       case REASON_RESUME:
-               return "REASON_RESUME";
-       case REASON_CONGESTION:
-               return "REASON_CONGESTION";
-       case REASON_CONNECTERR:
-               return "REASON_CONNECTERR";
-       case REASON_MRUEXCEEDED:
-               return "REASON_MRUEXCEEDED";
-       case REASON_MOREXCEEDED:
-               return "REASON_MOREXCEEDED";
-       case REASON_PEERREQ:
-               return "REASON_PEERREQ";
-       case REASON_NETERR:
-               return "REASON_NETERR";
-       case REASON_USERREQ:
-               return "REASON_USERREQ";
-       /* added for ver 1.2 */
-       case REASON_USERRFS:
-               return "REASON_USERRFS";
-       case REASON_PND:
-               return "REASON_PND";
-       case REASON_USERDCR:
-               return "REASON_USERDCR";
-       case REASON_USERDCU:
-               return "REASON_USERDCU";
-       }
-
-       return MmsDebugPrintUnknownValue(status);
-}
-
-
-char *DebugPrintRmMethodType(MmsRmMethodType method)
-{
-       switch (method) {
-       case RM_METHOD_NONE:
-               return "RM_METHOD_NONE";
-       case RM_METHOD_GET:
-               return "RM_METHOD_GET";
-       case RM_METHOD_POST:
-               return "RM_METHOD_POST";
-       }
-
-       return MmsDebugPrintUnknownValue(method);
-}
-
-
-char *DebugPrintGetMmsRmNetState(MmsRmNetState state)
-{
-       switch (state) {
-       case RM_PROTO_IDLE:
-               return "RM_PROTO_IDLE";
-       case RM_PROTO_STARTING:
-               return "RM_PROTO_STARTING";
-       case RM_PROTO_STARTED:
-               return "RM_PROTO_STARTED";
-       case RM_PROTO_STOPPING:
-               return "RM_PROTO_STOPPING";
-
-       case RM_PROTO_WAITING:
-               return "RM_PROTO_WAITING";
-       case RM_PROTO_DISCONNECTING_OTHER_APP:
-               return "RM_PROTO_DISCONNECTING_OTHER_APP";
-       case RM_PROTO_DISCONNECTED_BY_OTHER_APP:
-               return "RM_PROTO_DISCONNECTED_BY_OTHER_APP";
-
-       case RM_PROTO_FAILED:
-               return "RM_PROTO_FAILED";
-       }
-
-       return MmsDebugPrintUnknownValue(state);
-}
-
-
-char *DebugPrintGetMmsRmEntityState(MmsRmExEntityState stateEx)
-{
-       switch (stateEx) {
-       case RM_ENTITY_IDLE:
-               return "RM_ENTITY_IDLE";
-       case RM_ENTITY_PROTO_STARTING:
-               return "RM_ENTITY_PROTO_STARTING";
-
-       case RM_ENTITY_CNXN_ESTABLISHING:
-               return "RM_ENTITY_CNXN_ESTABLISHING";
-       case RM_ENTITY_CNXN_ESTABLISHED:
-               return "RM_ENTITY_CNXN_ESTABLISHED";
-
-       case RM_ENTITY_SENDING_REQUEST:
-               return "RM_ENTITY_SENDING_REQUEST";
-       case RM_ENTITY_SENDING_REQ_N_NO_RESPONSE:
-               return "RM_ENTITY_SENDING_REQ_N_NO_RESPONSE";
-
-       case RM_ENTITY_SENDING_REQ_COMPLETED:
-               return "RM_ENTITY_SENDING_REQ_COMPLETED";
-
-       case RM_ENTITY_SENDING_REQ_FAILED:
-               return "RM_ENTITY_SENDING_REQ_FAILED";
-       case RM_ENTITY_SENDING_REQ_CANCELLED_BY_USER_CONFIRMED:
-               return "RM_ENTITY_SENDING_REQ_CANCELLED_BY_USER_CONFIRMED";
-       }
-
-       return MmsDebugPrintUnknownValue(stateEx);
-}
-
-
-char *MmsDebugPrintMmsRmResult(MmsRmResult result)
-{
-       switch (result) {
-       case MMS_RM_RESULT_SUCCESSED:
-               return "MMS_RM_RESULT_SUCCESSED";
-       case MMS_RM_RESULT_FAIL:
-               return "MMS_RM_RESULT_FAIL";
-       case MMS_RM_RESULT_FAIL_N_RETRY:
-               return "MMS_RM_RESULT_FAIL_N_RETRY";
-
-       case MMS_RM_RESULT_PROTO_STARTING_FAILED:
-               return "MMS_RM_RESULT_PROTO_STARTING_FAILED";
-
-       case MMS_RM_RESULT_DISCONNECT_MMS:
-               return "MMS_RM_RESULT_DISCONNECT_MMS";
-       case MMS_RM_RESULT_CLOSING_OTHER_APP_FAILED:
-               return "MMS_RM_RESULT_CLOSING_OTHER_APP_FAILED";
-
-       case MMS_RM_RESULT_SENDING_REQ_FAILED:
-               return "MMS_RM_RESULT_SENDING_REQ_FAILED";
-       case MMS_RM_RESULT_CANCELED_BY_USER:
-               return "MMS_RM_RESULT_CANCELED_BY_USER";
-       case MMS_RM_RESULT_CANCELED_FROM_RETRY_POPUP:
-               return "MMS_RM_RESULT_CANCELED_FROM_RETRY_POPUP";
-
-       case MMS_RM_RESULT_PROTO_FAILED:
-               return "MMS_RM_RESULT_PROTO_FAILED";
-       case MMS_RM_RESULT_DISCONNECTED_BY_OTHER:
-               return "MMS_RM_RESULT_DISCONNECTED_BY_OTHER";
-
-       case MMS_RM_RESULT_MEMORY_FULL:
-               return "MMS_RM_RESULT_MEMORY_FULL";
-       }
-
-       return MmsDebugPrintUnknownValue(result);
-}
-
-void MmsDebugPrintReqEntityInfo(MmsRmRequest *pEntity)
-{
-       SysDebug((MID_MMS,"     - proto state=%s\n", DebugPrintGetMmsRmNetState(_MmsRmNetGetState())));
-
-       if (_MmsRmNetGetProtoType() == MMS_RM_WAP_CONNORIENTED || _MmsRmNetGetProtoType() == MMS_RM_WTLS) {
-               SysDebug((MID_MMS,"     - wap cnxn state=%s\n", DebugPrintWspState(MmsRmWspGetCnxnState())));
-       }
-
-       if (!pEntity) {
-               SysDebug((MID_EXCEPTION, "MmsDebugPrintReqEntityInfo : pEntity is NULL. \n"));
-               return;
-       }
-
-       SysDebug((MID_MMS,"     - entity state=%s\n", DebugPrintGetMmsRmEntityState(pEntity->stateEx)));
-
-       if (pEntity->cb.result.bSend) {
-               if (pEntity->pduType == MMS_RM_READ_REPORT_V10) {
-                       SysDebug((MID_MMS,"     - sending read report v10\n"));
-               } else if (pEntity->pduType == MMS_RM_READ_REPORT_V11) {
-                       SysDebug((MID_MMS,"     - sending read report v11\n"));
-               } else {
-                       SysDebug((MID_MMS,"     - sending msg\n"));
-               }
-       } else {        // then receiving..
-               if (pEntity->cb.result.bAutoRetrieving) {
-                       SysDebug((MID_MMS,"     - retrieving(auto)\n"));
-               } else {
-                       SysDebug((MID_MMS,"     - retrieving(manual)\n"));
-               }
-       }
-
-       SysDebug((MID_MMS,"     - msgID=%d, trID=0x%x, pduType=%s\n", pEntity->msgID, pEntity->trId, MmsDebugPrintRmPduType(pEntity->pduType)));
-
-       if (pEntity->protoActvCount > 1) {
-               SysDebug((MID_MMS,"     - protoActvCount=%d\n", pEntity->protoActvCount));
-       }
-
-       if (pEntity->reqCount > 1) {
-               SysDebug((MID_MMS,"     - reqCount=%d\n", pEntity->reqCount));
-       }
-
-       if (pEntity->fullRetryCount > 1) {
-               SysDebug((MID_MMS,"     - fullRetryCount=%d\n", pEntity->fullRetryCount));
-       }
-}
-
-char *MmsDebugPrintHttpErrorCode(int errCode)
-{
-       switch (errCode) {
-       case HTTPERR_INVALID_PARAM:
-               return "HTTPERR_INVALID_PARAM";
-       case HTTPERR_UNKNOWN:
-               return "HTTPERR_UNKNOWN";
-       case HTTPERR_INVALID_PROXY:
-               return "HTTPERR_INVALID_PROXY";
-       case HTTPERR_OUT_OF_MEMORY:
-               return "HTTPERR_OUT_OF_MEMORY";
-       case HTTPERR_NO_RESPONSE:
-               return "HTTPERR_NO_RESPONSE";
-       case HTTPERR_INIT:
-               return "HTTPERR_INIT";
-       case HTTPERR_NETDOWN:
-               return "HTTPERR_NETDOWN";
-       case HTTPERR_TIMEOUT:
-               return "HTTPERR_TIMEOUT";
-       case HTTPERR_HOST_UNREACH:
-               return "HTTPERR_HOST_UNREACH";
-       case HTTPERR_CONN_RESET:
-               return "HTTPERR_CONN_RESET";
-       case HTTPERR_INTERNAL:
-               return "HTTPERR_INTERNAL";
-       case HTTPERR_CHUNKEDTR:
-               return "HTTPERR_CHUNKEDTR";
-       case HTTPERR_USER:
-               return "HTTPERR_USER";
-       case HTTPERR_TOO_BIG:
-               return "HTTPERR_TOO_BIG";
-       case HTTPERR_NOT_SUPPORTED_SVC:
-               return "HTTPERR_NOT_SUPPORTED_SVC";
-       case HTTPERR_NO_CONTENT:
-               return "HTTPERR_NO_CONTENT";
-       case HTTPERR_WRITEFAIL:
-               return "HTTPERR_WRITEFAIL";
-       case HTTPERR_AUTHFAIL:
-               return "HTTPERR_AUTHFAIL";
-
-       case HTTPERR_DNSFAIL:
-               return "HTTPERR_DNSFAIL";
-       case HTTPERR_UAGENT_NOT_ALLOWED:
-               return "HTTPERR_UAGENT_NOT_ALLOWED";
-
-       }
-       return MmsDebugPrintUnknownValue(errCode);
-}
-
-char *MmsDebugPrintProtoErrorCode(int errCode)
-{
-       switch (errCode) {
-       case PROTO_ERROR_NONE:
-               return "PROTO_ERROR_NONE";
-       /* Wireless stack errors */
-       case PROTO_ERROR_NO_SERVICE:
-               return "PROTO_ERROR_NO_SERVICE";
-       case PROTO_ERROR_INVALID_PARAM:
-               return "PROTO_ERROR_INVALID_PARAM";
-       case PROTO_ERROR_INVALID_APN:
-               return "PROTO_ERROR_INVALID_APN";
-       case PROTO_ERROR_INVALID_OP_MODE:
-               return "PROTO_ERROR_INVALID_OP_MODE";
-       case PROTO_ERROR_INVALID_PROTO_TYPE:
-               return "PROTO_ERROR_INVALID_PROTO_TYPE";
-       case PROTO_ERROR_INVALID_SERVICE_DOMAIN:
-               return "PROTO_ERROR_INVALID_SERVICE_DOMAIN";
-       case PROTO_ERROR_INVALID_PDP_DATA:
-               return "PROTO_ERROR_INVALID_PDP_DATA";
-       case PROTO_ERROR_INVALID_QOS:
-               return "PROTO_ERROR_INVALID_QOS";
-       case PROTO_ERROR_SESSION_DEACTIVATED:
-               return "PROTO_ERROR_SESSION_DEACTIVATED";
-       case PROTO_ERROR_AUTHENTICATION_FAILED:
-               return "PROTO_ERROR_AUTHENTICATION_FAILED";
-       case PROTO_ERROR_MOBILE_FAILURE:
-               return "PROTO_ERROR_MOBILE_FAILURE";
-       case PROTO_ERROR_NETWORK_FAILURE:
-               return "PROTO_ERROR_NETWORK_FAILURE";
-       case PROTO_ERROR_TIMEOUT:
-               return "PROTO_ERROR_TIMEOUT";
-       case PROTO_ERROR_NO_RESOURCE:
-               return "PROTO_ERROR_NO_RESOURCE";
-       case PROTO_ERROR_INVALID_CONTEXT_ID:
-               return "PROTO_ERROR_INVALID_CONTEXT_ID";
-       case PROTO_ERROR_MODEM_IN_USE:
-               return "PROTO_ERROR_MODEM_IN_USE";
-       case PROTO_ERROR_INVALID_SIM_STATE:
-               return "PROTO_ERROR_INVALID_SIM_STATE:";
-       case PROTO_ERROR_SERVICE_NOT_SUBSCRIBED:
-               return "PROTO_ERROR_SERVICE_NOT_SUBSCRIBED";
-       case PROTO_ERROR_SERVICE_NOT_IMPLEMENTED:
-               return "PROTO_ERROR_SERVICE_NOT_IMPLEMENTED";
-       case PROTO_ERROR_FDN_NOT_ALLOWED:
-               return "PROTO_ERROR_FDN_NOT_ALLOWED";
-       case PROTO_ERROR_CALL_INCOME:
-               return "PROTO_ERROR_CALL_INCOME";
-       case PROTO_ERROR_NOT_SUPPORT_3GCSD:
-               return "PROTO_ERROR_NOT_SUPPORT_3GCSD";
-       case PROTO_ERROR_UNKNOWN:
-               return "PROTO_ERROR_UNKNOWN";
-       case PROTO_ERROR_SI_OFFLINE:
-               return "PROTO_ERROR_SI_OFFLINE";
-       /* TCP/IP/PPP stack errors */
-       case PROTO_ERROR_TCPIP_UP:
-               return "PROTO_ERROR_TCPIP_UP";
-       case PROTO_ERROR_TCPIP_DOWN:
-               return "PROTO_ERROR_TCPIP_DOWN";
-       case PROTO_ERROR_PPP_UP:
-               return "PROTO_ERROR_PPP_UP";
-       case PROTO_ERROR_PPP_DOWN:
-               return "PROTO_ERROR_PPP_DOWN";
-       case PROTO_ERROR_WDP_INIT:
-               return "PROTO_ERROR_WDP_INIT";
-       /* ProtoMgr API call errors */
-       case PROTO_ERROR_ACTIVE_CONNECTIONS:
-               return "PROTO_ERROR_ACTIVE_CONNECTIONS";
-       case PROTO_ERROR_MAX_CONNECTIONS:
-               return "PROTO_ERROR_MAX_CONNECTIONS";
-       case PROTO_ERROR_INVALID_HANDLE:
-               return "PROTO_ERROR_INVALID_HANDLE";
-       case PROTO_ERROR_INVALID_CONTEXT:
-               return "PROTO_ERROR_INVALID_CONTEXT";
-       case PROTO_ERROR_INVALID_CALLBACK:
-               return "PROTO_ERROR_INVALID_CALLBACK";
-       case PROTO_ERROR_INVALID_EHN:
-               return "PROTO_ERROR_INVALID_EHN";
-       case PROTO_ERROR_INVALID_EVENTCLASS:
-               return "PROTO_ERROR_INVALID_EVENTCLASS";
-       case PROTO_ERROR_INVALID_REFTYPE:
-               return "PROTO_ERROR_INVALID_REFTYPE";
-       case PROTO_ERROR_INVALID_TIMEOUT:
-               return "PROTO_ERROR_INVALID_TIMEOUT";
-       case PROTO_ERROR_MAX_CLIENT:
-               return "PROTO_ERROR_MAX_CLIENT";
-       case PROTO_ERROR_MAX_ACCOUNT:
-               return "PROTO_ERROR_MAX_ACCOUNT";
-       case PROTO_ERROR_ACCESS_DENIED:
-               return "PROTO_ERROR_ACCESS_DENIED";
-       case PROTO_ERROR_REGISTRY_LOAD:
-               return "PROTO_ERROR_REGISTRY_LOAD";
-
-       case PROTO_ERROR_PCBROWSING_ON:
-               return "PROTO_ERROR_PCBROWSING_ON";
-       case PROTO_ERROR_REACTIVATION_REQ:
-               return "PROTO_ERROR_REACTIVATION_REQ";
-       case PROTO_ERROR_NO_PDP_ACTIVATED:
-               return "PROTO_ERROR_NO_PDP_ACTIVATED";
-
-       case PROTO_ERROR_MAX:
-               return "PROTO_ERROR_MAX";
-
-       }
-
-       return MmsDebugPrintUnknownValue(errCode);
-}
-
-
-char *DebugPrintWspResult(WspResult wspResult)
-{
-       switch (wspResult) {
-       case WSP_RESULT_NO_ERROR:
-               return "WSP_RESULT_NO_ERROR";
-       case WSP_RESULT_NO_SESSION:
-               return "WSP_RESULT_NO_SESSION";
-       case WSP_RESULT_NOT_SUITABLE:
-               return "WSP_RESULT_NOT_SUITABLE";
-
-       case WSP_RESULT_NOT_RESPONDING:
-               return "WSP_RESULT_NOT_RESPONDING";
-       case WSP_RESULT_MOP_EXCEED:
-               return "WSP_RESULT_MOP_EXCEED";
-       case WSP_RESULT_MOM_EXCEED:
-               return "WSP_RESULT_MOM_EXCEED";
-
-       case WSP_RESULT_UNABLE:
-               return "WSP_RESULT_UNABLE";
-       case WSP_RESULT_UNKNOWN:
-               return "WSP_RESULT_UNKNOWN";
-       case WSP_RESULT_WRONG_PARAM:
-               return "WSP_RESULT_WRONG_PARAM";
-
-       case WSP_RESULT_NO_MEMORY:
-               return "WSP_RESULT_NO_MEMORY";
-       case WSP_RESULT_NO_HANDLE:
-               return "WSP_RESULT_NO_HANDLE";
-
-       case WSP_RESULT_CAPABILITY_UNABLE:
-               return "WSP_RESULT_CAPABILITY_UNABLE";
-       case WSP_RESULT_UAGENT_NOT_ALLOWED:
-               return "WSP_RESULT_UAGENT_NOT_ALLOWED";
-       }
-
-       return MmsDebugPrintUnknownValue(wspResult);
-}
-
-
-char *DebugPrintWspState(MmsRmWapState wspState)
-{
-       switch (wspState) {     //gMmsRmWapState
-       case RM_WAP_IDLE:
-               return "RM_WAP_IDLE";
-       case RM_WAP_CONNECTING:
-               return "RM_WAP_CONNECTING";
-       case RM_WAP_CONNECTED:
-               return "RM_WAP_CONNECTED";
-       case RM_WAP_DISCONNECTING:
-               return "RM_WAP_DISCONNECTING";
-       case RM_WAP_SECURE_REDIRECT:
-               return "RM_WAP_SECURE_REDIRECT";
-       case RM_WAP_FAILED:
-               return "RM_WAP_FAILED";
-       case RM_WAP_WTLS_HANDSHAKING:
-               return "RM_WAP_WTLS_HANDSHAKING";
-       case RM_WAP_WTLS_HANDSHAKE_COMPLETED:
-               return "RM_WAP_WTLS_HANDSHAKE_COMPLETED";
-       }
-
-       return MmsDebugPrintUnknownValue(wspState);
-}
-
-
-char *MmsDebugPrintRmPduType(MmsRmPduType pduType)
-{
-       switch (pduType) {
-       case MMS_RM_PDU_TYPE:
-               return "MMS_RM_PDU_TYPE";
-
-       case MMS_RM_SEND_REQ:
-               return "MMS_RM_SEND_REQ";
-       case MMS_RM_GET_REQ_AUTO:
-               return "MMS_RM_GET_REQ_AUTO";
-       case MMS_RM_GET_REQ_MANUAL:
-               return "MMS_RM_GET_REQ_MANUAL";
-       case MMS_RM_NOTIFY_RESP_IND:
-               return "MMS_RM_NOTIFY_RESP_IND";
-       case MMS_RM_ACK_IND:
-               return "MMS_RM_ACK_IND";
-
-       case MMS_RM_NOTI_IND:
-               return "MMS_RM_NOTI_IND";
-       case MMS_RM_RETRIEVE_CONF:
-               return "MMS_RM_RETRIEVE_CONF";
-
-       case MMS_RM_READ_REPORT_V10:
-               return "MMS_RM_READ_REPORT_V10";
-       case MMS_RM_READ_REPORT_V11:
-               return "MMS_RM_READ_REPORT_V11";
-       }
-
-       return MmsDebugPrintUnknownValue(pduType);
-}
-
-
-char *MmsDebugPrintMailboxType(MsgMailboxType mailboxType)
-{
-       switch (mailboxType) {
-       case MSG_MAILBOX_WRITE:
-               return "MSG_MAILBOX_WRITE";
-       case MSG_MAILBOX_INBOX:
-               return "MSG_MAILBOX_INBOX";
-       case MSG_MAILBOX_DRAFT:
-               return "MSG_MAILBOX_DRAFT";
-       case MSG_MAILBOX_SENT:
-               return "MSG_MAILBOX_SENT";
-       case MSG_MAILBOX_MAILBOX:
-               return "MSG_MAILBOX_MAILBOX";
-       case MSG_MAILBOX_OUTBOX:
-               return "MSG_MAILBOX_OUTBOX";
-       case MSG_MAILBOX_TEMPLATE:
-               return "MSG_MAILBOX_TEMPLATE";
-       case MSG_MAILBOX_MYFOLDER:
-               return "MSG_MAILBOX_MYFOLDER";
-       case MSG_MAILBOX_MYFOLDER_LIST:
-               return "MSG_MAILBOX_MYFOLDER_LIST";
-       case MSG_MAILBOX_PRESET:
-               return "MSG_MAILBOX_PRESET";
-       }
-
-       return MmsDebugPrintUnknownValue(mailboxType);
-}
-#endif
-
index 5a2700d..91862e7 100755 (executable)
@@ -37,7 +37,7 @@
 #include "MmsPluginDrm.h"
 #include "MsgDrmWrapper.h"
 #endif
-
+#include "MmsPluginUtil.h"
 
 static bool _MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength);          /* bufLen < gMmsDecodeMaxLen */
 static bool _MmsBinaryDecodeGetLongBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength);      /* no bufLen limit */
@@ -3411,7 +3411,7 @@ static int __MmsBinaryDecodeUintvar(FILE *pFile, UINT32 *pUintVar, int totalLeng
                        break;
                }
 
-               if (count > 5) {
+               if (count > 4) {
                        MSG_DEBUG("__MmsBinaryDecodeUintvar : legnth is too long\n");
                        goto __CATCH;
                }
@@ -7926,7 +7926,7 @@ __CATCH:
 bool _MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave)
 {
        FILE *pFile = NULL;
-       char *pExt = NULL;
+//     char *pExt = NULL;
        char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, };        // file name of temp file
        char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; // full absolute path of temp file.
 
index ac0630a..598aca6 100755 (executable)
@@ -22,7 +22,7 @@
 #include "MsgMmsTypes.h"
 #include "MsgDrmWrapper.h"
 #include "MsgDebug.h"
-
+#include "MmsPluginUtil.h"
 
 #ifdef __SUPPORT_DRM__
 
index ca26649..314f940 100755 (executable)
@@ -22,6 +22,7 @@
 #include "MsgDebug.h"
 #include "MsgUtilFile.h"
 #include "MmsPluginMIME.h"
+#include "MmsPluginUtil.h"
 
 gint _g_time_rev_set = 0;
 gint _g_time_rev = 0;
@@ -1466,7 +1467,7 @@ int MmsBinaryEncodeContentTypeLen(MsgType *pType)
        if (pType->param.szName[0]) {
                char* pszName = NULL;
 
-               if (_MsgIsASCII (pType->param.szName)) {
+               if (MsgIsASCII (pType->param.szName)) {
                        MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName is consisted of ascii char-set chars. \n");
 
                        pszName = (char *)malloc(strlen(pType->param.szName) +1);
@@ -1487,12 +1488,12 @@ int MmsBinaryEncodeContentTypeLen(MsgType *pType)
                }
 
                //change empty space to '_' in the file name
-               if (_MsgIsSpace(pszName)) {
+               if (MsgIsSpace(pszName)) {
                        char *pszTempName = NULL;
 
                        MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName has space(' '). \n");
 
-                       _MsgReplaceSpecialChar(pszName, &pszTempName, ' ');
+                       MsgReplaceSpecialChar(pszName, &pszTempName, ' ');
 
                        if (pszTempName) {
                                free(pszName);
@@ -1677,7 +1678,7 @@ bool MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLength)
        if (pType->param.szName[0]) {
                char* pszName = NULL;
 
-               if (_MsgIsASCII (pType->param.szName)) {
+               if (MsgIsASCII (pType->param.szName)) {
 
                        MSG_DEBUG("MmsBinaryEncodeContentType: szName is consisted of ascii char-set chars. \n");
 
@@ -1698,12 +1699,12 @@ bool MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLength)
                }
 
                //change empty space to '_' in the file name
-               if (_MsgIsSpace(pszName)) {
+               if (MsgIsSpace(pszName)) {
                        char*   pszTempName = NULL;
 
                        MSG_DEBUG("MmsBinaryEncodeContentType: szName has space(' '). \n");
 
-                       _MsgReplaceSpecialChar(pszName, &pszTempName, ' ');
+                       MsgReplaceSpecialChar(pszName, &pszTempName, ' ');
 
                        if (pszTempName) {
                                free(pszName);
@@ -2302,7 +2303,7 @@ bool MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody)
                        goto __CATCH;
 
                pBody->offset = _MmsGetEncodeOffset();
-               if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != nRead) {
+               if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
                        MSG_DEBUG("MsgWriteFile failed");
                        goto __CATCH;
                }
@@ -2319,7 +2320,7 @@ bool MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody)
                }
        } else if (pBody->body.pText && pBody->size) {
                pBody->offset = _MmsGetEncodeOffset();
-               if (MsgWriteFile(pBody->body.pText, sizeof(char),pBody->size, pFile) != pBody->size) {
+               if (MsgWriteFile(pBody->body.pText, sizeof(char),(size_t)pBody->size, pFile) != (size_t)pBody->size) {
                        MSG_DEBUG("MsgWriteFile failed");
                        goto __CATCH;
                }
index 120ae45..9caddf1 100755 (executable)
@@ -92,6 +92,9 @@ void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char
                MmsPluginInternal::instance()->processForwardConf(&msgInfo, pRequest);
                break;
 
+       case eMMS_READREPORT_CONF:
+               remove(pRetrievedFilePath);
+               break;
        default:
                break;
        }
@@ -105,7 +108,6 @@ void MmsPluginEventHandler::handleMmsError(mmsTranQEntity *pRequest)
        msg_error_t err = MSG_SUCCESS;
 
        MSG_MESSAGE_INFO_S msgInfo = {};
-       MMS_RECV_DATA_S recvData = {{0}, };
 
        MSG_DEBUG("pRequest->msgId [%d]", pRequest->msgId);
 
index e38f675..f37f8a3 100755 (executable)
@@ -172,16 +172,6 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int
 
        memset(szBuffer, 0, 1025);
        memset(pcheader, 0, HTTP_REQUEST_LEN);
-       nResult = __httpGetHeaderField(MMS_HH_ACCEPT_ENCODING, szBuffer);
-       if (nResult) {
-               strcat(pcheader, "Accept-Encoding: ");
-               strcat(pcheader, szBuffer);
-               MSG_DEBUG("%s", pcheader);
-               *responseHeaders = curl_slist_append(*responseHeaders, pcheader);
-       }
-
-       memset(szBuffer, 0, 1025);
-       memset(pcheader, 0, HTTP_REQUEST_LEN);
        nResult = __httpGetHeaderField(MMS_HH_USER_AGENT, szBuffer);
        if (nResult) {
                strcat(pcheader, "User-Agent: ");
@@ -243,9 +233,9 @@ static bool __httpGetHeaderField(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *s
 
                case MMS_HH_USER_AGENT:
                        {
-                               char szUserAgent[1024 + 1] = {0,};
+                               char szUserAgent[1024 + 1];
 
-                               memset(szUserAgent, 0x00, (sizeof(char) * (1024 + 1) ));
+                               memset(szUserAgent, 0x00, sizeof(szUserAgent));
                                snprintf(szUserAgent, 1024, "%s", MSG_MMS_HH_USER_AGENT);
 
                                snprintf((char *)szHeaderBuffer, 1024, "%s", szUserAgent);
@@ -469,10 +459,10 @@ static int __httpCmdPostTransaction(MMS_PLUGIN_HTTP_DATA_S *httpConfig)
        }
 
        MSG_DEBUG("## End Transaction ##");
-       MSG_DEBUG("############ trID = %d ###########", trId);
 
        srandom((unsigned int) time(NULL));
        trId = random() % 1000000000 + 1;
+       MSG_DEBUG("############ trID = %d ###########", trId);
 
        httpConfig->transactionId = trId;
 
@@ -515,9 +505,11 @@ static int __httpCmdGetTransaction(MMS_PLUGIN_HTTP_DATA_S *httpConfig)
        }
 
        MSG_DEBUG("## End Transaction ##");
-       MSG_DEBUG("############ trID = %d ###########", trId);
+
        srandom((unsigned int) time(NULL));
        trId = random() % 1000000000 + 1;
+       MSG_DEBUG("############ trID = %d ###########", trId);
+
        httpConfig->transactionId = trId;
 
        return eMMS_HTTP_SENT_SUCCESS;
index 7e3d831..724665a 100755 (executable)
@@ -241,123 +241,49 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
        return true;
 }
 
-
 void MmsPluginInternal::processDeliveryInd(MSG_MESSAGE_INFO_S *pMsgInfo)
 {
        MSG_BEGIN();
 
-       MmsMsg *pMsg = NULL;
-       bool bFound = false;
-       MmsMsgMultiStatus *pStatus = NULL;
-       MmsMsgMultiStatus *pLastStatus = NULL;
-
-       pMsg = (MmsMsg *)malloc(sizeof(MmsMsg));
+       MmsMsgMultiStatus status;
+       memset(&status, 0x00, sizeof(MmsMsgMultiStatus));
 
-       if (pMsg == NULL) {
-               MSG_DEBUG("fail to allocation memory.");
-               return;
-       }
+       status.msgStatus = mmsHeader.msgStatus;
+       status.handledTime = mmsHeader.date;
+       status.bDeliveryReportIsRead = false;
+       status.bDeliveyrReportIsLast= true;
 
-       MmsInitMsgAttrib(&pMsg->mmsAttrib);
+       MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr);
+       MSG_DEBUG("[INFO] [ADDR: %s, MMSID: %s]",mmsHeader.pTo->szAddr, mmsHeader.szMsgID);
 
-       pMsgInfo->msgType.mainType      = MSG_MMS_TYPE;
-       pMsgInfo->msgType.subType       = MSG_DELIVERYIND_MMS;
+       pMsgInfo->msgType.mainType      = MSG_MMS_TYPE;
+       pMsgInfo->msgType.subType       = MSG_DELIVERYIND_MMS;
        pMsgInfo->bTextSms = true;
+       pMsgInfo->dataSize = 0;
+       memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
 
-       MSG_DEBUG("#### mmsHeader.szMsgID = %s : when received delivery ind####", mmsHeader.szMsgID);
 
-       int tmpId = (msg_message_id_t)MmsSearchMsgId(mmsHeader.pTo->szAddr, mmsHeader.szMsgID);
+       strncpy(pMsgInfo->msgData, getMmsDeliveryStatus(status.msgStatus), MAX_MSG_DATA_LEN);
+       pMsgInfo->dataSize  = strlen(pMsgInfo->msgData);
+       MSG_DEBUG("Delivery Status = %s", pMsgInfo->msgData);
 
+       strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
 
-       MSG_DEBUG("tmpId [%d]", tmpId);
-       MSG_DEBUG("mmsHeader.pTo->szAddr [%s]", mmsHeader.pTo->szAddr);
-
+       int tmpId = (msg_message_id_t)MmsSearchMsgId(mmsHeader.pTo->szAddr, mmsHeader.szMsgID);
        if (tmpId > 0) {
-               pMsgInfo->msgId = (msg_message_id_t)tmpId;
-
-               pMsg->mmsAttrib.pMultiStatus = MmsGetMultiStatus(pMsgInfo->msgId);
-
-               pStatus = pMsg->mmsAttrib.pMultiStatus;
-
-               MSG_DEBUG("### pStatus->szTo = %s ###", pStatus->szTo);
-
-               while (pStatus && !bFound) {
-                       MSG_DEBUG("### MmsAddrUtilCompareAddr ###");
-                       MSG_DEBUG("### mmsHeader.pTo->szAddr = %s ###", mmsHeader.pTo->szAddr);
-                       if (MmsAddrUtilCompareAddr( pStatus->szTo, mmsHeader.pTo->szAddr)) {
-                               bFound = true;
-                               break;
-                       }
-
-                       pStatus = pStatus->pNext;
-               }
-
-               if (bFound == false) {
-                       MSG_DEBUG("### bFound == false ###");
-                       /* Queue the delivery report  --------------------------- */
+               MSG_DEBUG("Found MSG_ID = %d", tmpId);
 
-                       pStatus = (MmsMsgMultiStatus *)malloc(sizeof(MmsMsgMultiStatus));
-                       memset(pStatus, 0, sizeof(MmsMsgMultiStatus));
+               //Insert to Delievery DB
+               MmsPluginStorage::instance()->insertDeliveryReport(tmpId, mmsHeader.pTo->szAddr, &status);
 
-                       pStatus->readStatus = MMS_READSTATUS_NONE;
-                       memset(pStatus->szTo, 0, MSG_ADDR_LEN + 1);
-                       strncpy(pStatus->szTo, mmsHeader.pTo->szAddr, MSG_ADDR_LEN);
-
-                       if (pMsg->mmsAttrib.pMultiStatus == NULL) {
-                               /* first delivery report */
-                               pMsg->mmsAttrib.pMultiStatus = pStatus;
-                       } else {
-                               pLastStatus = pMsg->mmsAttrib.pMultiStatus;
-
-                               while (pLastStatus->pNext) {
-                                       pLastStatus = pLastStatus->pNext;
-                               }
-
-                               pLastStatus->pNext = pStatus;
-                               pLastStatus = pStatus;
-                       }
-               }
-
-               pStatus->handledTime = mmsHeader.date;
-               pStatus->msgStatus = mmsHeader.msgStatus;
-
-               memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
-               pMsgInfo->dataSize = 0;
-               strncpy(pMsgInfo->msgData, getMmsDeliveryStatus(pStatus->msgStatus), MAX_MSG_DATA_LEN);
-               pMsgInfo->dataSize  = strlen(pMsgInfo->msgData);
-               pMsgInfo->bTextSms = true;
-               MSG_DEBUG("Delivery Status = %s", pMsgInfo->msgData);
-
-               strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
-
-               pStatus->bDeliveryReportIsRead = false;
-
-               _MmsDataUpdateLastStatus(pMsg);
-
-               pStatus->bDeliveyrReportIsLast= true;
-
-               MmsUpdateDeliveryReport(pMsgInfo->msgId, pStatus);
+               pMsgInfo->msgId = (msg_message_id_t)tmpId;
 
                MmsPluginStorage::instance()->addMmsNoti(pMsgInfo);
-       } else {
-               MSG_DEBUG("Can't not find Message!");
-               memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
-               pMsgInfo->dataSize = 0;
-               strncpy(pMsgInfo->msgData, getMmsDeliveryStatus(mmsHeader.msgStatus), MAX_MSG_DATA_LEN);
-
-               MSG_DEBUG("Delivery Status = %s", pMsgInfo->msgData);
-
-               pMsgInfo->dataSize  = strlen(pMsgInfo->msgData);
 
-               MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr);
-
-               strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
+       } else {
+               MSG_DEBUG("Can not find MMS message in DB");
        }
 
-       MsgFreeAttrib(&pMsg->mmsAttrib);
-
-       free(pMsg);
-
        MSG_END();
 }
 
@@ -365,20 +291,11 @@ void MmsPluginInternal::processReadOrgInd(MSG_MESSAGE_INFO_S *pMsgInfo)
 {
        MSG_BEGIN();
 
-       MmsMsg *pMsg = NULL;
-       bool bFound = false;
-       MmsMsgMultiStatus *pStatus = NULL;
-       MmsMsgMultiStatus *pLastStatus = NULL;
-
-       pMsg = (MmsMsg *)malloc(sizeof(MmsMsg));
-
-       if (pMsg == NULL) {
-               MSG_DEBUG("fail to allocation memory.");
+       if (pMsgInfo == NULL) {
+               MSG_DEBUG("parameter err");
                return;
        }
 
-       MmsInitMsgAttrib(&pMsg->mmsAttrib);
-
        pMsgInfo->msgType.mainType = MSG_MMS_TYPE;
        pMsgInfo->msgType.subType = MSG_READORGIND_MMS;
        pMsgInfo->bTextSms = true;
@@ -386,97 +303,31 @@ void MmsPluginInternal::processReadOrgInd(MSG_MESSAGE_INFO_S *pMsgInfo)
        MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr);
        MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr);
 
-       if (mmsHeader.readStatus != MSG_READ_REPORT_IS_DELETED || (strcmp(mmsHeader.pFrom->szAddr, mmsHeader.pTo->szAddr))) {
-               MSG_DEBUG("#### mmsHeader.szMsgID = %s : when received read orig ind####", mmsHeader.szMsgID);
-
-               int tmpId = MmsSearchMsgId(mmsHeader.pFrom->szAddr, mmsHeader.szMsgID);
-
-               if (tmpId > 0) {
-                       pMsgInfo->msgId = (msg_message_id_t)tmpId;
-
-                       pMsg->mmsAttrib.pMultiStatus = MmsGetMultiStatus(pMsgInfo->msgId);
-
-                       pStatus = pMsg->mmsAttrib.pMultiStatus;
-
-                       MSG_DEBUG("### pStatus->szTo = %s ###", pStatus->szTo);
-
-                       while (pStatus && !bFound) {
-                               MSG_DEBUG("### MmsAddrUtilCompareAddr ###");
-                               MSG_DEBUG("### mmsHeader.pFrom->szAddr = %s ###", mmsHeader.pFrom->szAddr);
-                               if (MmsAddrUtilCompareAddr(pStatus->szTo, mmsHeader.pFrom->szAddr)) {
-                                       bFound = true;
-                                       break;
-                               }
-
-                               pStatus = pStatus->pNext;
-                       }
-
-                       if (bFound == false) {
-                               MSG_DEBUG("### bFound == false ###");
-                               /* Queue the delivery report  --------------------------- */
-
-                               pStatus = (MmsMsgMultiStatus *)malloc(sizeof(MmsMsgMultiStatus));
-                               memset(pStatus, 0, sizeof(MmsMsgMultiStatus));
-
-                               pStatus->msgStatus = MMS_MSGSTATUS_NONE;
-
-                               memset(pStatus->szTo, 0, MSG_ADDR_LEN + 1);
-                               strncpy(pStatus->szTo, mmsHeader.pFrom->szAddr, MSG_ADDR_LEN);
-
-                               if (pMsg->mmsAttrib.pMultiStatus == NULL) {
-                                       /* first readOrg report */
-                                       pMsg->mmsAttrib.pMultiStatus = pStatus;
-                               } else {
-                                       pLastStatus = pMsg->mmsAttrib.pMultiStatus;
-
-                                       while (pLastStatus->pNext) {
-                                               pLastStatus = pLastStatus->pNext;
-                                       }
-
-                                       pLastStatus->pNext = pStatus;
-                                       pLastStatus = pStatus;
-                               }
-                       }
-
-                       pStatus->readTime = mmsHeader.date;
-                       pStatus->readStatus = mmsHeader.readStatus;
-
-                       memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
-                       pMsgInfo->dataSize = 0;
-                       strncpy(pMsgInfo->msgData, getMmsReadStatus(pStatus->readStatus), MAX_MSG_DATA_LEN);
-                       pMsgInfo->dataSize  = strlen(pMsgInfo->msgData);
-                       pMsgInfo->bTextSms = true;
-                       MSG_DEBUG("read Status = %s", pMsgInfo->msgData);
-
-                       strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
-
-                       pStatus->bReadReplyIsRead = false;
+       memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
+       pMsgInfo->dataSize = 0;
 
-                       _MmsDataUpdateLastStatus(pMsg);
+       strncpy(pMsgInfo->msgData, getMmsReadStatus(mmsHeader.readStatus), MAX_MSG_DATA_LEN);
+       pMsgInfo->dataSize  = strlen(pMsgInfo->msgData);
 
-                       pStatus->bReadReplyIsLast= true;
+       MSG_DEBUG("read Status = %s", pMsgInfo->msgData);
+       strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
 
-                       MmsUpdateReadReport(pMsgInfo->msgId, pStatus);
+       int tmpId = MmsSearchMsgId(mmsHeader.pFrom->szAddr, mmsHeader.szMsgID);
+       if (tmpId > 0) {
+               pMsgInfo->msgId = (msg_message_id_t)tmpId;
 
-                       MmsPluginStorage::instance()->addMmsNoti(pMsgInfo);
-               } else {
-                       MSG_DEBUG("Can't not find Message!");
-                       memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
-                       pMsgInfo->dataSize = 0;
-                       strncpy(pMsgInfo->msgData, getMmsReadStatus(mmsHeader.readStatus), MAX_MSG_DATA_LEN);
-                       pMsgInfo->dataSize  = strlen(pMsgInfo->msgData);
-                       MSG_DEBUG("read Status = %s", pMsgInfo->msgData);
+               MmsMsgMultiStatus Status;
+               memset(&Status, 0x00, sizeof(MmsMsgMultiStatus));
+               Status.readTime = mmsHeader.date;
+               Status.readStatus = mmsHeader.readStatus;
 
-                       MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr);
+               MmsPluginStorage::instance()->insertReadReport(pMsgInfo->msgId, mmsHeader.pFrom->szAddr, &Status);
+               MmsPluginStorage::instance()->addMmsNoti(pMsgInfo);
 
-                       strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
-               }
+       } else {
+               MSG_DEBUG("Can't not find Message!");
        }
 
-       MsgFreeAttrib(&pMsg->mmsAttrib);
-
-       free(pMsg);
-
        MSG_END();
 }
 
@@ -484,8 +335,6 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn
 {
        MSG_BEGIN();
 
-       msg_error_t err = MSG_SUCCESS;
-
        MMS_RECV_DATA_S recvData = {{0}, };
 
        pMsgInfo->msgId = pRequest->msgId;
@@ -500,6 +349,7 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn
 
        if (mmsHeader.responseStatus == MMS_RESPSTATUS_OK) {
                pMsgInfo->networkStatus = MSG_NETWORK_SEND_SUCCESS;
+               pMsgInfo->dataSize = pRequest->postDataLen;
        } else {
                pMsgInfo->networkStatus = MSG_NETWORK_SEND_FAIL;
 
@@ -651,8 +501,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
                strcpy(szFileName, pMsg->szFileName);
 
                err = pStorage->getMsgText(&msgData, pMsgInfo->msgText);
-               err = pStorage->makeThumbnail(&msgData, pMsgInfo->thumbPath, szFileName);
-
+               MmsMakePreviewInfo(pMsgInfo->msgId, &msgData);
                bMultipartRelated = true;
        } else {
                MSG_DEBUG("Multipart mixed message doesn't support mms conversation");
index 46c1c36..08132ea 100755 (executable)
@@ -34,7 +34,7 @@
 #include "MmsPluginStorage.h"
 #include "MsgMmsMessage.h"
 #include "MsgGconfWrapper.h"
-
+#include "MmsPluginUtil.h"
 #include "MmsPluginSMILValidate.h"
 
 
@@ -304,7 +304,7 @@ bool MmsInsertPresentation(MmsMsg *pMsg, MsgContentType mimeType, char *pData, i
        pMsg->msgBody.presentationType.param.charset = MSG_CHARSET_UTF8;
        snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "<_S_>");
 
-       snprintf(pMsg->msgType.param.szStart, MSG_MSG_ID_LEN + 1, pMsg->msgBody.presentationType.szContentID);
+       snprintf(pMsg->msgType.param.szStart, MSG_MSG_ID_LEN + 1, "%s", pMsg->msgBody.presentationType.szContentID);
        pMsg->msgType.param.type = mimeType;
 
        memset(pMsg->msgBody.pPresentationBody->body.pText, 0, size + 1);
@@ -495,220 +495,7 @@ bool MmsIsVitemContent (int type, char *pszName)
        return false;
 }
 
-bool _MsgIsASCII(char *pszText)
-{
-       int length = strlen(pszText);
-
-       for (int i = 0; i < length; ++i) {
-               if (!isascii(pszText[i])) {
-                       MSG_DEBUG("_MsgIsASCII false.");
-                       return false;
-               }
-       }
-
-       MSG_DEBUG("_MsgIsASCII true.");
-       return true;
-}
-
-
-bool _MsgReplaceNonAscii(char *szInText, char **szOutText, char replaceChar)
-{
-       MSG_DEBUG("_MsgReplaceNonAscii");
-       int nCount = 0;
-       int index = 0;
-       int cLen = 0;
-       char *pNew = NULL;
-
-       cLen = strlen(szInText);
-
-       pNew = (char *)malloc(cLen + 1);
-
-       if (pNew == NULL)
-               return false;
-
-       memset(pNew, 0, cLen + 1);
-
-       while (*(szInText+nCount) != '\0') {
-               if (0x0001 <= *(szInText+nCount) && *(szInText+nCount) <= 0x007F) {
-                       MSG_DEBUG("_MsgReplaceNonAscii: non ascii characters (1bytes). \n");
-                       pNew[index] = szInText[nCount];
-                       nCount += 1;
-                       index += 1;
-               } else {
-                       MSG_DEBUG("_MsgReplaceNonAscii: UTF-8 characters (2bytes). \n");
-                       pNew[index] = replaceChar;
-                       nCount += 1;
-                       index +=1;
-               }
-       }
-
-       *szOutText = pNew;
-       return true;
-}
-
-bool _MsgIsSpace(char *pszText)
-{
-       MSG_DEBUG("_MsgIsSpace");
-       if (!pszText) {
-               MSG_DEBUG("_MsgIsSpace: pszText == NULL!\n");
-               return false;
-       }
-
-       if (strchr(pszText, ' ') != NULL)
-               return true;
-       else
-               return false;
-}
-
-bool _MsgReplaceSpecialChar(char *szInText, char **szOutText, char specialChar)
-{
-       MSG_DEBUG("_MsgReplaceSpecialChar");
-       char *pszOutText = NULL;
-       char szBuf[10] = {0, };
-       char temp[5] = {0, };
-       int cLen = 0;
-       int i = 0;
-
-       if (!szInText) {
-               MSG_DEBUG("_MsgReplaceSpecialChar: szInText == NULL! \n");
-               return false;
-       }
-
-       if (!szOutText)
-               return false;
-
-       cLen = strlen(szInText);
-
-       if (specialChar == ' ') {
-               if ((pszOutText = (char *)malloc(cLen + 1)) == NULL) {
-                       MSG_DEBUG("_MsgReplaceSpecialChar : %d line. MemAlloc failed.\n", __LINE__);
-                       return false;
-               }
-               memset(pszOutText, 0, cLen + 1);
-
-               *szOutText = pszOutText;
-       }
-
-       for (i = 0; i<cLen; i++) {
-               switch (specialChar) {
-               // changed space to '_'
-               case ' ':
-                       pszOutText[i] = (szInText[i] == specialChar) ? '_' : szInText[i];
-                       break;
-
-               default:
-                       if (szInText[i] != specialChar) {
-                               temp[0] = szInText[i];
-                               *szOutText = MsgStrAppend(*szOutText, temp);
-                               continue;
-                       } else {
-                               _MsgConvertCharToHex(specialChar, szBuf);
-                               *szOutText = MsgStrAppend(*szOutText, (char *)"%");
-                               *szOutText = MsgStrAppend(*szOutText, szBuf);
-                       }
-                       break;
-               }
-       }
-
-       MSG_DEBUG("_MsgReplaceSpecialChar : output text : [%s]\n", pszOutText);
-
-       return true;
-}
-
-char *MsgStrAppend(char *szInputStr1, char *szInputStr2)
-{
-       MSG_DEBUG("MsgStrAppend");
-       char *szOutputStr = NULL;
-
-       if (szInputStr1 == NULL) {
-               szOutputStr = MsgStrCopy(szInputStr2);
-       } else {
-               int length1 = 0;
-               int length2 = 0;
-               length1 = MsgStrlen(szInputStr1);
-               length2 = MsgStrlen(szInputStr2);
-
-               szOutputStr = (char *)malloc(length1 + length2 + 1);
-
-               if (szOutputStr == NULL)
-                       goto __CATCH;
-
-               memset(szOutputStr, 0, length1 + length2 + 1);
-
-               strncpy(szOutputStr, szInputStr1, length1);
-
-               if (length2 > 0)
-                       strcat(szOutputStr, szInputStr2);
-
-               free(szInputStr1);
-               szInputStr1 = NULL;
-       }
-
-       return szOutputStr;
-
-__CATCH:
-       return NULL;
-}
-
-char *MsgStrCopy(const char *string)
-{
-       char *pDst = NULL;
-
-       if (string) {
-               pDst = (char *)malloc(1 + strlen(string));
-               if (pDst == NULL) {
-                       MSG_DEBUG("MsgStrCopy: pDst MemAlloc Fail \n");
-                       return NULL;
-               }
-
-               memset(pDst, 0, strlen(string) + 1);
-
-               strcpy(pDst,string);
-
-               return pDst;
-       }
-
-       return NULL;
-}
-
-char *MsgStrNCopy(const char *string, int length)
-{
-       char *pDst = NULL;
-
-       if (string) {
-               pDst = (char *)malloc(1 + length);
-               if (pDst == NULL) {
-                       MSG_DEBUG("MsgStrNCopy: pDst MemAlloc Fail \n");
-                       return NULL;
-               }
-
-               memset(pDst, 0, length + 1);
-               strncpy(pDst,string, length);
-
-               return pDst;
-       }
-
-       return NULL;
-}
-
-int MsgStrlen(char * pStr)
-{
-       if (pStr == NULL)
-               return 0;
-
-       return strlen(pStr);
-}
-
-bool _MsgConvertCharToHex(char pSrc, char *pDest)
-{
-       static unsigned char saucHex[] = "0123456789ABCDEF";
 
-       pDest[0] = saucHex[pSrc >> 4];
-       pDest[1] = saucHex[pSrc & 0xF];
-       pDest[2] = 0;
-
-       return true;
-}
 
 MsgMultipart *MmsAllocMultipart(void)
 {
@@ -1004,6 +791,7 @@ bool MmsComposeMessage(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDIN
        if (pageCnt == 0) {     // Multipart mixed
                pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED;
                pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED;
+               MmsMakePreviewInfo(pMsgInfo->msgId, pMsgData);
        } else {        // Multipart related
 
                int RawDataSize = 0;
@@ -1056,7 +844,7 @@ bool MmsComposeMessage(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDIN
 
                MmsPluginStorage *pStorage = MmsPluginStorage::instance();
                err = pStorage->getMsgText(pMsgData, pMsgInfo->msgText);
-               err = pStorage->makeThumbnail(pMsgData, pMsgInfo->thumbPath, szFileName);
+               MmsMakePreviewInfo(pMsgInfo->msgId, pMsgData);
        }
 
 #ifdef FEATURE_JAVA_MMS
@@ -1403,24 +1191,6 @@ int MmsSearchMsgId(char *toNumber, char *szMsgID)
        return msgId;
 }
 
-void MmsUpdateDeliveryReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus)
-{
-       MSG_BEGIN();
-
-       MmsPluginStorage::instance()->updateDeliveryReport(msgId, pStatus);
-
-       MSG_END();
-}
-
-void MmsUpdateReadReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus)
-{
-       MSG_BEGIN();
-
-       MmsPluginStorage::instance()->updateReadReport(msgId, pStatus);
-
-       MSG_END();
-}
-
 MmsMsgMultiStatus *MmsGetMultiStatus(msg_message_id_t msgId)
 {
        MmsMsgMultiStatus *pMultiStatus;
@@ -1463,3 +1233,64 @@ bool __MsgInitMsgDRMInfo(MsgDRMInfo *pMsgDrmInfo)
        return true;
 }
 #endif
+
+msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg)
+{
+       MMS_PAGE_S *pPage = NULL;
+       MMS_MEDIA_S *pMedia = NULL;
+
+       if (pMmsMsg == NULL)
+               return MSG_ERR_NULL_POINTER;
+
+       if (pMmsMsg->pageCnt > 0) {
+
+               MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_PAGE, (char *)"pagecount", pMmsMsg->pageCnt);
+
+               pPage = _MsgMmsGetPage(pMmsMsg, 0);
+               for (int j = 0; j < pPage->mediaCnt; j++) {
+
+                       pMedia = _MsgMmsGetMedia(pPage, j);
+                       MSG_DEBUG("pMedia's Name: %s", pMedia->szFilePath);
+
+                       if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG || pMedia->mediatype == MMS_SMIL_MEDIA_VIDEO) {
+                               char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, };
+                               char thumbPath[MSG_FILEPATH_LEN_MAX+1] = {0, };
+
+                               memset(szFileName, 0x00, MSG_FILENAME_LEN_MAX+1);
+                               memset(thumbPath, 0x00, MSG_FILEPATH_LEN_MAX);
+
+                               snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%d.mms",msgId);
+                               snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"/%s.jpg", szFileName);
+
+                               if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG) {
+                                       if (makeImageThumbnail(pMedia->szFilePath, thumbPath) == true) {
+                                               MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_IMG, thumbPath);
+                                       } else {
+                                               MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMedia->szFilePath, thumbPath);
+                                       }
+                               } else {
+                                       if (makeVideoThumbnail(pMedia->szFilePath, thumbPath) == true) {;
+                                               MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_VIDEO, thumbPath);
+                                       } else {
+                                               MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMedia->szFilePath, thumbPath);
+                                       }
+                               }
+
+                       } else if (pMedia->mediatype == MMS_SMIL_MEDIA_AUDIO) {
+                               MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_AUDIO, pMedia->szFileName);
+                       }
+               }
+       } else {
+               MSG_DEBUG("There is no page");
+       }
+
+       int attachCnt = _MsgMmsGetAttachCount(pMmsMsg);
+       if (attachCnt > 0) {
+               MMS_ATTACH_S *pAttach = _MsgMmsGetAttachment(pMmsMsg, 0);
+               MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_ATTACH, pAttach->szFileName, attachCnt);
+       } else {
+               MSG_DEBUG("There is no attachment");
+       }
+
+       return MSG_SUCCESS;
+}
index 5ef0bbc..8cd19b6 100755 (executable)
@@ -1597,6 +1597,9 @@ bool MmsSmilAddRegion(HMmsSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion)
                        } else if (MMSUI_IMAGE_REGION_FIT_HIDDEN == pstSmilRegion->fit) {
                                xmlSetProp(pstRegion, (const xmlChar *)"fit", (const xmlChar *)"hidden");
                        }
+
+                       __MmsSmilInsertNode(pstLayoutList, pstRootLayoutList, pstRegion);
+
                } else
                        MSG_DEBUG("There is no attribute in <region> node\n");
 
index bebed16..a4431a9 100755 (executable)
@@ -18,9 +18,6 @@
 #include <sys/stat.h>
 #include <errno.h>
 
-#include <mm_file.h>
-#include <mm_util_jpeg.h>
-
 #include "MsgDebug.h"
 #include "MsgException.h"
 #include "MsgUtilFile.h"
@@ -34,9 +31,6 @@
 #include "MmsPluginCodec.h"
 #include "MmsPluginSmil.h"
 #include "MmsPluginDrm.h"
-#include <media-thumbnail.h>
-#include <mm_util_imgp.h>
-#include <mm_util_jpeg.h>
 #include "MsgHelper.h"
 
 static void __MmsReleaseMmsLists(MMS_MESSAGE_DATA_S *mms_data)
@@ -159,6 +153,13 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
                MsgFsync(pFile);        //file is written to device immediately, it prevents missing file data from unexpected power off
                MsgCloseFile(pFile);
 
+               char filepath[MSG_FILEPATH_LEN_MAX+1] = {0,};
+               int size = 0;
+
+               snprintf((char *)filepath, MSG_FILEPATH_LEN_MAX+1, MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
+               MsgGetFileSize(filepath, &size);
+               pMsgInfo->dataSize = size;
+
                _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
                MsgFreeAttrib(&mmsMsg.mmsAttrib);
                __MmsReleaseMmsLists(&mmsMsgData);
@@ -212,8 +213,7 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
                        strcpy(szFileName, pMsg->szFileName);
 
                        err = pStorage->getMsgText(&mmsMsgData, pMsgInfo->msgText);
-                       err = pStorage->makeThumbnail(&mmsMsgData, pMsgInfo->thumbPath, szFileName);
-
+                       MmsMakePreviewInfo(pMsgInfo->msgId, &mmsMsgData);
                        __MmsReleaseMmsLists(&mmsMsgData);
                }
 
@@ -449,7 +449,6 @@ msg_error_t MmsPluginStorage::addMmsMsgToDB(MmsMsg *pMmsMsg, const MSG_MESSAGE_I
        return MSG_SUCCESS;
 }
 
-
 msg_error_t    MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg)
 {
        MSG_BEGIN();
@@ -654,7 +653,6 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
        char filePath[MAX_FULL_PATH_SIZE+1] = {0, };
        char sqlQuery[MAX_QUERY_LEN + 1];
 
-       unsigned int addrId = 0;
        FILE *pFile = NULL;
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -780,15 +778,18 @@ msg_error_t MmsPluginStorage::updateNetStatus(msg_message_id_t msgId, msg_networ
        return MSG_SUCCESS;
 }
 
-
-msg_error_t MmsPluginStorage::updateDeliveryReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus)
+msg_error_t MmsPluginStorage::insertDeliveryReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus)
 {
        char sqlQuery[MAX_QUERY_LEN + 1];
-
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET DELIVERY_REPORT_STATUS = %d, DELIVERY_REPORT_TIME = %ld WHERE MSG_ID = %d;",
-                       MSGFW_MESSAGE_TABLE_NAME, pStatus->msgStatus, pStatus->handledTime, msgId);
+       //( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME);
+       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
+                       "(MSG_ID, ADDRESS_VAL, STATUS_TYPE, STATUS, TIME) "
+                       "VALUES (%d, '%s', %d, %d, %d);",
+                       MSGFW_REPORT_TABLE_NAME, msgId, address, MSG_REPORT_TYPE_DELIVERY, pStatus->msgStatus, (int)pStatus->handledTime);
+
+       MSG_DEBUG("QUERY : [%s]", sqlQuery);
 
        if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS)
                return MSG_ERR_DB_EXEC;
@@ -796,16 +797,18 @@ msg_error_t MmsPluginStorage::updateDeliveryReport(msg_message_id_t msgId, MmsMs
        return MSG_SUCCESS;
 }
 
-
-msg_error_t MmsPluginStorage::updateReadReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus)
+msg_error_t MmsPluginStorage::insertReadReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus)
 {
        char sqlQuery[MAX_QUERY_LEN + 1];
-
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET READ_REPORT_STATUS = %d, READ_REPORT_TIME = %lu WHERE MSG_ID = %d;",
-                       MSGFW_MESSAGE_TABLE_NAME, pStatus->readStatus, pStatus->readTime, msgId);
+       //( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME);
+       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
+                       "(MSG_ID, ADDRESS_VAL, STATUS_TYPE, STATUS, TIME) "
+                       "VALUES (%d, '%s', %d, %d, %d);",
+                       MSGFW_REPORT_TABLE_NAME, msgId, address, MSG_REPORT_TYPE_READ, pStatus->readStatus, (int)pStatus->readTime);
 
+       MSG_DEBUG("QUERY : [%s]", sqlQuery);
 
        if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS)
                return MSG_ERR_DB_EXEC;
@@ -813,7 +816,6 @@ msg_error_t MmsPluginStorage::updateReadReport(msg_message_id_t msgId, MmsMsgMul
        return MSG_SUCCESS;
 }
 
-
 msg_error_t MmsPluginStorage::updateMmsAttrib(msg_message_id_t msgId, MmsAttrib *attrib, MSG_SUB_TYPE_T msgSubType)
 {
        MSG_BEGIN();
@@ -826,8 +828,8 @@ msg_error_t MmsPluginStorage::updateMmsAttrib(msg_message_id_t msgId, MmsAttrib
                snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET EXPIRY_TIME = %d WHERE MSG_ID = %d;",
                                MMS_PLUGIN_MESSAGE_TABLE_NAME, attrib->expiryTime.time, msgId);
        } else if (msgSubType == MSG_RETRIEVE_AUTOCONF_MMS || msgSubType == MSG_RETRIEVE_MANUALCONF_MMS) {
-               snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ASK_DELIVERY_REPORT = %d, ASK_READ_REPLY = %d, PRIORITY = %d WHERE MSG_ID = %d;",
-                               MMS_PLUGIN_MESSAGE_TABLE_NAME, attrib->bAskDeliveryReport, attrib->bAskReadReply, attrib->priority, msgId);
+               snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ASK_DELIVERY_REPORT = %d, ASK_READ_REPLY = %d, PRIORITY = %d, VERSION = %d WHERE MSG_ID = %d;",
+                               MMS_PLUGIN_MESSAGE_TABLE_NAME, attrib->bAskDeliveryReport, attrib->bAskReadReply, attrib->priority, attrib->version, msgId);
        }
 
        MSG_DEBUG("QUERY : [%s]", sqlQuery);
@@ -1207,197 +1209,26 @@ msg_error_t MmsPluginStorage::getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsg
        return MSG_SUCCESS;
 }
 
-
-msg_error_t MmsPluginStorage::makeThumbnail(MMS_MESSAGE_DATA_S *pMmsMsg, char *pThumbnailPath, char *szFileName)
+msg_error_t MmsPluginStorage::insertPreviewInfo(int msgId, int type, char *value, int count)
 {
-       MMS_PAGE_S *pPage = NULL;
-       MMS_MEDIA_S *pMedia = NULL;
-
-       bool bThumbnail = false;
-
-       for (int i = 0; i < pMmsMsg->pageCnt; i++) {
-               pPage = _MsgMmsGetPage(pMmsMsg, i);
-               for (int j = 0; j < pPage->mediaCnt; j++) {
-                       pMedia = _MsgMmsGetMedia(pPage, j);
-
-                       MSG_DEBUG("pMedia's Name: %s", pMedia->szFilePath);
-
-                       if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG) {
-                               MSG_DEBUG("Make thumbnail: image");
-
-                               char thumbPath[MSG_FILEPATH_LEN_MAX] = {0, };
-
-                               snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"/%s.jpg", szFileName);
-                               int err = -1;
-                               err = thumbnail_request_save_to_file(pMedia->szFilePath, MEDIA_THUMB_LARGE, thumbPath);
-                               if (err < 0) {
-                                       MSG_DEBUG("Make thumbnail: image failed");
-                                       continue;
-                               }
-
-                               strncpy(pThumbnailPath, thumbPath, MSG_FILEPATH_LEN_MAX);
-
-                               bThumbnail = true;
-
-                               break;
-                       } else if (pMedia->mediatype == MMS_SMIL_MEDIA_VIDEO) {
-                               MSG_DEBUG("Make thumbnail: video");
-
-                               MMHandleType content_attrs = (MMHandleType)NULL;
-                               char *err_attr_name = NULL;
-
-                               int fileRet = 0;
-
-                               int trackCount = 0;
-
-                               mm_file_create_content_attrs(&content_attrs, pMedia->szFilePath);
-
-                               fileRet = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_TRACK_COUNT, &trackCount, NULL);
-
-                               if (fileRet != 0) {
-                                       MSG_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
-                                       if (err_attr_name) {
-                                               free(err_attr_name);
-                                               err_attr_name = NULL;
-                                       }
-
-                                       mm_file_destroy_content_attrs(content_attrs);
-
-                                       continue;
-                               }
-
-                               MSG_DEBUG("video track num: %d", trackCount);
-
-                               if (trackCount > 0) {
-                                       int thumbnailWidth = 0;
-                                       int thumbnailHeight = 0;
-                                       int thumbnailSize = 0;
-
-                                       void *thumbnail = NULL;
-
-                                       fileRet = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_WIDTH, &thumbnailWidth,
-                                                                                                                       MM_FILE_CONTENT_VIDEO_HEIGHT, &thumbnailHeight,
-                                                                                                                       MM_FILE_CONTENT_VIDEO_THUMBNAIL, &thumbnail, &thumbnailSize,
-                                                                                                                       NULL);
-
-                                       if (fileRet != 0) {
-                                               MSG_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
-                                               if (err_attr_name) {
-                                                       free(err_attr_name);
-                                                       err_attr_name = NULL;
-                                               }
-
-                                               mm_file_destroy_content_attrs(content_attrs);
-
-                                               continue;
-                                       }
-
-                                       MSG_DEBUG("video width: %d", thumbnailWidth);
-                                       MSG_DEBUG("video height: %d", thumbnailHeight);
-                                       MSG_DEBUG("video thumbnail: %p", thumbnail);
-
-                                       if (thumbnail) {
-                                               char thumbPath[MSG_FILEPATH_LEN_MAX] = {0, };
-
-                                               snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.jpg", szFileName);
-
-                                               fileRet = mm_util_jpeg_encode_to_file (thumbPath, thumbnail, thumbnailWidth, thumbnailHeight, MM_UTIL_JPEG_FMT_RGB888, 70);
-
-                                               if (fileRet != 0) {
-                                                       MSG_DEBUG("mm_util_jpeg_encode_to_file fails [%d]", fileRet);
-
-                                                       mm_file_destroy_content_attrs(content_attrs);
-
-                                                       continue;
-                                               }
-
-                                               memset(pThumbnailPath, 0x00, MSG_FILEPATH_LEN_MAX);
-
-                                               strncpy(pThumbnailPath, thumbPath, MSG_FILEPATH_LEN_MAX);
-
-                                               bThumbnail = true;
-
-                                       }
-
-                                       mm_file_destroy_content_attrs(content_attrs);
-
-                                       break;
-                               }
-
-                               mm_file_destroy_content_attrs(content_attrs);
-                       } else if (pMedia->mediatype == MMS_SMIL_MEDIA_AUDIO) {
-                               MSG_DEBUG("Make thumbnail: %s", "audio");
-
-                               MMHandleType tag_attrs = (MMHandleType)NULL;
-                               char *err_attr_name = NULL;
-                               void *artwork = NULL;
-                               int artworkSize = 0;
-                               int tmpLen = 0;
-                               int fileRet = 0;
-
-                               if (mm_file_create_tag_attrs(&tag_attrs, pMedia->szFilePath) == 0) {
-
-
-                                       fileRet = mm_file_get_attrs(tag_attrs, &err_attr_name, MM_FILE_TAG_ARTWORK, &artwork, &tmpLen,
-                                                                                                               MM_FILE_TAG_ARTWORK_SIZE, &artworkSize,
-                                                                                                               NULL);
-
-                                       mm_file_destroy_tag_attrs(tag_attrs);
-
-                                       if (fileRet != 0) {
-                                               MSG_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
-                                               if (err_attr_name) {
-                                                       free(err_attr_name);
-                                                       err_attr_name = NULL;
-                                               }
-
-                                               continue;
-                                       }
-                               } else {
-                                       MSG_DEBUG("mm_file_create_tag_attrs fails");
-                                       continue;
-                               }
-
-                               MSG_DEBUG("artwork: %p", artwork);
-                               MSG_DEBUG("artwork_size: %d", artworkSize);
-
-                               if (artwork) {
-                                       char thumbPath[MSG_FILEPATH_LEN_MAX] = {0, };
-
-                                       snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.jpg", szFileName);
-
-                                       FILE *tmp = MsgOpenFile(thumbPath, "wb+");
-
-                                       if(!tmp) {
-                                               MSG_DEBUG("MsgOpenFile file error");
-                                               return MSG_ERR_STORAGE_ERROR;
-                                       }
-
-                                       if (MsgWriteFile((char*)artwork, 1, artworkSize, tmp) != (size_t)artworkSize) {
-                                               MSG_DEBUG("MsgWriteFile error");
-                                               MsgCloseFile(tmp);
-                                               return MSG_ERR_STORAGE_ERROR;
-                                       }
-                                       MsgFsync(tmp);
-                                       MsgCloseFile(tmp);
-
-                                       strncpy(pThumbnailPath, thumbPath, MSG_FILEPATH_LEN_MAX);
+       char sqlQuery[MAX_QUERY_LEN + 1];
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-                                       bThumbnail = true;
+       //(MSG_ID INTEGER, TYPE INTEGER, INFO TEXT)
+       snprintf(sqlQuery, sizeof(sqlQuery),
+                       "INSERT INTO %s "
+                       "(MSG_ID, TYPE, VALUE, COUNT)"
+                       "VALUES (%d, %d, '%s', %d);",
+                       MSGFW_MMS_PREVIEW_TABLE_NAME, msgId, type, value, count);
 
-                                       break;
-                               }
-                       }
-               }
+       MSG_DEBUG("QUERY : [%s]", sqlQuery);
 
-               if (bThumbnail == true)
-                       break;
-       }
+       if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS)
+               return MSG_ERR_DB_EXEC;
 
        return MSG_SUCCESS;
 }
 
-
 msg_error_t MmsPluginStorage::addMmsNoti(MSG_MESSAGE_INFO_S *pMsgInfo)
 {
        MSG_BEGIN();
index bff7fc6..15c61af 100755 (executable)
@@ -207,7 +207,7 @@ MmsPluginUaManager *MmsPluginUaManager::instance()
 
 void MmsPluginUaManager::start()
 {
-       bool bStart = true;
+//     bool bStart = true;
 
        MutexLocker lock(mx);
 
@@ -284,7 +284,7 @@ void MmsPluginUaManager::run()
        MmsPluginHttpAgent *httpAgent = MmsPluginHttpAgent::instance();
 
        int trId;
-       CURL *session = NULL;
+//     CURL *session = NULL;
 
        int msgId;
 
@@ -587,7 +587,6 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv
        MSG_BEGIN();
 
        char fileName[MSG_FILENAME_LEN_MAX] = {0};
-       FILE *pFile = NULL;
 
        MSG_DEBUG(":::%d :%s ", rcvdBodyLen, pRcvdBody);
 
diff --git a/plugin/mms_plugin/MmsPluginUtil.cpp b/plugin/mms_plugin/MmsPluginUtil.cpp
new file mode 100755 (executable)
index 0000000..cc83b9f
--- /dev/null
@@ -0,0 +1,339 @@
+/*
+* 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.
+*/
+
+#include <mm_file.h>
+#include <mm_util_jpeg.h>
+#include <mm_util_imgp.h>
+
+#include <media-thumbnail.h>
+
+//----str
+#include <ctype.h>
+
+#include "MsgDebug.h"
+#include "MmsPluginUtil.h"
+
+bool makeImageThumbnail(char *srcPath, char *dstPath)
+{
+       if (srcPath == NULL || dstPath == NULL) {
+               MSG_DEBUG("Make thumbnail: failed [Invalid Parameter]");
+               return false;
+       }
+
+       int err = -1;
+       err = thumbnail_request_save_to_file(srcPath, MEDIA_THUMB_LARGE, dstPath);
+       if (err < 0) {
+               MSG_DEBUG("Make thumbnail: failed");
+               return false;
+       }
+
+       MSG_DEBUG("Make thumbnail: success [%s]", dstPath);
+       return true;
+}
+
+bool makeVideoThumbnail(char *srcPath, char *dstPath)
+{
+       MMHandleType content_attrs = (MMHandleType)NULL;
+       char *err_attr_name = NULL;
+       int fileRet = 0;
+       int trackCount = 0;
+
+       if (srcPath == NULL || dstPath == NULL) {
+               MSG_DEBUG("Make thumbnail: failed [Invalid Parameter]");
+               return false;
+       }
+
+       mm_file_create_content_attrs(&content_attrs, srcPath);
+       fileRet = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_TRACK_COUNT, &trackCount, NULL);
+
+       if (fileRet != 0) {
+               MSG_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
+
+               if (err_attr_name) {
+                       free(err_attr_name);
+                       err_attr_name = NULL;
+               }
+
+               mm_file_destroy_content_attrs(content_attrs);
+
+               return false;
+       }
+
+       MSG_DEBUG("video track num: %d", trackCount);
+
+       if (trackCount <= 0) {
+               mm_file_destroy_content_attrs(content_attrs);
+               return false;
+       }
+
+
+       int thumbnailWidth = 0;
+       int thumbnailHeight = 0;
+       int thumbnailSize = 0;
+       void *thumbnail = NULL;
+
+       fileRet = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_WIDTH, &thumbnailWidth,
+                                                                                                                               MM_FILE_CONTENT_VIDEO_HEIGHT, &thumbnailHeight,
+                                                                                                                               MM_FILE_CONTENT_VIDEO_THUMBNAIL, &thumbnail, &thumbnailSize,
+                                                                                                                               NULL);
+
+       if (fileRet != 0) {
+               MSG_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
+               if (err_attr_name) {
+                       free(err_attr_name);
+                       err_attr_name = NULL;
+               }
+
+               mm_file_destroy_content_attrs(content_attrs);
+               return false;
+       }
+
+       MSG_DEBUG("video width: %d", thumbnailWidth);
+       MSG_DEBUG("video height: %d", thumbnailHeight);
+       MSG_DEBUG("video thumbnail: %p", thumbnail);
+
+       if (thumbnail == NULL) {
+               mm_file_destroy_content_attrs(content_attrs);
+               return false;
+       }
+
+       fileRet = mm_util_jpeg_encode_to_file (dstPath, thumbnail, thumbnailWidth, thumbnailHeight, MM_UTIL_JPEG_FMT_RGB888, 70);
+       if (fileRet != 0) {
+               MSG_DEBUG("mm_util_jpeg_encode_to_file fails [%d]", fileRet);
+               mm_file_destroy_content_attrs(content_attrs);
+               return false;
+       }
+
+       MSG_DEBUG("Make thumbnail: success [%s]", dstPath);
+       mm_file_destroy_content_attrs(content_attrs);
+       return true;
+}
+
+//----------------------------------------------------------------------
+bool MsgIsASCII(char *pszText)
+{
+       int length = strlen(pszText);
+
+       for (int i = 0; i < length; ++i) {
+               if (!isascii(pszText[i])) {
+                       MSG_DEBUG("_MsgIsASCII false.");
+                       return false;
+               }
+       }
+
+       MSG_DEBUG("_MsgIsASCII true.");
+       return true;
+}
+
+
+bool MsgReplaceNonAscii(char *szInText, char **szOutText, char replaceChar)
+{
+       MSG_DEBUG("_MsgReplaceNonAscii");
+       int nCount = 0;
+       int index = 0;
+       int cLen = 0;
+       char *pNew = NULL;
+
+       cLen = strlen(szInText);
+
+       pNew = (char *)malloc(cLen + 1);
+
+       if (pNew == NULL)
+               return false;
+
+       memset(pNew, 0, cLen + 1);
+
+       while (*(szInText+nCount) != '\0') {
+               if (0x0001 <= *(szInText+nCount) && *(szInText+nCount) <= 0x007F) {
+                       MSG_DEBUG("_MsgReplaceNonAscii: non ascii characters (1bytes). \n");
+                       pNew[index] = szInText[nCount];
+                       nCount += 1;
+                       index += 1;
+               } else {
+                       MSG_DEBUG("_MsgReplaceNonAscii: UTF-8 characters (2bytes). \n");
+                       pNew[index] = replaceChar;
+                       nCount += 1;
+                       index +=1;
+               }
+       }
+
+       *szOutText = pNew;
+       return true;
+}
+
+bool MsgIsSpace(char *pszText)
+{
+       MSG_DEBUG("_MsgIsSpace");
+       if (!pszText) {
+               MSG_DEBUG("_MsgIsSpace: pszText == NULL!\n");
+               return false;
+       }
+
+       if (strchr(pszText, ' ') != NULL)
+               return true;
+       else
+               return false;
+}
+
+bool MsgReplaceSpecialChar(char *szInText, char **szOutText, char specialChar)
+{
+       MSG_DEBUG("_MsgReplaceSpecialChar");
+       char *pszOutText = NULL;
+       char szBuf[10] = {0, };
+       char temp[5] = {0, };
+       int cLen = 0;
+       int i = 0;
+
+       if (!szInText) {
+               MSG_DEBUG("_MsgReplaceSpecialChar: szInText == NULL! \n");
+               return false;
+       }
+
+       if (!szOutText)
+               return false;
+
+       cLen = strlen(szInText);
+
+       if (specialChar == ' ') {
+               if ((pszOutText = (char *)malloc(cLen + 1)) == NULL) {
+                       MSG_DEBUG("_MsgReplaceSpecialChar : %d line. MemAlloc failed.\n", __LINE__);
+                       return false;
+               }
+               memset(pszOutText, 0, cLen + 1);
+
+               *szOutText = pszOutText;
+       }
+
+       for (i = 0; i<cLen; i++) {
+               switch (specialChar) {
+               // changed space to '_'
+               case ' ':
+                       pszOutText[i] = (szInText[i] == specialChar) ? '_' : szInText[i];
+                       break;
+
+               default:
+                       if (szInText[i] != specialChar) {
+                               temp[0] = szInText[i];
+                               *szOutText = MsgStrAppend(*szOutText, temp);
+                               continue;
+                       } else {
+                               MsgConvertCharToHex(specialChar, szBuf);
+                               *szOutText = MsgStrAppend(*szOutText, (char *)"%");
+                               *szOutText = MsgStrAppend(*szOutText, szBuf);
+                       }
+                       break;
+               }
+       }
+
+       MSG_DEBUG("_MsgReplaceSpecialChar : output text : [%s]\n", pszOutText);
+
+       return true;
+}
+
+char *MsgStrAppend(char *szInputStr1, char *szInputStr2)
+{
+       MSG_DEBUG("MsgStrAppend");
+       char *szOutputStr = NULL;
+
+       if (szInputStr1 == NULL) {
+               szOutputStr = MsgStrCopy(szInputStr2);
+       } else {
+               int length1 = 0;
+               int length2 = 0;
+               length1 = MsgStrlen(szInputStr1);
+               length2 = MsgStrlen(szInputStr2);
+
+               szOutputStr = (char *)malloc(length1 + length2 + 1);
+
+               if (szOutputStr == NULL)
+                       goto __CATCH;
+
+               memset(szOutputStr, 0, length1 + length2 + 1);
+
+               strncpy(szOutputStr, szInputStr1, length1);
+
+               if (length2 > 0)
+                       strcat(szOutputStr, szInputStr2);
+
+               free(szInputStr1);
+               szInputStr1 = NULL;
+       }
+
+       return szOutputStr;
+
+__CATCH:
+       return NULL;
+}
+
+char *MsgStrCopy(const char *string)
+{
+       char *pDst = NULL;
+
+       if (string) {
+               pDst = (char *)malloc(1 + strlen(string));
+               if (pDst == NULL) {
+                       MSG_DEBUG("MsgStrCopy: pDst MemAlloc Fail \n");
+                       return NULL;
+               }
+
+               memset(pDst, 0, strlen(string) + 1);
+
+               strcpy(pDst,string);
+
+               return pDst;
+       }
+
+       return NULL;
+}
+
+char *MsgStrNCopy(const char *string, int length)
+{
+       char *pDst = NULL;
+
+       if (string) {
+               pDst = (char *)malloc(1 + length);
+               if (pDst == NULL) {
+                       MSG_DEBUG("MsgStrNCopy: pDst MemAlloc Fail \n");
+                       return NULL;
+               }
+
+               memset(pDst, 0, length + 1);
+               strncpy(pDst,string, length);
+
+               return pDst;
+       }
+
+       return NULL;
+}
+
+int MsgStrlen(char * pStr)
+{
+       if (pStr == NULL)
+               return 0;
+
+       return strlen(pStr);
+}
+
+bool MsgConvertCharToHex(char pSrc, char *pDest)
+{
+       static unsigned char saucHex[] = "0123456789ABCDEF";
+
+       pDest[0] = saucHex[pSrc >> 4];
+       pDest[1] = saucHex[pSrc & 0xF];
+       pDest[2] = 0;
+
+       return true;
+}
index a6613a5..e3078b0 100755 (executable)
@@ -27,39 +27,6 @@ const char *MmsDebugGetRetrieveStatus(MmsRetrieveStatus retrieveStatus);
 const char *MmsDebugGetMsgStatus(msg_delivery_report_status_t msgStatus);
 const char *MmsDebugGetMsgClass(MmsMsgClass msgClass);
 const char *MmsDebugGetDataType(MmsDataType dataType);
-#ifdef MMS_PLUGIN_DEBUG_ENABLE
-bool MmsDebugPrintMsgAttributes(char *pszFunc, MmsAttrib *pAttrib, bool bAll);
-char *MmsDebugGetMsgDrmType(MsgDrmType drmType);
-char *MmsDebugGetDrmDeliveryMode(DrmDeliveryMode deliveryMode);
-char *MmsDebugGetDrmRightState(DrmRightState rightState);
-bool MmsDebugPrintDrmRight(DrmRight *pDrmRight);
-char *MmsDebugPrintMsgDRMStatus(MsgDRMStatus status);
-bool MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index);
-char *DebugPrintGetRmResultInd(MmsRmResultInd indType);
-char *DebugPrintHttpStatusCode(int status);
-char *DebugPrintRmMethodType(MmsRmMethodType method);
-char *DebugPrintGetMmsRmNetState(MmsRmNetState state);
-char *DebugPrintGetMmsRmEntityState(MmsRmExEntityState stateEx);
-char *MmsDebugPrintMmsRmResult(MmsRmResult result);
-void MmsDebugPrintReqEntityInfo(MmsRmRequest *pEntity);
-char *MmsDebugPrintHttpErrorCode(int errCode);
-char *MmsDebugPrintProtoErrorCode(int errCode);
-char *DebugPrintWspResult(WspResult wspResult);
-char *DebugPrintWspState(MmsRmWapState wspState);
-char *MmsDebugPrintRmPduType(MmsRmPduType pduType);
-char *MmsDebugPrintMailboxType(MsgMailboxType mailboxType);
-#endif
-
-typedef enum {
-       MMS_DEBUG_EV_NONE,
-       MMS_DEBUG_EV_MMS,
-       MMS_DEBUG_EV_SMS,
-       MMS_DEBUG_EV_COMMON,
-       MMS_DEBUG_EV_EMAIL
-
-} MmsDebugEvType;
-
-bool MmsDebugPrintCurrentEventHandler(char *pszFunc, MmsDebugEvType evType);
 
 #endif //MMS_PLUGIN_DEBUG_H
 
index 2969908..5f2f61a 100755 (executable)
@@ -539,22 +539,12 @@ MmsMsgMultiStatus *MmsComposeDeliveryIndMessage(MmsMsg *pMmsMsg, msg_message_id_
 void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, msg_message_id_t selectedMsgId);
 MmsMsgMultiStatus *MmsGetMultiStatus(msg_message_id_t msgId);
 int MmsSearchMsgId(char *toNumber, char *szMsgID);
-void MmsUpdateDeliveryReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus);
-void MmsUpdateReadReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus);
 MsgMultipart *MmsAllocMultipart(void);
-bool _MsgIsASCII(char *pszText);
-bool _MsgReplaceNonAscii(char *szInText, char **szOutText, char replaceChar);
-bool _MsgIsSpace(char *pszText);
-bool _MsgReplaceSpecialChar(char *szInText, char **szOutText, char specialChar);
-char *MsgStrAppend(char *szInputStr1, char *szInputStr2);
-char *MsgStrCopy(const char *string);
-char *MsgStrNCopy(const char *string, int length);
-int    MsgStrlen(char *pStr);
-bool _MsgConvertCharToHex(char pSrc, char *pDest);
 msg_error_t MmsAddAttachment(MMS_MESSAGE_DATA_S *pMsgData, MMS_MEDIA_S *pMedia);
 bool MmsCheckAdditionalMedia(MMS_MESSAGE_DATA_S *pMsgData, MsgType *partHeader);
 #ifdef __SUPPORT_DRM__
 bool __MsgInitMsgDRMInfo(MsgDRMInfo *pMsgDrmInfo);
 #endif
 
+msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg);
 #endif
index 792cc42..02bf1f6 100755 (executable)
@@ -43,20 +43,23 @@ public:
        void composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo);
 
        int searchMsgId(char *toNumber, char *szMsgID);
-       int     getMmsVersion(msg_message_id_t selectedMsgId);
+       int getMmsVersion(msg_message_id_t selectedMsgId);
 
-       msg_error_t     updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
-       msg_error_t     updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
-       msg_error_t     updateMmsAttrib(msg_message_id_t msgId, MmsAttrib *attrib, MSG_SUB_TYPE_T msgSubType);
+       msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
+       msg_error_t updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
+       msg_error_t updateMmsAttrib(msg_message_id_t msgId, MmsAttrib *attrib, MSG_SUB_TYPE_T msgSubType);
        msg_error_t updateMmsAttachCount(msg_message_id_t msgId, int count);
-       msg_error_t     updateNetStatus(msg_message_id_t msgId, msg_network_status_t netStatus);
-       msg_error_t updateDeliveryReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus);
-       msg_error_t     updateReadReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus);
-       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);
+       msg_error_t updateNetStatus(msg_message_id_t msgId, msg_network_status_t netStatus);
+
+       msg_error_t insertDeliveryReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
+       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 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);
        msg_error_t getMmsRawFilePath(msg_message_id_t msgId, char *pFilepath);
-       msg_error_t     plgGetRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg, char *filePath);
+       msg_error_t plgGetRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg, char *filePath);
        /* reject_msg_support */
        msg_error_t getTrID(MSG_MESSAGE_INFO_S *pMsgInfo, char *pszTrID, int nBufferLen);
        /* reject_msg_support */
@@ -64,8 +67,7 @@ public:
        msg_error_t updateMsgServerID(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo);
 
        MmsMsgMultiStatus *getMultiStatus(msg_message_id_t msgId);
-       msg_error_t     getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsgText);
-       msg_error_t     makeThumbnail(MMS_MESSAGE_DATA_S *pMmsMsg, char *pThumbnailPath, char *szFileName);
+       msg_error_t getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsgText);
        msg_error_t addMmsNoti(MSG_MESSAGE_INFO_S *pMsgInfo);
 
 private:
index ed7f08e..ec64e29 100755 (executable)
@@ -62,6 +62,4 @@ class MmsPluginUaManager: public MsgThread
                MsgThdSafeQ <mmsTranQEntity> mmsTranQ; // transaction q for mms plugin
 };
 
-bool MsgOpenCreateAndOverwriteFile(char *szFullPath, char *szBuff, int totalLength);
-
 #endif // MMSPLUGINUSERAGENT_H
diff --git a/plugin/mms_plugin/include/MmsPluginUtil.h b/plugin/mms_plugin/include/MmsPluginUtil.h
new file mode 100755 (executable)
index 0000000..1aa0d6d
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+* 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.
+*/
+
+#ifndef MMS_PLUGIN_UTIL_H
+#define MMS_PLUGIN_UTIL_H
+
+/*==================================================================================================
+                                                       INCLUDE FILES
+==================================================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+bool makeImageThumbnail(char *srcPath, char *dstPath);
+bool makeVideoThumbnail(char *srcPath, char *dstPath);
+
+bool MsgIsASCII(char *pszText);
+bool MsgReplaceNonAscii(char *szInText, char **szOutText, char replaceChar);
+bool MsgIsSpace(char *pszText);
+bool MsgReplaceSpecialChar(char *szInText, char **szOutText, char specialChar);
+char *MsgStrAppend(char *szInputStr1, char *szInputStr2);
+char *MsgStrCopy(const char *string);
+char *MsgStrNCopy(const char *string, int length);
+int    MsgStrlen(char *pStr);
+bool MsgConvertCharToHex(char pSrc, char *pDest);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif //MMS_PLUGIN_UTIL_H
+
index 468b4e8..564488c 100755 (executable)
@@ -15,7 +15,6 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall")
 ##########################################################
 
 SET(SMS-PLUGIN-SRCS
-       ${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginTextConvert.cpp
        ${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginUDCodec.cpp
        ${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginParamCodec.cpp
        ${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginTpduCodec.cpp
index a11a027..9029f2b 100755 (executable)
@@ -26,6 +26,7 @@
 #include "SmsPluginSatHandler.h"
 #include "SmsPluginParamCodec.h"
 #include "SmsPluginTpduCodec.h"
+#include "SmsPluginTransport.h"
 #include "SmsPluginSimMsg.h"
 #include "SmsPluginSetting.h"
 #include "MsgGconfWrapper.h"
@@ -36,9 +37,9 @@ extern struct tapi_handle *pTapiHandle;
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
-void TapiEventDeviceReady(TapiHandle *handle, int result, void *data, void *user_data)
+void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
 {
-       MSG_DEBUG("TapiEventDeviceReady is called. : result = [%d]", result);
+       MSG_DEBUG("TapiEventDeviceReady is called. : noti_id = [%d]", noti_id);
 
        try
        {
@@ -291,6 +292,12 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
 
        if (tpdu.tpduType == SMS_TPDU_DELIVER)
        {
+               if (tpdu.data.deliver.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.deliver.pid == 0x11) {
+                       MSG_DEBUG("Unsupported message!!");
+                       SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+                       return;
+               }
+
                MSG_DEBUG("headerCnt [%d]", tpdu.data.deliver.userData.headerCnt);
 
                for (int i = 0; i < tpdu.data.deliver.userData.headerCnt; i++)
@@ -306,6 +313,12 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
        }
        else if (tpdu.tpduType == SMS_TPDU_SUBMIT)
        {
+               if (tpdu.data.submit.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.submit.pid == 0x11) {
+                       MSG_DEBUG("Unsupported message!!");
+                       SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+                       return;
+               }
+
                MSG_DEBUG("headerCnt [%d]", tpdu.data.submit.userData.headerCnt);
 
                for (int i = 0; i < tpdu.data.submit.userData.headerCnt; i++)
@@ -668,9 +681,80 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
        }
 
        SmsPluginSetting::instance()->setCbConfigEvent(&cbOpt, true);
+}
 
+void TapiEventSetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data)
+{
+       MSG_DEBUG("TapiEventSetMailboxInfo is called.");
 }
 
+void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data)
+{
+#if 0 // New TAPI
+       MSG_DEBUG("TapiEventGetMailboxInfo is called.");
+
+       if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL)
+       {
+               MSG_DEBUG("Error. data is NULL.");
+               SmsPluginSetting::instance()->setMailboxInfoEvent(NULL, false);
+
+               return;
+       }
+
+       TelSimMailboxList_t *list = (TelSimMailboxList_t *)data;
+       SMS_SIM_MAILBOX_LIST_S mbList = {0,};
+
+       if (list->count <= 0) {
+               SmsPluginSetting::instance()->setMailboxInfoEvent(NULL, true);
+               return;
+       }
+
+       mbList.count = list->count;
+
+       for (int i = 0; i < mbList.count; i++) {
+               mbList.list[i].b_cphs = list->list[i].b_cphs;
+               mbList.list[i].alpha_id_max_len = list->list[i].alpha_id_max_len;
+               mbList.list[i].mb_type = list->list[i].mb_type;
+               mbList.list[i].profile_num = list->list[i].profile_num;
+               mbList.list[i].rec_index = list->list[i].rec_index;
+               mbList.list[i].ton = list->list[i].ton;
+               mbList.list[i].npi = list->list[i].npi;
+               snprintf(mbList.list[i].alpha_id, sizeof(mbList.list[i].alpha_id), "%s", list->list[i].alpha_id);
+               snprintf(mbList.list[i].num, sizeof(mbList.list[i].num), "%s", list->list[i].num);
+               mbList.list[i].cc_id = list->list[i].cc_id;
+               mbList.list[i].ext1_id = list->list[i].ext1_id;
+       }
+
+       SmsPluginSetting::instance()->setMailboxInfoEvent(&mbList, true);
+#endif
+}
+
+void TapiEventSetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
+{
+       MSG_DEBUG("TapiEventSetMwiInfo is called.");
+}
+
+void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
+{
+#if 0 // New TAPI
+       MSG_DEBUG("TapiEventGetMwiInfo is called.");
+
+       if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL)
+       {
+               MSG_DEBUG("Error. data is NULL.");
+               SmsPluginSetting::instance()->setMwiInfoEvent(NULL, false);
+
+               return;
+       }
+
+       TelSimMessageWaitingResp_t *MwiInfo = (TelSimMessageWaitingResp_t *)data;
+       SMS_SIM_MWI_INFO_S simMwiInfo = {0,};
+
+       memcpy(&simMwiInfo, MwiInfo, sizeof(SMS_SIM_MWI_INFO_S));
+
+       SmsPluginSetting::instance()->setMwiInfoEvent(&simMwiInfo, true);
+#endif
+}
 
 void TapiEventSatSmsRefresh(TapiHandle *handle, int result, void *data, void *user_data)
 {
@@ -717,7 +801,6 @@ void TapiEventSatSendSms(TapiHandle *handle, const char *noti_id, void *data, vo
 
 }
 
-
 void TapiEventSatMoSmsCtrl(TapiHandle *handle, int result, void *data, void *user_data)
 {
        MSG_DEBUG("TapiEventSatMoSmsCtrl is called.");
@@ -740,6 +823,27 @@ void TapiEventSatMoSmsCtrl(TapiHandle *handle, int result, void *data, void *use
 
 }
 
+void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data)
+{
+       MSG_DEBUG("Tapi result is [%d]", result);
+}
+
+void TapiEventSetMsgStatus(TapiHandle *handle, int result, void *data, void *user_data)
+{
+       MSG_DEBUG("TapiEventSetMsgStatus is called. result [%d]", result);
+
+       if (result != TAPI_API_SUCCESS || data == NULL)
+       {
+               MSG_DEBUG("Error. data is NULL.");
+               SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)0, false);
+               return;
+       }
+
+       msg_sim_id_t sim_id = *((msg_sim_id_t *)user_data);
+
+       SmsPluginSimMsg::instance()->setSimEvent(sim_id, true);
+}
+
 /*==================================================================================================
                                      IMPLEMENTATION OF SmsPluginCallback - Member Functions
 ==================================================================================================*/
@@ -774,8 +878,7 @@ SmsPluginCallback* SmsPluginCallback::instance()
 
 void SmsPluginCallback::registerEvent()
 {
-       unsigned int tempId = 0;
-
+       tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_DEVICE_READY, TapiEventDeviceReady, NULL);
        tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_INCOM_MSG, TapiEventMsgIncoming, NULL);
        tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_CB_INCOM_MSG, TapiEventCbMsgIncoming, NULL);
        tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_ETWS_INCOM_MSG, TapiEventEtwsMsgIncoming, NULL);
index 16ea14e..a189038 100755 (executable)
@@ -21,7 +21,6 @@
 #include "MsgException.h"
 #include "MsgGconfWrapper.h"
 #include "MsgUtilFile.h"
-#include "SmsPluginTextConvert.h"
 #include "SmsPluginUDCodec.h"
 #include "SmsPluginStorage.h"
 #include "SmsPluginEventHandler.h"
@@ -121,17 +120,9 @@ void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
                        cbOutMsg.dcs = CbMsgPage.pageHeader.dcs.rawData;
                        memset (cbOutMsg.cbText, 0x00, sizeof(cbOutMsg.cbText));
 
-                       SMS_LANG_INFO_S langInfo = {0};
-
-                       langInfo.bSingleShift = false;
-                       langInfo.bLockingShift = false;
-
-                       if (cbMsg.codingScheme == SMS_CHARSET_7BIT)
-                               cbOutMsg.cbTextLen = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), (unsigned char*)cbMsg.msgData, cbMsg.msgLength, &langInfo);
-                       else if (cbMsg.codingScheme == SMS_CHARSET_UCS2)
-                               cbOutMsg.cbTextLen = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), (unsigned char*)cbMsg.msgData, cbMsg.msgLength);
-
-
+                       cbOutMsg.cbTextLen= convertTextToUtf8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), &cbMsg);
+                       memset(cbOutMsg.language_type, 0x00, sizeof(cbOutMsg.language_type));
+                       memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3);
                        err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg);
                        if (err != MSG_SUCCESS)
                        {
@@ -227,7 +218,7 @@ MSG_DEBUG("Total Page : [%d], Page : [%d]", pCbPage->pageHeader.totalPages, pCbP
        convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
 
 MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
-
+MSG_DEBUG("iso639Lang : [%s]", pCbPage->pageHeader.dcs.iso639Lang);
        // Get Receive Time
        pCbPage->pageHeader.recvTime = getRecvTime();
 
@@ -243,16 +234,21 @@ MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHead
                        dataLen = (dataLen*8) / 7;
 
                        SmsPluginUDCodec udCodec;
-                       int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pCbPage->pageData);
+                       char pageData[MAX_CBMSG_PAGE_SIZE+1];
+                       int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pageData);
+
+                       if(pCbPage->pageHeader.dcs.iso639Lang[0])
+                       {
+                               unpackLen = unpackLen - 3;
+                               memcpy(pCbPage->pageData, &pageData[3], unpackLen);
+                       } else {
+                               memcpy(pCbPage->pageData, &pageData, unpackLen);
+                       }
 
-MSG_DEBUG("dataLen : [%d]", dataLen);
-MSG_DEBUG("unpackLen : [%d]", unpackLen);
+                       MSG_DEBUG("unpackLen : [%d]", unpackLen);
 
                        pCbPage->pageLength = unpackLen;
                        pCbPage->pageData[unpackLen] = '\0';
-
-//                     pCbPage->pageLength = strlen(pCbPage->pageData);
-//                     pCbPage->pageData[pCbPage->pageLength] = '\0';
                }
                break;
 
@@ -261,11 +257,14 @@ MSG_DEBUG("unpackLen : [%d]", unpackLen);
                {
                        MSG_DEBUG("UCS2");
 
-                       memcpy(pCbPage->pageData, &cbData[6], dataLen);
-
-                       pCbPage->pageLength = strlen(pCbPage->pageData);
-
-                       pCbPage->pageData[pCbPage->pageLength] = '\0';
+                       if(pCbPage->pageHeader.dcs.iso639Lang[0])
+                       {
+                               memcpy(pCbPage->pageData, &cbData[8], dataLen - 2);
+                               pCbPage->pageLength = dataLen - 2;
+                       } else {
+                               memcpy(pCbPage->pageData, &cbData[6], dataLen);
+                               pCbPage->pageLength = dataLen;
+                       }
                }
                break;
        }
@@ -633,16 +632,8 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S cbMsg, MSG_MESSAGE
 
        MSG_DEBUG("LENGTH %d CB MSG %s", cbMsg.msgLength, cbMsg.msgData);
 
-       SMS_LANG_INFO_S langInfo = {0};
-
-       langInfo.bSingleShift = false;
-       langInfo.bLockingShift = false;
-
        // Convert Data values
-       if (cbMsg.codingScheme == SMS_CHARSET_7BIT)
-               pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)cbMsg.msgData, cbMsg.msgLength, &langInfo);
-       else if (cbMsg.codingScheme == SMS_CHARSET_UCS2)
-               pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)cbMsg.msgData, cbMsg.msgLength);
+       pMsgInfo->dataSize = convertTextToUtf8((unsigned char*)tmpBuf, bufSize, &cbMsg);
 
        if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN)
        {
@@ -712,6 +703,30 @@ void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S EtwsMsg, MS
        memcpy(pMsgInfo->msgData, EtwsMsg.pageData, pMsgInfo->dataSize);
 }
 
+int SmsPluginCbMsgHandler::convertTextToUtf8 (unsigned char* outBuf, int outBufSize, SMS_CBMSG_S* pCbMsg)
+{
+       int     convertedTextSize = 0;
+       MSG_LANG_INFO_S langInfo = {0,};
+
+       if (!outBuf || !pCbMsg)
+       {
+               MSG_DEBUG ("invalid param.\n");
+               return 0;
+       }
+
+       langInfo.bSingleShift = false;
+       langInfo.bLockingShift = false;
+
+
+       // Convert Data values
+       if (pCbMsg->codingScheme == SMS_CHARSET_7BIT)
+               convertedTextSize = textCvt.convertGSM7bitToUTF8(outBuf, outBufSize, (unsigned char*)pCbMsg->msgData, pCbMsg->msgLength, &langInfo);
+       else if (pCbMsg->codingScheme == SMS_CHARSET_UCS2)
+               convertedTextSize = textCvt.convertUCS2ToUTF8(outBuf, outBufSize, (unsigned char*)pCbMsg->msgData, pCbMsg->msgLength);
+
+       return convertedTextSize;
+}
+
 void SmsPluginCbMsgHandler::addToPageLiat(SMS_CBMSG_PAGE_S CbPage)
 {
        CB_PAGE_INFO_S tmpInfo;
@@ -796,10 +811,10 @@ void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned
                                }
                                else
                                {
-                                       /* Default it to English if pMsgData is NULL */
-                                       pDcs->iso639Lang[0] = 0x45;  /* E */
-                                       pDcs->iso639Lang[1] = 0x4E;  /* N */
-                                       pDcs->iso639Lang[2] = 0x13;  /* CR */
+                                       /* Default it to English if pMsgData is NULL */
+                                       pDcs->iso639Lang[0] = 0x45;  /* E */
+                                       pDcs->iso639Lang[1] = 0x4E;  /* N */
+                                       pDcs->iso639Lang[2] = 0x13;  /* CR */
                                }
                        }
                }
index a19fbd4..502c526 100755 (executable)
@@ -17,7 +17,6 @@
 #include "MsgDebug.h"
 #include "MsgCppTypes.h"
 #include "MsgUtilFile.h"
-#include "SmsPluginTextConvert.h"
 #include "SmsPluginStorage.h"
 #include "SmsPluginTransport.h"
 #include "SmsPluginEventHandler.h"
@@ -96,11 +95,12 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu)
                        memcpy(&(msg.originAddress), &(pTpdu->data.deliver.originAddress), sizeof(SMS_ADDRESS_S));
                        memcpy(&(msg.dcs), &(pTpdu->data.deliver.dcs), sizeof(SMS_DCS_S));
 
+#if 0
                        if (msg.totalSeg > MAX_SEGMENT_NUM) {
                                MSG_DEBUG("Total Segment Count is over Maximum [%d]", msg.totalSeg);
                                return;
                        }
-
+#endif
                        /**  check noneConcatTypeHeader */
                        noneConcatTypeHeader = false;
 
@@ -113,11 +113,12 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu)
                        memcpy(&(msg.timeStamp.time.absolute), &(pTpdu->data.deliver.timeStamp.time.absolute), sizeof(SMS_TIME_ABS_S));
                        memcpy(&(msg.originAddress), &(pTpdu->data.deliver.originAddress), sizeof(SMS_ADDRESS_S));
                        memcpy(&(msg.dcs), &(pTpdu->data.deliver.dcs), sizeof(SMS_DCS_S));
-
+#if 0
                        if (msg.totalSeg > MAX_SEGMENT_NUM) {
                                MSG_DEBUG("Total Segment Count is over Maximum [%d]", msg.totalSeg);
                                return;
                        }
+#endif
 
                        /**  check noneConcatTypeHeader */
                        noneConcatTypeHeader = false;
@@ -349,20 +350,20 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
 
        /** Convert Data values */
        if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) {
-               SMS_LANG_INFO_S langInfo = {0};
+               MSG_LANG_INFO_S langInfo = {0,};
 
                langInfo.bSingleShift = false;
                langInfo.bLockingShift = false;
 
                pMsgInfo->encodeType = MSG_ENCODE_GSM7BIT;
-               pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize, &langInfo);
+               pMsgInfo->dataSize = textCvt.convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize, &langInfo);
        } else if (pTpdu->dcs.codingScheme == SMS_CHARSET_8BIT) {
                pMsgInfo->encodeType = MSG_ENCODE_8BIT;
                memcpy(tmpBuf, pUserData, DataSize);
                pMsgInfo->dataSize = DataSize;
        } else if (pTpdu->dcs.codingScheme == SMS_CHARSET_UCS2) {
                pMsgInfo->encodeType = MSG_ENCODE_UCS2;
-               pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize);
+               pMsgInfo->dataSize = textCvt.convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize);
        }
 
        MSG_DEBUG("Data Size [%d]", pMsgInfo->dataSize);
index f5b5f24..3a1437e 100755 (executable)
 #include "MsgDebug.h"
 #include "MsgUtilFile.h"
 #include "MsgGconfWrapper.h"
-#include "SmsPluginTextConvert.h"
 #include "SmsPluginTransport.h"
 #include "SmsPluginSimMsg.h"
 #include "SmsPluginStorage.h"
+#include "SmsPluginSetting.h"
 #include "SmsPluginConcatHandler.h"
 #include "SmsPluginEventHandler.h"
 
@@ -110,6 +110,15 @@ void SmsPluginEventHandler::handleMsgIncoming(SMS_TPDU_S *pTpdu)
        /** initialize msgInfo */
        memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
 
+       /** check unsupported message */
+       if (pTpdu->tpduType == SMS_TPDU_DELIVER) {
+               if (pTpdu->data.deliver.dcs.codingScheme == SMS_CHARSET_8BIT && pTpdu->data.deliver.pid == 0x11) {
+                       MSG_DEBUG("Unsupported message!!");
+                       SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
+                       return;
+               }
+       }
+
        /** convert to msgInfo */
        convertTpduToMsginfo(pTpdu, &msgInfo);
 
@@ -363,20 +372,22 @@ void SmsPluginEventHandler::convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu
 
        /** Convert Data values */
        if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) {
-               SMS_LANG_INFO_S langInfo = {0};
+               MSG_LANG_INFO_S langInfo = {0,};
 
                langInfo.bSingleShift = false;
                langInfo.bLockingShift = false;
 
-               msgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
+               msgInfo->dataSize = textCvt.convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
        } else if (pTpdu->dcs.codingScheme == SMS_CHARSET_UCS2) {
-               msgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
+               msgInfo->dataSize = textCvt.convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
        }
 }
 
 
 void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo)
 {
+       MSG_BEGIN();
+
        /** Convert Type  values */
        msgInfo->msgType.mainType = MSG_SMS_TYPE;
        msgInfo->msgType.subType = convertMsgSubType(pTpdu->pid);
@@ -403,6 +414,7 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
                        break;
                default:
                        msgInfo->msgType.classType = MSG_CLASS_NONE;
+                       break;
        }
 
        if (pTpdu->dcs.bMWI) {
@@ -443,13 +455,30 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
                        msgInfo->msgPort.srcPort = pTpdu->userData.header[i].udh.appPort16bit.originPort;
                } else if (pTpdu->userData.header[i].udhType == SMS_UDH_SPECIAL_SMS) {
                        msgInfo->msgType.subType = (pTpdu->userData.header[i].udh.specialInd.msgInd+MSG_MWI_VOICE_SMS);
+                       msgInfo->bStore = pTpdu->userData.header[i].udh.specialInd.bStore;
+
+                       if (pTpdu->userData.header[i].udh.specialInd.waitMsgNum > 0) {
+                               SmsPluginSetting::instance()->setMwiInfo(msgInfo->msgType.subType, pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+                       }
 
                        if (pTpdu->userData.length == 0) {
-                               sprintf(msgInfo->msgText,"[MWI Message] Total %d Message is waiting.", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+                               switch (msgInfo->msgType.subType) {
+                               case MSG_MWI_VOICE_SMS :
+                                       sprintf(msgInfo->msgText, "%d new voice message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+                                       break;
+                               case MSG_MWI_FAX_SMS :
+                                       sprintf(msgInfo->msgText, "%d new fax message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+                                       break;
+                               case MSG_MWI_EMAIL_SMS :
+                                       sprintf(msgInfo->msgText, "%d new email message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+                                       break;
+                               default :
+                                       sprintf(msgInfo->msgText, "%d new special message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+                                       break;
+                               }
                                msgInfo->dataSize = strlen(msgInfo->msgText);
                                return;
                        }
-
                } else if (pTpdu->userData.header[i].udhType == SMS_UDH_ALTERNATE_REPLY_ADDRESS) {
                        strncpy(msgInfo->addressList[0].addressVal, pTpdu->userData.header[i].udh.alternateAddress.address, MAX_ADDRESS_VAL_LEN);
                }
@@ -484,7 +513,7 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
 
        /** Convert Data values */
        if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) {
-               SMS_LANG_INFO_S langInfo = {0};
+               MSG_LANG_INFO_S langInfo = {0,};
 
                langInfo.bSingleShift = false;
                langInfo.bLockingShift = false;
@@ -500,19 +529,21 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
                }
 
                msgInfo->encodeType = MSG_ENCODE_GSM7BIT;
-               msgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
+               msgInfo->dataSize = textCvt.convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
        } else if (pTpdu->dcs.codingScheme == SMS_CHARSET_8BIT) {
                msgInfo->encodeType = MSG_ENCODE_8BIT;
                memcpy(msgInfo->msgText, pTpdu->userData.data, pTpdu->userData.length);
                msgInfo->dataSize = pTpdu->userData.length;
        } else if (pTpdu->dcs.codingScheme == SMS_CHARSET_UCS2) {
                msgInfo->encodeType = MSG_ENCODE_UCS2;
-               msgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
+               msgInfo->dataSize = textCvt.convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
        } else if (pTpdu->dcs.codingScheme == SMS_CHARSET_EUCKR) {
                msgInfo->encodeType = MSG_ENCODE_8BIT;
-               msgInfo->dataSize = SmsPluginTextConvert::instance()->convertEUCKRToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
+               msgInfo->dataSize = textCvt.convertEUCKRToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
                return;
        }
+
+       MSG_END();
 }
 
 
@@ -658,7 +689,7 @@ bool SmsPluginEventHandler::getDeviceStatus()
 
        mx.lock();
 
-       ret = cv.timedwait(mx.pMutex(), 10);
+       ret = cv.timedwait(mx.pMutex(), 16);
 
        mx.unlock();
 
index d405b7e..bbe9fc5 100755 (executable)
@@ -246,7 +246,8 @@ msg_error_t SmsPlgCheckSimStatus(MSG_SIM_STATUS_T *pStatus)
        if (*pStatus != MSG_SIM_STATUS_NOT_FOUND)
        {
                // Get IMSI
-               TelSimImsiInfo_t imsiInfo = {0};
+               TelSimImsiInfo_t imsiInfo;
+               memset(&imsiInfo, 0x00, sizeof(TelSimImsiInfo_t));
 
                tapiRet = tel_get_sim_imsi(pTapiHandle, &imsiInfo);
 
@@ -283,26 +284,23 @@ msg_error_t SmsPlgCheckDeviceStatus()
 
        tapiRet = tel_check_sms_device_status(pTapiHandle, &status);
 
-       if (tapiRet != TAPI_API_SUCCESS)
-       {
+       if (tapiRet != TAPI_API_SUCCESS) {
                MSG_DEBUG("tel_check_sms_device_status() Error! [%d], Status [%d]", tapiRet, status);
-
                return MSG_ERR_PLUGIN_TAPI_FAILED;
        }
 
-       if (status == 1)
-       {
+       if (status == 1) {
                MSG_DEBUG("Device Is Ready");
                return MSG_SUCCESS;
-       }
-       else if (status == 0)
-       {
+       } else if (status == 0) {
                MSG_DEBUG("Device Is Not Ready.. Waiting For Ready Callback");
 
-               if (SmsPluginEventHandler::instance()->getDeviceStatus() == true)
-               {
+               if (SmsPluginEventHandler::instance()->getDeviceStatus() == true) {
                        MSG_DEBUG("Device Is Ready");
                        return MSG_SUCCESS;
+               } else {
+                       MSG_DEBUG("Device Is Not Ready.");
+                       return MSG_ERR_PLUGIN_TAPI_FAILED;
                }
        }
 
@@ -473,7 +471,7 @@ msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error)
 
        MSG_DEBUG("Set Status : [%d]", status);
 
-       tapiRet = tel_set_sms_memory_status(pTapiHandle, status, NULL, NULL);
+       tapiRet = tel_set_sms_memory_status(pTapiHandle, status, TapiEventMemoryStatus, NULL);
 
        if (tapiRet == TAPI_API_SUCCESS)
        {
index 6ae49d9..7d3e612 100755 (executable)
@@ -18,8 +18,8 @@
 #include <string.h>
 
 #include "MsgDebug.h"
+#include "MsgTextConvert.h"
 #include "SmsPluginUDCodec.h"
-#include "SmsPluginTextConvert.h"
 #include "SmsPluginParamCodec.h"
 
 
@@ -261,6 +261,7 @@ int SmsPluginParamCodec::encodeSMSC(const SMS_ADDRESS_S *pAddress, unsigned char
 int SmsPluginParamCodec::decodeAddress(const unsigned char *pTpdu, SMS_ADDRESS_S *pAddress)
 {
        int offset = 0, addrLen = 0, bcdLen = 0;
+       MsgTextConvert textCvt;
        memset(pAddress->address, 0x00, sizeof(pAddress->address));
 
        addrLen = (int)pTpdu[offset++];
@@ -285,12 +286,12 @@ MSG_DEBUG("npi [%d]", pAddress->npi);
 
                tmplength = SmsPluginUDCodec::unpack7bitChar(&(pTpdu[offset]), bcdLen, 0, tmpAddress);
 
-               SMS_LANG_INFO_S langInfo = {0};
+               MSG_LANG_INFO_S langInfo = {0,};
 
                langInfo.bSingleShift = false;
                langInfo.bLockingShift = false;
 
-               SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)pAddress->address, MAX_ADDRESS_LEN, (unsigned char*)tmpAddress, tmplength, &langInfo);
+               textCvt.convertGSM7bitToUTF8((unsigned char*)pAddress->address, MAX_ADDRESS_LEN, (unsigned char*)tmpAddress, tmplength, &langInfo);
        }
        else if (pAddress->ton == SMS_TON_INTERNATIONAL)
        {
index 180dcb1..5f38a3b 100755 (executable)
@@ -140,10 +140,10 @@ void SmsPluginSatHandler::sendSms(void *pData)
        memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
        pkgInfo.Sca[smscLen] = '\0';
 
-       int reqId = 0, tapiRet = TAPI_API_SUCCESS;
+       int tapiRet = TAPI_API_SUCCESS;
 
        // Send SMS
-       tapiRet = tel_send_sms(pTapiHandle, &pkgInfo, 0, TapiEventSentStatus, &reqId);
+       tapiRet = tel_send_sms(pTapiHandle, &pkgInfo, 0, TapiEventSentStatus, NULL);
 
        if (tapiRet == TAPI_API_SUCCESS)
        {
@@ -430,7 +430,7 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
 
        // TP-MTI, TP-RD, TP-VPF,  TP-RP, TP-UDHI, TP-SRR
        // TP-VPF
-       SMS_VPF_T vpf = (SMS_VPF_T)(pTpdu[pos++] & 0x18);
+       SMS_VPF_T vpf = (SMS_VPF_T)(pTpdu[pos++] & 0x18) >> 3;
 
        // TP-MR
        unsigned char tmpRef = pTpdu[pos];
@@ -486,7 +486,6 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
 
        // TP-UDL
        int udl = pTpdu[pos];
-
        int retLen = 0;
 
        if (bIsPackingRequired == true)
@@ -498,7 +497,7 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
                memcpy(userData.data, &pTpdu[pos+1], udl);
                userData.data[udl] = '\0';
 
-MSG_DEBUG("user data : %s", userData.data);
+MSG_DEBUG("user data : [%s]", userData.data);
 
                int encodeSize = SmsPluginUDCodec::encodeUserData(&userData, dcs.codingScheme, (char*)&pTpdu[pos]);
 
index 520e3f4..de92508 100755 (executable)
@@ -19,6 +19,9 @@
 #include "MsgDebug.h"
 #include "MsgException.h"
 #include "MsgGconfWrapper.h"
+#include "MsgNotificationWrapper.h"
+#include "MsgSoundPlayer.h"
+
 #include "SmsPluginParamCodec.h"
 #include "SmsPluginCallback.h"
 #include "SmsPluginSetting.h"
@@ -30,6 +33,7 @@ extern "C"
        #include <TelSms.h>
        #include <TapiUtility.h>
        #include <ITapiNetText.h>
+       #include <ITapiSim.h>
 }
 
 extern struct tapi_handle *pTapiHandle;
@@ -87,8 +91,7 @@ void SmsPluginSetting::initConfigData(MSG_SIM_STATUS_T SimStatus)
 
        for (int index = 0; index < paramCnt; index++)
        {
-               if (getParam(index, &tmpSmscData) == false)
-               {
+               if (getParam(index, &tmpSmscData) == false) {
                        failCnt++;
                        continue;
                }
@@ -105,45 +108,35 @@ void SmsPluginSetting::initConfigData(MSG_SIM_STATUS_T SimStatus)
        }
 
        tmpSmscList.totalCnt = (paramCnt - failCnt);
-       tmpSmscList.selected = selectedParam;
+//     below is commented to be the first smsc is selected.
+//     tmpSmscList.selected = selectedParam;
 
-       if (paramCnt > 0)
-       {
+       if (paramCnt > 0) {
                err = addSMSCList(&tmpSmscList);
 
-               if (err == MSG_SUCCESS)
-               {
+               if (err == MSG_SUCCESS) {
                        MSG_DEBUG("########  Add SMSC List Success !!! #######");
-               }
-               else
-               {
+               } else {
                        MSG_DEBUG("########  Add SMSC List Fail !!! return : %d #######", err);
                }
        }
 
        // Init CB Config
-       if (SimStatus == MSG_SIM_STATUS_CHANGED)
-       {
+       if (SimStatus == MSG_SIM_STATUS_CHANGED) {
                MSG_DEBUG("simStatus == MSG_SIM_STATUS_CHANGED");
 
                MSG_CBMSG_OPT_S cbMsgOpt = {};
 
-               if (getCbConfig(&cbMsgOpt) == true)
-               {
+               if (getCbConfig(&cbMsgOpt) == true) {
                        err = addCbOpt(&cbMsgOpt);
 
-                       if (err == MSG_SUCCESS)
-                       {
+                       if (err == MSG_SUCCESS) {
                                MSG_DEBUG("########  Add CB Option Success !!! #######");
-                       }
-                       else
-                       {
+                       } else {
                                MSG_DEBUG("########  Add CB Option Fail !!! return : %d #######", err);
                        }
                }
-       }
-       else if (SimStatus == MSG_SIM_STATUS_NORMAL)
-       {
+       } else if (SimStatus == MSG_SIM_STATUS_NORMAL) {
                MSG_DEBUG("simStatus == MSG_SIM_STATUS_NORMAL");
 
                // Set CB Data into SIM in case of same SIM
@@ -155,6 +148,24 @@ void SmsPluginSetting::initConfigData(MSG_SIM_STATUS_T SimStatus)
                setCbConfig(&(cbSetting.option.cbMsgOpt));
        }
 
+       if (SimStatus != MSG_SIM_STATUS_NOT_FOUND)
+       {
+               MSG_VOICEMAIL_OPT_S tmpVoiceMail;
+               memset(&tmpVoiceMail, 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
+
+               if (getVoiceMailInfo(&tmpVoiceMail) == true) {
+                       MSG_DEBUG("########  getVoiceMailInfo Success !!! #######");
+               } else {
+                       MSG_DEBUG("########  getVoiceMailInfo Fail !!! #######", err);
+               }
+
+               if (getMwiInfo() == true) {
+                       MSG_DEBUG("########  getMwiInfo Success !!! #######");
+               } else {
+                       MSG_DEBUG("########  getMwiInfo Fail !!! #######", err);
+               }
+       }
+
        MSG_END();
 }
 
@@ -167,15 +178,16 @@ void SmsPluginSetting::setConfigData(const MSG_SETTING_S *pSetting)
        {
                case MSG_SMSC_LIST :
                        setParamList(&pSetting->option.smscList);
-               break;
-
+                       break;
                case MSG_CBMSG_OPT :
                        setCbConfig(&pSetting->option.cbMsgOpt);
-               break;
-
+                       break;
+               case MSG_VOICEMAIL_OPT:
+                       setVoiceMailInfo(&pSetting->option.voiceMailOpt);
+                       break;
                default :
                        THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
-               break;
+                       break;
        }
 }
 
@@ -414,7 +426,6 @@ void SmsPluginSetting::setParamList(const MSG_SMSC_LIST_S *pSMSCList)
        TelSmsParams_t smsParam = {0};
 
        int ret = TAPI_API_SUCCESS;
-       int reqId = 0;
 
        for (int index = 0; index < pSMSCList->totalCnt; index++)
        {
@@ -499,7 +510,6 @@ void SmsPluginSetting::getParamList(MSG_SMSC_LIST_S *pSMSCList)
        MSG_DEBUG("Parameter Count [%d]", paramCnt);
 
        int ret = TAPI_API_SUCCESS;
-       int reqId = 0;
 
        MSG_SMSC_DATA_S tmpSmscData = {};
 
@@ -547,8 +557,6 @@ void SmsPluginSetting::getParamList(MSG_SMSC_LIST_S *pSMSCList)
 
 int SmsPluginSetting::getParamCount()
 {
-       int reqId = 0;
-
        int ret = TAPI_API_SUCCESS;
 
        ret = tel_get_sms_parameter_count(pTapiHandle, TapiEventGetParamCnt, NULL);
@@ -568,8 +576,6 @@ int SmsPluginSetting::getParamCount()
 
 bool SmsPluginSetting::getParam(int Index, MSG_SMSC_DATA_S *pSmscData)
 {
-       int reqId = 0;
-
        int ret = TAPI_API_SUCCESS;
 
        ret = tel_get_sms_parameters(pTapiHandle, Index, TapiEventGetParam, NULL);
@@ -674,6 +680,158 @@ bool SmsPluginSetting::getCbConfig(MSG_CBMSG_OPT_S *pCbOpt)
        return true;
 }
 
+void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
+{
+#if 0 // New TAPI
+       int ret = TAPI_API_SUCCESS;
+
+       TelSimMailBoxNumber_t mailboxInfo = {0,};
+
+       for (int i = 0; i < simMailboxList.count; i++) {
+               if (simMailboxList.list[i].mb_type == TAPI_SIM_MAILBOX_VOICE) {
+                       memset(&simMailboxList.list[i].num, 0x00, sizeof(simMailboxList.list[i].num));
+                       snprintf(simMailboxList.list[i].num, sizeof(simMailboxList.list[i].num), "%s", pVoiceOpt->mailNumber);
+                       MSG_DEBUG("Mailbox number config [%s]", simMailboxList.list[i].num);
+
+                       mailboxInfo.b_cphs = simMailboxList.list[i].b_cphs;
+                       mailboxInfo.alpha_id_max_len = simMailboxList.list[i].alpha_id_max_len;
+                       mailboxInfo.mb_type = (TelSimMailboxType_t)simMailboxList.list[i].mb_type;
+                       mailboxInfo.profile_num = simMailboxList.list[i].profile_num;
+                       mailboxInfo.rec_index = simMailboxList.list[i].rec_index;
+                       mailboxInfo.ton = (TelSimTypeOfNum_t)simMailboxList.list[i].ton;
+                       mailboxInfo.npi = (TelSimNumberingPlanIdentity_t)simMailboxList.list[i].npi;
+                       snprintf(mailboxInfo.alpha_id, sizeof(mailboxInfo.alpha_id), "%s", simMailboxList.list[i].alpha_id);
+                       snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", simMailboxList.list[i].num);
+                       mailboxInfo.cc_id = simMailboxList.list[i].cc_id;
+                       mailboxInfo.ext1_id = simMailboxList.list[i].ext1_id;
+
+                       break;
+               }
+       }
+
+       ret = tel_set_sim_mailbox_info(pTapiHandle, &mailboxInfo, TapiEventSetMailboxInfo, NULL);
+
+       if (ret == TAPI_API_SUCCESS)
+       {
+               MSG_DEBUG("######## tel_set_sim_mailbox_info() Success !!! #######");
+       }
+       else
+       {
+               MSG_DEBUG("######## tel_set_sim_mailbox_info() Fail !!! return : %d #######", ret);
+       }
+
+       return;
+#endif
+}
+
+bool SmsPluginSetting::getVoiceMailInfo(MSG_VOICEMAIL_OPT_S *pVoiceOpt)
+{
+#if 0 // New TAPI
+       int ret = TAPI_API_SUCCESS;
+
+       ret = tel_get_sim_mailbox_info(pTapiHandle, TapiEventGetMailboxInfo, NULL);
+
+       if (ret == TAPI_API_SUCCESS) {
+               MSG_DEBUG("######## tel_get_sim_mailbox_info() Success !!! #######");
+       } else {
+               MSG_DEBUG("######## tel_get_sim_mailbox_info() Fail !!! return : %d #######", ret);
+               return false;
+       }
+
+       if (getMailboxInfoEvent(pVoiceOpt) == true) {
+               MSG_DEBUG("######## Get MWI info was Successful !!! #######");
+       } else {
+               MSG_DEBUG("######## Get MWI info was Failed !!! #######");
+               return false;
+       }
+
+#endif
+       return true;
+}
+
+void SmsPluginSetting::setMwiInfo(MSG_SUB_TYPE_T type, int count)
+{
+#if 0 // New TAPI
+       if (type < MSG_MWI_VOICE_SMS || type > MSG_MWI_OTHER_SMS) {
+               MSG_DEBUG("Invalid parameter");
+               return;
+       }
+
+       int ret = TAPI_API_SUCCESS;
+
+       TelSimMessageWaitingReq_t mwReq = {0,};
+
+       if (simMwiInfo.b_cphs) {
+               if (type == MSG_MWI_VOICE_SMS)
+                       simMwiInfo.cphs_mwi.b_voice1 = true;
+               else if (type == MSG_MWI_FAX_SMS)
+                       simMwiInfo.cphs_mwi.b_fax = true;
+               else
+                       MSG_DEBUG("There is no type [%d] in CPHS.", type);
+
+               mwReq.mw_data_u.cphs_mw.b_voice1 = simMwiInfo.cphs_mwi.b_voice1;
+               mwReq.mw_data_u.cphs_mw.b_voice2 = simMwiInfo.cphs_mwi.b_voice2;
+               mwReq.mw_data_u.cphs_mw.b_fax = simMwiInfo.cphs_mwi.b_fax;
+               mwReq.mw_data_u.cphs_mw.b_data = simMwiInfo.cphs_mwi.b_data;
+       } else {
+               if (type == MSG_MWI_VOICE_SMS)
+                       simMwiInfo.mwi_list.mw_info[0].voice_count = count;
+               else if (type == MSG_MWI_FAX_SMS)
+                       simMwiInfo.mwi_list.mw_info[0].fax_count = count;
+               else if (type == MSG_MWI_EMAIL_SMS)
+                       simMwiInfo.mwi_list.mw_info[0].email_count = count;
+               else if (type == MSG_MWI_OTHER_SMS)
+                       simMwiInfo.mwi_list.mw_info[0].other_count = count;
+               else
+                       MSG_DEBUG("No match type [%d]", type);
+
+               mwReq.mw_data_u.mw.rec_index = simMwiInfo.mwi_list.mw_info[0].rec_index;
+               mwReq.mw_data_u.mw.indicator_status = simMwiInfo.mwi_list.mw_info[0].indicator_status;
+               mwReq.mw_data_u.mw.voice_count = simMwiInfo.mwi_list.mw_info[0].voice_count;
+               mwReq.mw_data_u.mw.fax_count = simMwiInfo.mwi_list.mw_info[0].fax_count;
+               mwReq.mw_data_u.mw.email_count = simMwiInfo.mwi_list.mw_info[0].email_count;
+               mwReq.mw_data_u.mw.other_count = simMwiInfo.mwi_list.mw_info[0].other_count;
+               mwReq.mw_data_u.mw.video_count = simMwiInfo.mwi_list.mw_info[0].video_count;
+       }
+
+       mwReq.b_cphs = simMwiInfo.b_cphs;
+
+       ret = tel_set_sim_messagewaiting_info(pTapiHandle, &mwReq, TapiEventSetMwiInfo, NULL);
+
+       if (ret == TAPI_API_SUCCESS) {
+               MSG_DEBUG("######## tel_set_sim_messagewaiting_info() Success !!! #######");
+       } else {
+               MSG_DEBUG("######## tel_set_sim_messagewaiting_info() Fail !!! return : %d #######", ret);
+       }
+
+       return;
+#endif
+}
+
+
+bool SmsPluginSetting::getMwiInfo(void)
+{
+#if 0 // New TAPI
+       int ret = TAPI_API_SUCCESS;
+
+       ret = tel_get_sim_messagewaiting_info(pTapiHandle, TapiEventGetMwiInfo, NULL);
+
+       if (ret == TAPI_API_SUCCESS) {
+               MSG_DEBUG("######## tel_get_sim_messagewaiting_info() Success !!! #######");
+       } else {
+               MSG_DEBUG("######## tel_get_sim_messagewaiting_info() Fail !!! return : %d #######", ret);
+               return false;
+       }
+
+       if (getResultFromSim() == true) {
+               MSG_DEBUG("######## Get Mainbox info was Successful !!! #######");
+       } else {
+               MSG_DEBUG("######## Get Mainbox info was Failed !!! #######");
+               return false;
+       }
+#endif
+       return true;
+}
 
 void SmsPluginSetting::setParamCntEvent(int ParamCnt)
 {
@@ -809,6 +967,132 @@ bool SmsPluginSetting::getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt)
 }
 
 
+void SmsPluginSetting::setMailboxInfoEvent(SMS_SIM_MAILBOX_LIST_S *pMailboxList, bool bSuccess)
+{
+       mx.lock();
+
+       bTapiResult = bSuccess;
+
+       memset(&simMailboxList, 0x00, sizeof(SMS_SIM_MAILBOX_LIST_S));
+
+       if (bTapiResult == true)
+       {
+               int i = 0;
+
+               if (pMailboxList && pMailboxList->count > 0) {
+                       memcpy(&simMailboxList, pMailboxList, sizeof(SMS_SIM_MAILBOX_LIST_S));
+
+                       /* Temp :: Save voicemail number with VOICE1 line number */
+                       for (i = 0; i < pMailboxList->count ; i++) {
+                               MSG_DEBUG("Mailbox list[%d] type=[%d] address = [%s]", i, pMailboxList->list[i].mb_type, pMailboxList->list[i].num);
+                               if (pMailboxList->list[i].mb_type == TAPI_SIM_MAILBOX_VOICE) {
+                                       MsgSettingSetString(VOICEMAIL_NUMBER, pMailboxList->list[i].num);
+                                       break;
+                               }
+                       }
+               }
+       }
+
+       cv.signal();
+
+       mx.unlock();
+}
+
+bool SmsPluginSetting::getMailboxInfoEvent(MSG_VOICEMAIL_OPT_S *pVoiceOpt)
+{
+       int ret = 0;
+
+       bTapiResult = false;
+
+       mx.lock();
+
+       ret = cv.timedwait(mx.pMutex(), 10);
+
+       mx.unlock();
+
+       if (ret == ETIMEDOUT)
+       {
+               MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
+               return false;
+       }
+
+       memset(pVoiceOpt, 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
+
+       if (bTapiResult == true)
+       {
+               for(int i = 0; i < simMailboxList.count; i++) {
+                       if (simMailboxList.list[i].mb_type == MSG_SIM_MAILBOX_VOICE) {
+                               snprintf(pVoiceOpt->mailNumber, sizeof(pVoiceOpt->mailNumber), "%s", simMailboxList.list[i].num);
+                               break;
+                       }
+               }
+       }
+
+       return bTapiResult;
+}
+
+void SmsPluginSetting::setMwiInfoEvent(SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess)
+{
+       mx.lock();
+
+       bTapiResult = bSuccess;
+
+       memset(&simMwiInfo, 0x00, sizeof(SMS_SIM_MWI_INFO_S));
+
+       if (bTapiResult == true)
+       {
+               int mwi_cnt = 0;
+               int index = 0;
+
+               memcpy(&simMwiInfo, pMwiInfo, sizeof(SMS_SIM_MWI_INFO_S));
+
+               /* Save MW count with VOICE line number */
+               for(int i = 0; i < simMailboxList.count; i++) {
+
+                       if (simMailboxList.list[i].mb_type == MSG_SIM_MAILBOX_VOICE) {
+
+                               index = simMailboxList.list[i].profile_num - 1;
+                               if (index < 0) {
+                                       MSG_DEBUG("SIM profile number is invalid.");
+                                       break;
+                               }
+
+                               MSG_DEBUG("SIM MWI profile number=[%d], index=[%d]", simMailboxList.list[i].profile_num, index);
+
+                               if (simMwiInfo.b_cphs == false) { // Normal case
+                                       mwi_cnt = simMwiInfo.mwi_list.mw_info[index].voice_count;
+                               } else { // CPHS case
+                                       /* For CPHS case, mwi_cnt value is boolean */
+                                       mwi_cnt = simMwiInfo.cphs_mwi.b_voice1;
+                               }
+
+                               MsgSettingSetInt(VOICEMAIL_COUNT, mwi_cnt);
+
+                               if (mwi_cnt > 0) {
+                                       MSG_MESSAGE_INFO_S msgInfo = {0,};
+
+                                       msgInfo.displayTime = time(NULL);
+                                       snprintf(msgInfo.addressList[0].addressVal, sizeof(msgInfo.addressList[0].addressVal), \
+                                                       "%s", simMailboxList.list[i].num);
+                                       memset(msgInfo.addressList[0].displayName, 0x00, sizeof(msgInfo.addressList[0].displayName));
+                                       msgInfo.msgType.mainType = MSG_SMS_TYPE;
+                                       msgInfo.msgType.subType = MSG_MWI_VOICE_SMS;
+
+                                       snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d new voice message", mwi_cnt);
+
+                                       MsgSoundPlayStart();
+                                       MsgInsertNoti(&msgInfo);
+                               }
+                               break;
+                       }
+               }
+       }
+
+       cv.signal();
+
+       mx.unlock();
+}
+
 void SmsPluginSetting::setResultFromSim(bool bResult)
 {
        mx.lock();
index 33af517..84ab2fa 100755 (executable)
@@ -404,7 +404,7 @@ void SmsPluginSimMsg::setReadStatus(msg_sim_id_t SimMsgId)
 
        int ret = TAPI_API_SUCCESS;
 
-       ret = tel_set_sms_message_status(pTapiHandle, (int)SimMsgId, TAPI_NETTEXT_STATUS_READ, NULL, NULL);
+       ret = tel_set_sms_message_status(pTapiHandle, (int)SimMsgId, TAPI_NETTEXT_STATUS_READ, TapiEventSetMsgStatus, (void *)&SimMsgId);
 
        if (ret == TAPI_API_SUCCESS)
        {
@@ -422,7 +422,7 @@ void SmsPluginSimMsg::setReadStatus(msg_sim_id_t SimMsgId)
 
        if (bResult == true)
        {
-               MSG_DEBUG("######## Setting Read Status was Successful !!! #######");
+               MSG_DEBUG("######## Setting Read Status was Successful !!!, sim id=[%d] #######", SimId);
        }
        else
        {
@@ -433,8 +433,6 @@ void SmsPluginSimMsg::setReadStatus(msg_sim_id_t SimMsgId)
 
 void SmsPluginSimMsg::getSimMsgCount(MSG_SIM_COUNT_S *pSimMsgCnt)
 {
-       int reqId = 0;
-
        int ret = TAPI_API_SUCCESS;
 
        ret = tel_get_sms_count(pTapiHandle, TapiEventGetSimMsgCnt, NULL);
@@ -461,8 +459,6 @@ void SmsPluginSimMsg::getSimMsgCount(MSG_SIM_COUNT_S *pSimMsgCnt)
 
 bool SmsPluginSimMsg::getSimMsg(msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S *pMsgInfo)
 {
-       int reqId = 0;
-
        int ret = TAPI_API_SUCCESS;
 
        ret = tel_read_sms_in_sim(pTapiHandle, SimMsgId, TapiEventGetSimMsg, NULL);
index cdbe024..b156353 100755 (executable)
@@ -151,11 +151,11 @@ msg_error_t SmsPluginStorage::addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo)
        /**  Add Message */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, '', '', ?, %d, 0, %d, 0, 0);",
+       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, '', '', ?, 0, 0, 0);",
                        MSGFW_MESSAGE_TABLE_NAME, msgId, convId, pSimMsgInfo->folderId, pSimMsgInfo->storageId,
                        pSimMsgInfo->msgType.mainType, pSimMsgInfo->msgType.subType, pSimMsgInfo->displayTime, pSimMsgInfo->dataSize,
                        pSimMsgInfo->networkStatus, pSimMsgInfo->bRead, pSimMsgInfo->bProtected, pSimMsgInfo->priority,
-                       pSimMsgInfo->direction, 0, pSimMsgInfo->bBackup, MSG_DELIVERY_REPORT_NONE, MSG_READ_REPORT_NONE);
+                       pSimMsgInfo->direction, 0, pSimMsgInfo->bBackup);
 
        MSG_DEBUG("QUERY : %s", sqlQuery);
 
@@ -267,8 +267,10 @@ msg_error_t SmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
                MSG_DEBUG("Add Replace SM Type [%d]", pMsgInfo->msgType.subType-3);
                err = addReplaceTypeMsg(pMsgInfo);
        } else if ((pMsgInfo->msgType.subType >= MSG_MWI_VOICE_SMS) && (pMsgInfo->msgType.subType <= MSG_MWI_OTHER_SMS)) {
-               MSG_DEBUG("Add MWI Message");
-               err = addSmsMessage(pMsgInfo);
+               if (pMsgInfo->bStore == true) {
+                       MSG_DEBUG("Add MWI Message");
+                       err = addSmsMessage(pMsgInfo);
+               }
        } else if ((pMsgInfo->msgType.subType == MSG_WAP_SI_SMS) || (pMsgInfo->msgType.subType == MSG_WAP_CO_SMS)) {
                MSG_DEBUG("Add WAP Push Message");
                switch (pMsgInfo->msgType.subType)
@@ -308,8 +310,6 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
        unsigned int rowId = 0;
        msg_thread_id_t convId = 0;
 
-       char sqlQuery[MAX_QUERY_LEN+1];
-
        dbHandle.beginTrans();
 
        if (pMsgInfo->nAddressCnt > 0) {
@@ -386,7 +386,7 @@ msg_error_t SmsPluginStorage::updateSmsMessage(MSG_MESSAGE_INFO_S *pMsg)
        /**  Update Message */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ADDRESS_ID = %d, FOLDER_ID = %d, STORAGE_ID = %d, MAIN_TYPE = %d, SUB_TYPE = %d, \
+       snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET CONV_ID = %d, FOLDER_ID = %d, STORAGE_ID = %d, MAIN_TYPE = %d, SUB_TYPE = %d, \
                        DISPLAY_TIME = %lu, DATA_SIZE = %d, NETWORK_STATUS = %d, READ_STATUS = %d, PROTECTED = %d, PRIORITY = %d, MSG_DIRECTION = %d, \
                        BACKUP = %d, SUBJECT = ?, MSG_DATA = ?, THUMB_PATH = ?, MSG_TEXT = ? WHERE MSG_ID = %d;",
                                MSGFW_MESSAGE_TABLE_NAME, convId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->displayTime, pMsg->dataSize,
@@ -441,8 +441,6 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
 {
        MSG_BEGIN();
 
-       msg_error_t err = MSG_SUCCESS;
-
        char sqlQuery[MAX_QUERY_LEN+1];
 
         /**  Get SUB_TYPE, STORAGE_ID */
@@ -633,7 +631,7 @@ msg_error_t SmsPluginStorage::addReplaceTypeMsg(MSG_MESSAGE_INFO_S *pMsgInfo)
 
                /**  Find Replace Type Msg : Same Replace Type, Same Origin Address */
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
-               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*), MSG_ID FROM %s WHERE SUB_TYPE = %d AND B.CONV_ID = %d;",
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*), MSG_ID FROM %s WHERE SUB_TYPE = %d AND CONV_ID = %d;",
                                MSGFW_MESSAGE_TABLE_NAME, pMsgInfo->msgType.subType, convId);
 
                if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS)
@@ -651,12 +649,12 @@ msg_error_t SmsPluginStorage::addReplaceTypeMsg(MSG_MESSAGE_INFO_S *pMsgInfo)
        }
 
        /** Update New Replace Type Msg */
-       if (retCnt == 1) {
-               MSG_DEBUG("Update Replace Type Msg");
-               err = updateSmsMessage(pMsgInfo);
-       } else if (retCnt == 0) { /** Insert New Replace Type Msg */
+       if (retCnt == 0) { /** Insert New Replace Type Msg */
                MSG_DEBUG("Insert Replace Type Msg");
                err = addSmsMessage(pMsgInfo);
+       } else {
+               MSG_DEBUG("Update Replace Type Msg");
+               err = updateSmsMessage(pMsgInfo);
        }
 
        return err;
@@ -710,6 +708,7 @@ msg_error_t SmsPluginStorage::addWAPMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
        if (bProceed == false)
                return MSG_ERR_INVALID_MESSAGE;
 
+#if 0
        /**  update subject */
        int len = strlen(pushMsg.contents);
 
@@ -719,9 +718,16 @@ msg_error_t SmsPluginStorage::addWAPMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
        } else {
                strncpy(pMsgInfo->subject, pushMsg.contents, MAX_SUBJECT_LEN);
        }
+#endif
 
        /**  Update Msg Text - remove */
        strncpy(pMsgInfo->msgText, pushMsg.href, MAX_MSG_TEXT_LEN);
+
+       if (pushMsg.contents[0] != '\0') {
+               strncat(pMsgInfo->msgText, " ", MAX_MSG_TEXT_LEN - strlen(pMsgInfo->msgText));
+               strncat(pMsgInfo->msgText, pushMsg.contents, MAX_MSG_TEXT_LEN - strlen(pMsgInfo->msgText));
+       }
+
        pMsgInfo->dataSize = strlen(pMsgInfo->msgText);
 
        pMsgInfo->bTextSms = true;
@@ -740,6 +746,8 @@ msg_error_t SmsPluginStorage::addWAPMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
                        dbHandle.endTrans(false);
                        return err;
                }
+
+               pMsgInfo->threadId = convId;
        }
 
        /**  get last row count for Message id */
@@ -1125,7 +1133,7 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
 msg_error_t SmsPluginStorage::getnthPushEvent(int index, int *appcode)
 {
        msg_error_t err = MSG_SUCCESS;
-       if(index > pushAppInfoList.size() - 1)
+       if((unsigned int)index > pushAppInfoList.size() - 1)
                return MSG_ERR_INVALID_PARAMETER;
 
        std::list<PUSH_APPLICATION_INFO_S>::iterator it = pushAppInfoList.begin();
index 133ff94..fea8e78 100755 (executable)
@@ -21,8 +21,8 @@
 #include "MsgCppTypes.h"
 #include "MsgException.h"
 #include "MsgGconfWrapper.h"
+#include "MsgNotificationWrapper.h"
 #include "MsgUtilFile.h"
-#include "SmsPluginTextConvert.h"
 #include "SmsPluginParamCodec.h"
 #include "SmsPluginTpduCodec.h"
 #include "SmsPluginEventHandler.h"
@@ -207,6 +207,7 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
                        else
                        {
                                SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
+
                                THROW(MsgException::SMS_PLG_ERROR, "########  TelTapiSmsSend Fail !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
                        }
 
@@ -218,7 +219,10 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
                        }
                        else
                        {
+                               MsgInsertTicker("Sending SMS is failed", NULL);
+
                                SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
+
                                THROW(MsgException::SMS_PLG_ERROR, "########  Msg Sent was Failed !!! req Id : [%d] return : [%d] #######", reqId, retStatus);
                        }
 
@@ -247,7 +251,7 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
                tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
                response = TAPI_NETTEXT_SENDSMS_SUCCESS;
 
-               tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, NULL, NULL);
+               tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
 
                if (tapiRet == TAPI_API_SUCCESS)
                {
@@ -255,7 +259,7 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
                }
                else
                {
-                       MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
+                       MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
                }
        }
        else if (err == MSG_ERR_SIM_STORAGE_FULL)
@@ -264,7 +268,7 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
                tpdu.data.deliverRep.failCause = SMS_FC_MSG_CAPA_EXCEEDED;
                response = TAPI_NETTEXT_SIM_FULL;
 
-               tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, NULL, NULL);
+               tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
 
                if (tapiRet == TAPI_API_SUCCESS)
                {
@@ -272,7 +276,7 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
                }
                else
                {
-                       MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
+                       MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
                }
        }
        else if (err == MSG_ERR_MESSAGE_COUNT_FULL)
@@ -281,7 +285,7 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
                tpdu.data.deliverRep.failCause = SMS_FC_MSG_CAPA_EXCEEDED;
                response = TAPI_NETTEXT_ME_FULL;
 
-               tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, NULL, NULL);
+               tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
 
                if (tapiRet == TAPI_API_SUCCESS)
                {
@@ -289,7 +293,7 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
                }
                else
                {
-                       MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
+                       MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
                }
        }
        else
@@ -475,14 +479,14 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
 
        msg_encode_type_t encodeType = MSG_ENCODE_GSM7BIT;
 
-       SMS_LANGUAGE_ID_T langId = SMS_LANG_ID_RESERVED;
+       MSG_LANGUAGE_ID_T langId = MSG_LANG_ID_RESERVED;
 
        // User Data
        if (pMsgInfo->bTextSms == true)
        {
                if (*pCharType == SMS_CHARSET_7BIT)
                {
-                       decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize, &langId);
+                       decodeLen = textCvt.convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize, &langId);
                }
                else if (*pCharType == SMS_CHARSET_8BIT)
                {
@@ -491,11 +495,11 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
                }
                else if (*pCharType == SMS_CHARSET_UCS2)
                {
-                       decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize);
+                       decodeLen = textCvt.convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize);
                }
                else if (*pCharType == SMS_CHARSET_AUTO)
                {
-                       decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize, &encodeType);
+                       decodeLen = textCvt.convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize, &encodeType);
                        *pCharType = encodeType;
                }
        }
@@ -514,7 +518,7 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
 
                if (*pCharType == SMS_CHARSET_7BIT)
                {
-                       decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId);
+                       decodeLen = textCvt.convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId);
                }
                else if (*pCharType == SMS_CHARSET_8BIT)
                {
@@ -523,11 +527,11 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
                }
                else if (*pCharType == SMS_CHARSET_UCS2)
                {
-                       decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pFileData, fileSize);
+                       decodeLen = textCvt.convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pFileData, fileSize);
                }
                else if (*pCharType == SMS_CHARSET_AUTO)
                {
-                       decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &encodeType);
+                       decodeLen = textCvt.convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &encodeType);
                        *pCharType = encodeType;
                }
 
@@ -627,7 +631,7 @@ MSG_DEBUG("user data [%s]", pData->userData[i].data);
                }
 
                // Set User Data Header for National Language Single Shift
-               if (*pCharType == SMS_CHARSET_7BIT && langId != SMS_LANG_ID_RESERVED)
+               if (*pCharType == SMS_CHARSET_7BIT && langId != MSG_LANG_ID_RESERVED)
                {
                        pData->userData[i].header[headerCnt].udhType = SMS_UDH_SINGLE_SHIFT;
                        pData->userData[i].header[headerCnt].udh.singleShift.langId = langId;
@@ -642,7 +646,7 @@ MSG_DEBUG("user data [%s]", pData->userData[i].data);
 }
 
 
-int SmsPluginTransport::getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int DataLen, bool bPortNum, SMS_LANGUAGE_ID_T LangId, int ReplyAddrLen)
+int SmsPluginTransport::getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int DataLen, bool bPortNum, MSG_LANGUAGE_ID_T LangId, int ReplyAddrLen)
 {
        int headerLen = 1, concat = 5, port = 6, lang = 3, reply = 2;
        int headerSize = 0, segSize = 0, maxSize = 0;
@@ -664,7 +668,7 @@ int SmsPluginTransport::getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int Dat
                headerSize += port;
        }
 
-       if (LangId != SMS_LANG_ID_RESERVED)
+       if (LangId != MSG_LANG_ID_RESERVED)
        {
                MSG_DEBUG("National Language Exists");
                headerSize += lang;
@@ -679,14 +683,14 @@ int SmsPluginTransport::getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int Dat
 
        if (CodingScheme == SMS_CHARSET_7BIT)
        {
-               if (((DataLen+headerSize)/maxSize) >= 1)
+               if (((DataLen+headerSize)/maxSize) > 1)
                        segSize = ((140*8) - ((headerLen + concat + headerSize)*8)) / 7;
                else
                        segSize = DataLen;
        }
        else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2)
        {
-               if (((DataLen+headerSize)/maxSize) >= 1)
+               if (((DataLen+headerSize)/maxSize) > 1)
                        segSize = 140 - (headerLen + concat + headerSize);
                else
                        segSize = DataLen;
index 134e4f1..ac0b498 100755 (executable)
@@ -1227,7 +1227,7 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
        /** Convert Type values */
        msgInfo.msgType.mainType = MSG_MMS_TYPE;
        msgInfo.msgType.subType = MSG_NOTIFICATIONIND_MMS;
-
+       msgInfo.storageId = MSG_STORAGE_PHONE;
        msgInfo.dataSize = PushBodyLen;
 
        if (msgInfo.dataSize > MAX_MSG_TEXT_LEN) {
@@ -2357,7 +2357,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
                                                                for(int i = 0; i < count ; ++i)
                                                                {
-                                                                       if(integerValue == wspHeaderApplId[i].parameterCode)
+                                                                       if((unsigned int)integerValue == wspHeaderApplId[i].parameterCode)
                                                                        {
                                                                                snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken);
                                                                                strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1);
index 90a07ba..f848117 100755 (executable)
@@ -35,11 +35,12 @@ extern "C"
 /*==================================================================================================
                                      FUNCTION PROTOTYPES
 ==================================================================================================*/
-void TapiEventDeviceReady(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
 
 void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_data);
 void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
 void TapiEventCbMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
+void TapiEventEtwsMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
 void TapiEventDeliveryReportCNF(TapiHandle *handle, int result, void *data, void *user_data);
 
 void TapiEventGetSimMsgCnt(TapiHandle *handle, int result, void *data, void *user_data);
@@ -51,16 +52,26 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us
 
 void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user_data);
 
+void TapiEventSetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data);
+
+void TapiEventSetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data);
+
 void TapiEventGetParamCnt(TapiHandle *handle, int result, void *data, void *user_data);
 void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_data);
 
 void TapiEventSatSmsRefresh(TapiHandle *handle, int result, void *data, void *user_data);
-void TapiEventSatSendSms(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
+void TapiEventSatSendSms(TapiHandle *handle, int result, void *data, void *user_data);
 void TapiEventSatMoSmsCtrl(TapiHandle *handle, int result, void *data, void *user_data);
 
 void TapiEventSimFileInfo(TapiHandle *handle, int result, void *data, void *user_data);
 void TapiEventSimReadFile(TapiHandle *handle, int result, void *data, void *user_data);
 
+void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data);
+
+void TapiEventSetMsgStatus(TapiHandle *handle, int result, void *data, void *user_data);
+
 
 /*==================================================================================================
                                      CLASS DEFINITIONS
index febd64d..7f61dfc 100755 (executable)
@@ -26,6 +26,7 @@
 
 using namespace std;
 
+#include "MsgTextConvert.h"
 #include "SmsPluginTypes.h"
 
 extern "C"
@@ -93,6 +94,8 @@ private:
        void getDisplayName(unsigned short      MsgId, char *pDisplayName);
 
        vector<CB_PAGE_INFO_S> pageList;
+
+       MsgTextConvert textCvt;
 };
 
 #endif //SMS_PLUGIN_CBMSG_HANDLER_H
index 1920a62..18e3731 100755 (executable)
@@ -27,6 +27,7 @@
 
 using namespace std;
 
+#include "MsgTextConvert.h"
 #include "SmsPluginTypes.h"
 
 
@@ -103,6 +104,8 @@ private:
        void removeFromConcatList(unsigned short MsgRef);
 
        vector<SMS_CONCAT_INFO_S> concatList;
+
+       MsgTextConvert textCvt;
 };
 
 #endif //SMS_PLUGIN_CONCAT_HANDLER_H
index e8ba8fa..63efda2 100755 (executable)
@@ -22,6 +22,7 @@
                                          INCLUDE FILES
 ==================================================================================================*/
 #include "MsgMutex.h"
+#include "MsgTextConvert.h"
 #include "MsgPluginInterface.h"
 #include "SmsPluginTypes.h"
 
@@ -72,6 +73,8 @@ private:
 
        Mutex mx;
        CndVar cv;
+
+       MsgTextConvert textCvt;
 };
 
 #endif //SMS_PLUGIN_EVENT_HANDLER_H
index d649e48..8d26ec9 100755 (executable)
@@ -41,6 +41,9 @@ public:
        void setParamCntEvent(int ParamCnt);
        void setParamEvent(const MSG_SMSC_DATA_S *pSmscData, int RecordIdx, bool bSuccess);
        void setCbConfigEvent(const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess);
+       void setMailboxInfoEvent(SMS_SIM_MAILBOX_LIST_S *pVoiceOpt, bool bSuccess);
+       void setMwiInfo(MSG_SUB_TYPE_T type, int count);
+       void setMwiInfoEvent(SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess);
        void setResultFromSim(bool bResult);
 
 private:
@@ -61,9 +64,16 @@ private:
        bool setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt);
        bool getCbConfig(MSG_CBMSG_OPT_S *pCbOpt);
 
+       void setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt);
+       bool getVoiceMailInfo(MSG_VOICEMAIL_OPT_S *pVoiceOpt);
+       bool getMwiInfo(void);
+
        int getParamCntEvent();
        bool getParamEvent(MSG_SMSC_DATA_S *pSmscData);
        bool getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt);
+
+       bool getMailboxInfoEvent(MSG_VOICEMAIL_OPT_S *pVoiceOpt);
+
        bool getResultFromSim();
 
        SMS_PID_T convertPid(MSG_SMS_PID_T pid);
@@ -73,6 +83,10 @@ private:
        MSG_SMSC_DATA_S         smscData;
        MSG_CBMSG_OPT_S         cbOpt;
 
+       /* Message Waiting Indicator */
+       SMS_SIM_MAILBOX_LIST_S  simMailboxList;
+       SMS_SIM_MWI_INFO_S      simMwiInfo;
+
        bool            bTapiResult;
        int             paramCnt;
        int             selectedParam;
index e86f463..5013aee 100755 (executable)
@@ -22,6 +22,7 @@
                                          INCLUDE FILES
 ==================================================================================================*/
 #include "MsgMutex.h"
+#include "MsgTextConvert.h"
 #include "MsgTransportTypes.h"
 #include "MsgSettingTypes.h"
 #include "SmsPluginTypes.h"
@@ -53,7 +54,7 @@ private:
        SmsPluginTransport();
        ~SmsPluginTransport();
 
-       int getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int DataLen, bool bPortNum, SMS_LANGUAGE_ID_T LangId, int ReplyAddrLen);
+       int getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int DataLen, bool bPortNum, MSG_LANGUAGE_ID_T LangId, int ReplyAddrLen);
        SMS_PID_T convertPid(MSG_SMS_PID_T pid);
 
        static SmsPluginTransport* pInstance;
@@ -67,6 +68,8 @@ private:
 
        Mutex mx;
        CndVar cv;
+
+       MsgTextConvert textCvt;
 };
 
 #endif //SMS_PLUGIN_TRANSPORT_H
index 57d60f4..4d72f92 100755 (executable)
@@ -21,6 +21,7 @@
 /*==================================================================================================
                                          INCLUDE FILES
 ==================================================================================================*/
+#include "MsgTextConvert.h"
 #include "MsgInternalTypes.h"
 #include "MsgStorageTypes.h"
 #include "MsgSettingTypes.h"
@@ -43,7 +44,9 @@
 #define MAX_CBMSG_PAGE_SIZE            93
 #define MAX_ETWS_SIZE                  56
 #define MAX_CBMSG_PAGE_NUM             15
-#define MAX_SIM_SMS_NUM                        90
+#define MAX_SIM_SMS_NUM                        255
+#define MAX_SIM_XDN_ALPHA_ID_LEN       30
+#define MAX_SIM_MSP_CNT                        2
 
 #define SMS_PUSH_XML_HREF_TAG          "href"
 #define SMS_PUSH_XML_SI_ID_TAG         "si-id"
@@ -169,10 +172,13 @@ typedef unsigned char SMS_SAT_CMD_TYPE_T;
 
 typedef unsigned short SMS_SIM_EFILE_NAME_T;
 
-typedef unsigned char SMS_LANGUAGE_ID_T;
 
 typedef unsigned char SMS_ETWS_NETWORK_TYPE_T;
 
+/**
+\brief Represents SIM mailbox type. See enum _SMS_SIM_MAILBOX_TYPE_E
+*/
+typedef unsigned char SMS_SIM_MAILBOX_TYPE_T;
 
 /*==================================================================================================
                                     ENUMS
@@ -541,22 +547,13 @@ enum _SMS_SIM_EFILE_NAME_E
 };
 
 
-enum _SMS_LANGUAGE_ID_E
-{
-       SMS_LANG_ID_RESERVED = 0,
-       SMS_LANG_ID_TURKISH,
-       SMS_LANG_ID_SPANISH,
-       SMS_LANG_ID_PORTUGUESE,
-       SMS_LANG_ID_BENGALI,
-       SMS_LANG_ID_GUJARATI,
-       SMS_LANG_ID_HINDI,
-       SMS_LANG_ID_KANNADA,
-       SMS_LANG_ID_MALAYALAM,
-       SMS_LANG_ID_ORIYA,
-       SMS_LANG_ID_PUNJABI,
-       SMS_LANG_ID_TAMIL,
-       SMS_LANG_ID_TELUGU,
-       SMS_LANG_ID_URDU,
+enum _SMS_SIM_MAILBOX_TYPE_E {
+       MSG_SIM_MAILBOX_VOICE = 0x01,
+       MSG_SIM_MAILBOX_VOICE2 = 0x02,
+       MSG_SIM_MAILBOX_FAX = 0x03,
+       MSG_SIM_MAILBOX_DATA = 0x04,
+       MSG_SIM_MAILBOX_EMAIL = 0x05,
+       MSG_SIM_MAILBOX_OTHER = 0x06,
 };
 
 
@@ -651,18 +648,6 @@ typedef struct _SMS_SPECIAL_INDICATION_S
 } SMS_SPECIAL_INDICATION_S;
 
 
-typedef struct _SMS_SINGLE_SHIFT_S
-{
-       SMS_LANGUAGE_ID_T       langId;
-} SMS_SINGLE_SHIFT_S;
-
-
-typedef struct _SMS_LOCKING_SHIFT_S
-{
-       SMS_LANGUAGE_ID_T       langId;
-} SMS_LOCKING_SHIFT_S;
-
-
 typedef struct _SMS_UDH_S
 {
        SMS_UDH_TYPE_T udhType;
@@ -674,8 +659,8 @@ typedef struct _SMS_UDH_S
                SMS_APP_PORT_8BIT_S             appPort8bit;
                SMS_APP_PORT_16BIT_S            appPort16bit;
                SMS_SPECIAL_INDICATION_S        specialInd;
-               SMS_SINGLE_SHIFT_S                      singleShift;
-               SMS_LOCKING_SHIFT_S                     lockingShift;
+               MSG_SINGLE_SHIFT_S                      singleShift;
+               MSG_LOCKING_SHIFT_S                     lockingShift;
                SMS_ADDRESS_S                           alternateAddress;
        } udh;
 } SMS_UDH_S;
@@ -864,15 +849,6 @@ typedef struct _SMS_ETWS_PRIMARY_S
        unsigned char                           warningSecurityInfo[MAX_ETWS_SIZE-6];
 }SMS_ETWS_PRIMARY_S;
 
-typedef struct _SMS_LANG_INFO_S
-{
-       bool                                                    bSingleShift;
-       bool                                                    bLockingShift;
-
-       SMS_LANGUAGE_ID_T                       singleLang;
-       SMS_LANGUAGE_ID_T                       lockingLang;
-} SMS_LANG_INFO_S;
-
 
 typedef struct _SMS_WSP_CONTENTS_TYPE_S
 {
@@ -905,7 +881,7 @@ typedef struct _SMS_WSP_LANGUAGE_S
 typedef struct _SMS_WSP_HEADER_PARAMETER_S
 {
        char*         parameterToken;
-       unsigned char parameterCode;
+       unsigned int parameterCode;
 } SMS_WSP_HEADER_PARAMETER_S;
 
 
@@ -944,5 +920,76 @@ typedef struct
        char                            msgData[(MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM)+1];          /**< user data */
 } SMS_CONCAT_SIM_MSG_S;
 
+
+/**
+ *     @brief  Represents Sim Mailbox information
+ */
+typedef struct {
+       int                     b_cphs;
+       int                     rec_index;                                                              /**< index which stands for the location where record is saved in SIM*/
+       int                     profile_num;                                                    /**< SIM profile index*/
+       SMS_SIM_MAILBOX_TYPE_T  mb_type;
+       int                     alpha_id_max_len;                                               /**< alpha max length in SIM - READ ONLY*/
+       char                    alpha_id[MAX_SIM_XDN_ALPHA_ID_LEN + 1]; /**< Alpha Identifier */
+       MSG_SMS_TON_T   ton;                                                                    /**< Type Of Number */
+       MSG_SMS_NPI_T   npi;                                                                    /**< Number Plan Identity */
+       char                    num[MAX_PHONE_NUMBER_LEN + 1];                  /**< Dialing Number/SSC String */
+       unsigned char   cc_id;                                                                  /**< Capability/Configuration Identifier */
+       unsigned char   ext1_id;                                                                /**< Extensiion1 Record Identifier */
+} SMS_SIM_MAILBOX_INFO_S;
+
+
+/**
+ *     @brief  Represents Sim Mailbox list
+ */
+typedef struct {
+       int count;
+       SMS_SIM_MAILBOX_INFO_S list[MAX_SIM_MSP_CNT*5]; //max is 10
+} SMS_SIM_MAILBOX_LIST_S;
+
+
+/**
+ *     @brief  Represents Message Waiting Indication
+ */
+typedef struct {
+       int                     rec_index;
+       unsigned char   indicator_status;       /**< Indicator Type*/
+       int                     voice_count;            /**< VoiceMail Count*/
+       int                     fax_count;                      /**< FAX Count*/
+       int                     email_count;            /**< Email Count*/
+       int                             other_count;            /**< Other Count*/
+       int                     video_count;            /**< VideoMail Count*/
+} SMS_SIM_MWI_NORMAL_INFO_S;
+
+
+/**
+ *     @brief  Represents Message Waiting Indication list
+ */
+typedef struct {
+       int profile_count;
+       SMS_SIM_MWI_NORMAL_INFO_S mw_info[MAX_SIM_MSP_CNT];
+} SMS_SIM_MWI_LIST_S;
+
+
+/**
+ *     @brief  Represents Message Waiting Indication for CPHS
+ */
+typedef struct {
+       int     b_voice1;       /**< VoiceMsgLine1 message waiting flag */
+       int     b_voice2;       /**< VoiceMsgLine2 message waiting flag */
+       int     b_fax;          /**< FAX message waiting flag */
+       int     b_data;         /**< Data message waiting flag */
+} SMS_SIM_MWI_CPHS_INFO_S;
+
+
+/**
+ *     @brief  Represents Message Waiting Indication Information
+ */
+typedef struct {
+       int b_cphs;
+       SMS_SIM_MWI_LIST_S mwi_list;
+       SMS_SIM_MWI_CPHS_INFO_S cphs_mwi;
+} SMS_SIM_MWI_INFO_S;
+
 #endif //SMS_PLUGIN_TYPES_H
 
index 073e189..096bdac 100755 (executable)
@@ -126,7 +126,7 @@ void MsgHandle::write(const char *pCmdData, int cmdSize, char **ppEvent)
 
 void MsgHandle::read(char **ppEvent)
 {
-       int dataSize = 0;
+       unsigned int dataSize = 0;
 
        dataSize = mClientSock.read(ppEvent, &dataSize);
 
index 2799f47..9737b15 100755 (executable)
@@ -253,3 +253,38 @@ msg_error_t MsgHandle::getFilterOperation(bool *pSetFlag)
        return ret;
 }
 
+msg_error_t MsgHandle::setFilterActivation(msg_filter_id_t filter_id, bool active)
+{
+       // Allocate Memory to Command Data
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_filter_id_t) + sizeof(bool);
+
+       char cmdBuf[cmdSize];
+       bzero(cmdBuf, cmdSize);
+       MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+       // Set Command Parameters
+       pCmd->cmdType = MSG_CMD_SET_FILTER_ACTIVATION;
+
+       // Copy Cookie
+       memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+       // Copy Command Data
+       memcpy(pCmd->cmdData, &filter_id, sizeof(msg_filter_id_t));
+       memcpy(pCmd->cmdData+sizeof(msg_filter_id_t), &active, sizeof(bool));
+
+       // 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_SET_FILTER_ACTIVATION)
+       {
+               THROW(MsgException::INVALID_RESULT, "Event Data Error");
+       }
+
+       return pEvent->result;
+}
index 37efe95..f837168 100755 (executable)
@@ -337,6 +337,45 @@ msg_error_t MsgHandle::deleteAllMessagesInFolder(msg_folder_id_t FolderId, bool
 }
 
 
+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
@@ -804,6 +843,18 @@ msg_error_t MsgHandle::getThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_s
        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;
+
+       MsgStoConnectDB();
+       err = MsgStoGetConversationViewItem(MsgId, pConv);
+       MsgStoDisconnectDB();
+
+       return err;
+}
 
 msg_error_t MsgHandle::getConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList)
 {
@@ -858,10 +909,10 @@ msg_error_t MsgHandle::getConversationViewList(msg_thread_id_t ThreadId, msg_str
 }
 
 
-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);
@@ -875,6 +926,7 @@ msg_error_t MsgHandle::deleteThreadMessageList(msg_thread_id_t ThreadId)
 
        // 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+sizeof(msg_thread_id_t)), &include_protected_msg, sizeof(bool));
 
        // Send Command to Messaging FW
        char* pEventData = NULL;
@@ -1219,8 +1271,7 @@ msg_error_t MsgHandle::regStorageChangeCallback(msg_storage_change_cb onStorageC
        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);
@@ -1256,7 +1307,7 @@ msg_error_t MsgHandle::getReportStatus(msg_message_id_t msg_id, MSG_REPORT_STATU
        if(pEvent->result != MSG_SUCCESS) return pEvent->result;
 
        // Decode Return Data
-       MsgDecodeReportStatus(pEvent->data, pReport_status);
+       MsgDecodeReportStatus(pEvent->data, report_list);
 
        return MSG_SUCCESS;
 }
index ec3e8bc..9ec05d1 100755 (executable)
@@ -53,7 +53,7 @@ gboolean readSocket(GIOChannel *source, GIOCondition condition, gpointer data)
        }
 
        char* buf = NULL;
-       int len;
+       unsigned int len;
 
        int n = MsgProxyListener::instance()->readFromSocket(&buf, &len);
 
@@ -984,7 +984,7 @@ int  MsgProxyListener::getRemoteFd()
 }
 
 
-int MsgProxyListener::readFromSocket(char** buf, int* len)
+int MsgProxyListener::readFromSocket(char** buf, unsigned int* len)
 {
        return cliSock.read(buf, len);
 }
diff --git a/sms-plugin.manifest b/sms-plugin.manifest
new file mode 100755 (executable)
index 0000000..2a0cec5
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+  <request>
+    <domain name="_"/>
+  </request>
+</manifest>
index 248623d..c2f63ec 100755 (executable)
@@ -239,6 +239,24 @@ bool MsgSettingGetUnknownAutoReject()
        return bUnknownAutoReject;
 }
 
+void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb)
+{
+       if (vconf_notify_key_changed(pKey, pCb, NULL) < 0) {
+               MSG_DEBUG("Fail to regist vconf CB with [%s]", pKey);
+       } else {
+               MSG_DEBUG("Success to regist vconf CB with [%s]", pKey);
+       }
+}
+
+void MsgSettingRemoveVconfCBCommon(const char *pKey, _vconf_change_cb pCb)
+{
+       if (vconf_ignore_key_changed(pKey, pCb) < 0) {
+               MSG_DEBUG("Fail to remove vconf CB with [%s]", pKey);
+       } else {
+               MSG_DEBUG("Success to remove vconf CB with [%s]", pKey);
+       }
+}
+
 
 void MsgSettingRegVconfCB()
 {
@@ -246,31 +264,13 @@ void MsgSettingRegVconfCB()
        MsgSettingGetBool(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, &bAutoReject);
        MsgSettingGetBool(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, &bUnknownAutoReject);
 
-       if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, MsgVconfCB, NULL) < 0) {
-               MSG_DEBUG("Fail to regist vconf CB with [%s]", VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL);
-       }
-
-       if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB, NULL) < 0) {
-               MSG_DEBUG("Fail to regist vconf CB with [%s]", VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL);
-       }
+       MsgSettingRegVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, MsgVconfCB);
+       MsgSettingRegVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB);
 }
 
 void MsgSettingRemoveVconfCB()
 {
-       if (vconf_ignore_key_changed(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, MsgVconfCB) < 0) {
-               MSG_DEBUG("Fail to regist vconf CB with [%s]", VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL);
-       }
-
-       if (vconf_ignore_key_changed(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB) < 0) {
-               MSG_DEBUG("Fail to regist vconf CB with [%s]", VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL);
-       }
-}
+       MsgSettingRemoveVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, MsgVconfCB);
+       MsgSettingRemoveVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB);
 
-void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb)
-{
-       if (vconf_notify_key_changed(pKey, pCb, NULL) < 0) {
-               MSG_DEBUG("Fail to regist vconf CB with [%s]", pKey);
-       } else {
-               MSG_DEBUG("Success to regist vconf CB with [%s]", pKey);
-       }
 }
index 940625c..e5b9eaf 100755 (executable)
@@ -70,7 +70,7 @@ msg_error_t MsgIpcClientSocket::connect(const char* path)
        /* read remote fd for reg func */
        char *rfd = NULL;
        AutoPtr<char> wrap(&rfd);
-       int rlen;
+       unsigned int rlen;
 
        read(&rfd, &rlen);
 
@@ -117,9 +117,10 @@ void MsgIpcClientSocket::addfd(int fd)
                maxfd = fd;
 }
 
-int MsgIpcClientSocket::writen (const char *buf, int len)
+int MsgIpcClientSocket::writen (const char *buf, unsigned int len)
 {
-       int nleft, nwrite;
+       unsigned int nleft;
+       int nwrite;
 
        nleft = len;
        while (nleft > 0) {
@@ -127,9 +128,9 @@ int MsgIpcClientSocket::writen (const char *buf, int len)
                if (nwrite < 0) {
                        MSG_FATAL("writen: sockfd [%d] error [%s]",  sockfd, strerror(errno));
                        return nwrite;
-               }
-               else if (nwrite == 0)
+               } else if (nwrite == 0) {
                        break;
+               }
 
                nleft -= nwrite;
                buf += nwrite;
@@ -137,14 +138,14 @@ int MsgIpcClientSocket::writen (const char *buf, int len)
        return (len-nleft);
 }
 
-int MsgIpcClientSocket::write(const char* buf, int len)
+int MsgIpcClientSocket::write(const char* buf, unsigned int len)
 {
        if (sockfd < 0) {
                MSG_FATAL("sockfd is not opened [%d]", sockfd);
                return CUSTOM_SOCKET_ERROR;
        }
 
-       if (!buf || len <= 0) {
+       if (!buf || len == 0) {
                MSG_FATAL("buf[%p]      and len[%d] MUST NOT NULL", buf, len);
                return CUSTOM_SOCKET_ERROR;
        }
@@ -158,7 +159,7 @@ int MsgIpcClientSocket::write(const char* buf, int len)
 
        /* send the data in subsequence */
        n = writen(buf, len);
-       if (n != len) {
+       if ((unsigned int)n != len) {
                MSG_FATAL("WARNING: write data_size[%d] not matched [%d]", n, len);
                return CUSTOM_SOCKET_ERROR;
        }
@@ -166,9 +167,10 @@ int MsgIpcClientSocket::write(const char* buf, int len)
        return len;
 }
 
-int MsgIpcClientSocket::readn( char *buf, int len )
+int MsgIpcClientSocket::readn( char *buf, unsigned int len )
 {
-       int nleft, nread;
+       unsigned int nleft;
+       int nread;
 
        nleft = len;
        while (nleft > 0) {
@@ -176,19 +178,20 @@ int MsgIpcClientSocket::readn( char *buf, int len )
                if (nread < 0) {
                        MSG_FATAL("WARNING read value %d: %s", nread, strerror(errno));
                        return nread;
-               }
-               else if( nread == 0 )
+               } else if( nread == 0 ) {
                        break;
+               }
 
                nleft -= nread;
                buf += nread;
        }
+
        return (len-nleft);
 }
 
 
 /* what if the buf is shorter than data? */
-int MsgIpcClientSocket::read(char** buf, int* len)
+int MsgIpcClientSocket::read(char** buf, unsigned int* len)
 {
        if (sockfd < 0) {
                MSG_FATAL("socket is not opened [%d]", sockfd);
@@ -205,24 +208,20 @@ int MsgIpcClientSocket::read(char** buf, int* len)
        if (n == CLOSE_CONNECTION_BY_SIGNAL) { /* if msgfw gets down, it signals to all IPC clients */
                MSG_FATAL("sockfd [%d] CLOSE_CONNECTION_BY_SIGNAL", sockfd);
                return n;
-       }
-
-       else if (n != sizeof(int)) {
+       } else if (n != sizeof(int)) {
                MSG_FATAL("WARNING: read header_size[%d] not matched [%d]", n, sizeof(int));
                return CUSTOM_SOCKET_ERROR;
        }
 
        /*  read the data in subsequence */
-       if ((*len) > 0) {
-               unsigned int ulen = (unsigned int)*len;
-               *buf = new char[ulen+1];
-               bzero(*buf, ulen+1);
-               n = readn(*buf, ulen);
+       unsigned int ulen = (unsigned int)*len;
+       *buf = new char[ulen+1];
+       bzero(*buf, ulen+1);
+       n = readn(*buf, ulen);
 
-               if (n !=  ulen) {
-                       MSG_FATAL("WARNING: read data_size [%d] not matched [%d]", n, ulen);
-                       return CUSTOM_SOCKET_ERROR;
-               }
+       if ((unsigned int)n !=  ulen) {
+               MSG_FATAL("WARNING: read data_size [%d] not matched [%d]", n, ulen);
+               return CUSTOM_SOCKET_ERROR;
        }
 
        return n;
@@ -379,9 +378,9 @@ void MsgIpcServerSocket::close(int fd)
        MSG_END();
 }
 
-int MsgIpcServerSocket::readn( int fd, char *buf, int len )
+int MsgIpcServerSocket::readn( int fd, char *buf, unsigned int len )
 {
-       int nleft, nread;
+       unsigned int nleft, nread;
 
        nleft = len;
        while (nleft > 0) {
@@ -428,14 +427,14 @@ int MsgIpcServerSocket::read(int fd, char** buf, int* len )
        if (*len == CLOSE_CONNECTION_BY_USER)
                return *len;
 
-       if ((*len) > 0) {
-               /* read the data in subsequence */
+       /* read the data in subsequence */
+       if (*len > 0) {
                unsigned int ulen = (unsigned int)*len;
                *buf = new char[ulen+1];
                bzero(*buf, ulen+1);
                n = readn(fd, *buf, ulen);
 
-               if (n != ulen) {
+               if ((unsigned int)n != ulen) {
                        MSG_FATAL("WARNING: read data_size [%d] not matched [%d]", n, ulen);
                        return CUSTOM_SOCKET_ERROR;
                }
@@ -444,9 +443,10 @@ int MsgIpcServerSocket::read(int fd, char** buf, int* len )
        return n;
 }
 
-int MsgIpcServerSocket::writen(int fd, const char *buf, int len)
+int MsgIpcServerSocket::writen(int fd, const char *buf, unsigned int len)
 {
-       int nleft, nwrite;
+       unsigned int nleft;
+       int nwrite;
 
        nleft = len;
 
@@ -458,11 +458,9 @@ int MsgIpcServerSocket::writen(int fd, const char *buf, int len)
                if (nwrite < 0) {
                        MSG_FATAL("write: %s", strerror(errno));
                        return nwrite;
-               }
-               else if (nwrite == 0) { /* Nothing is send. */
+               } else if (nwrite == 0) { /* Nothing is send. */
                        break;
-               }
-               else {
+               } else {
                        nleft -= nwrite;
                        buf += nwrite;
                }
@@ -472,7 +470,7 @@ int MsgIpcServerSocket::writen(int fd, const char *buf, int len)
 }
 
 
-int MsgIpcServerSocket::write(int fd, const char* buf, int len)
+int MsgIpcServerSocket::write(int fd, const char* buf, unsigned int len)
 {
        MSG_BEGIN();
 
@@ -496,7 +494,7 @@ int MsgIpcServerSocket::write(int fd, const char* buf, int len)
 
        MSG_DEBUG("Writing %d bytes", n);
 
-       if (n != len) {
+       if ((unsigned int)n != len) {
                MSG_FATAL("Written byte (%d) is not matched to input byte (%d)", n, len);
                return CUSTOM_SOCKET_ERROR;
        }
index 116171e..6b8c534 100755 (executable)
@@ -40,6 +40,7 @@ msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
        char addressVal[MAX_ADDRESS_VAL_LEN+1];
        char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1];
        char displayName[MAX_DISPLAY_NAME_LEN+1];
+       char thumbPath[MAX_IMAGE_PATH_LEN+1];
        char sqlQuery[MAX_QUERY_LEN+1];
 
        memset(tempId, 0x00, sizeof(tempId));
@@ -47,9 +48,10 @@ msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
        memset(firstName, 0x00, sizeof(firstName));
        memset(lastName, 0x00, sizeof(lastName));
        memset(displayName, 0x00, sizeof(displayName));
+       memset(thumbPath, 0x00, sizeof(thumbPath));
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.DISPLAY_TIME, A.CONTACT_ID \
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.DISPLAY_TIME, A.CONTACT_ID, A.IMAGE_PATH \
                        FROM %s A, %s B WHERE B.MSG_ID=%d AND A.CONV_ID=B.CONV_ID;",
                        MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId);
 
@@ -99,6 +101,8 @@ msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
                msgTime = (time_t)pDbHandle->columnInt(5);
 
                contactId = pDbHandle->columnInt(6);
+
+               strncpy(thumbPath, (char*)pDbHandle->columnText(7), MAX_IMAGE_PATH_LEN);
        } else {
                pDbHandle->finalizeQuery();
                return MSG_ERR_DB_STEP;
@@ -130,8 +134,10 @@ msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
 
                memset(&tempId, 0x00, sizeof(tempId));
 
-               snprintf(tempId, 5, "%d", threadId);
-               bundle_add(args, "threadId", tempId);
+               bundle_add(args, "type", "msg_id");
+
+               snprintf(tempId, 5, "%d", pMsg->msgId);
+               bundle_add(args, "msgId", tempId);
        } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.classType == MSG_CLASS_0) {
 
                noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
@@ -146,11 +152,19 @@ msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
                        MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
                }
 
-               snprintf(tempId, 5, "%d", pMsg->msgId);
-               bundle_add(args, "msg_id", tempId);
-       } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_MWI_VOICE_SMS) {
+               noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NORMAL_MSG_ICON_PATH);
+               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                       MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+               }
 
-               noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId);
+               bundle_add(args, "type", "msg_id");
+
+               snprintf(tempId, 5, "%d", pMsg->msgId);
+               bundle_add(args, "msgId", tempId);
+       } else if (pMsg->msgType.mainType == MSG_SMS_TYPE &&
+                       (pMsg->msgType.subType >= MSG_MWI_VOICE_SMS && pMsg->msgType.subType <= MSG_MWI_OTHER_SMS)) {
+
+               noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, NOTIFICATION_PRIV_ID_NONE);
                if (noti == NULL) {
                        MSG_DEBUG("notification_new is failed.");
                        bundle_free(args);
@@ -169,8 +183,9 @@ msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
 
                memset(&tempId, 0x00, sizeof(tempId));
 
-               snprintf(tempId, 5, "%d", threadId);
-               bundle_add(args, "threadId", tempId);
+               bundle_add(args, "launch-type", "MO");
+               bundle_add(args, "number", addressVal);
+
        } else {
                MSG_DEBUG("notification_new pMsg->msgId [%d]", pMsg->msgId);
                noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId);
@@ -192,14 +207,11 @@ msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
 
                memset(&tempId, 0x00, sizeof(tempId));
 
-               snprintf(tempId, 5, "%d", threadId);
-               bundle_add(args, "threadId", tempId);
-       }
-
-       bundle_add(args, "type", "msg_id");
+               bundle_add(args, "type", "msg_id");
 
-       snprintf(tempId, 5, "%d", pMsg->msgId);
-       bundle_add(args, "msgId", tempId);
+               snprintf(tempId, 5, "%d", pMsg->msgId);
+               bundle_add(args, "msgId", tempId);
+       }
 
        if (displayName[0] == '\0')
                notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
@@ -224,6 +236,18 @@ msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
                MSG_DEBUG("Fail to notification_set_time : %d", noti_err);
        }
 
+       if (thumbPath[0] != '\0') {
+               noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL, thumbPath);
+               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                       MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+               }
+
+               noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL_FOR_LOCK, thumbPath);
+               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                       MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+               }
+       }
+
        noti_err = notification_insert(noti, NULL);
        if (noti_err != NOTIFICATION_ERROR_NONE) {
                MSG_DEBUG("Fail to notification_insert");
@@ -239,6 +263,84 @@ msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
        return MSG_SUCCESS;
 }
 
+msg_error_t MsgInsertNoti(MSG_MESSAGE_INFO_S* pMsg)
+{
+       notification_h noti = NULL;
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+       bundle* args;
+
+       char addressVal[MAX_ADDRESS_VAL_LEN+1];
+       char displayName[MAX_DISPLAY_NAME_LEN+1];
+
+       memset(addressVal, 0x00, sizeof(addressVal));
+       memset(displayName, 0x00, sizeof(displayName));
+
+       snprintf(addressVal, sizeof(addressVal), "%s", pMsg->addressList[0].addressVal);
+       snprintf(displayName, sizeof(displayName), "%s", pMsg->addressList[0].displayName);
+
+       if (pMsg->msgType.mainType == MSG_SMS_TYPE &&
+                       (pMsg->msgType.subType >= MSG_MWI_VOICE_SMS && pMsg->msgType.subType <= MSG_MWI_OTHER_SMS)) {
+
+               args = bundle_create();
+
+               noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, NOTIFICATION_PRIV_ID_NONE);
+               if (noti == NULL) {
+                       MSG_DEBUG("notification_new is failed.");
+                       bundle_free(args);
+                       return MSG_ERR_UNKNOWN;
+               }
+
+               noti_err = notification_set_application(noti, "com.samsung.call");
+               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                       MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
+               }
+
+               noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, VOICE_MSG_ICON_PATH);
+               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                       MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+               }
+
+               //FIXME :: Temp code for voice number, 2012.08.16 sangkoo.kim
+               bundle_add(args, "launch-type", "MO");
+               bundle_add(args, "number", pMsg->addressList[0].addressVal);
+
+       } else {
+               return MSG_ERR_INVALID_PARAMETER;
+       }
+
+       if (displayName[0] == '\0')
+               notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+       else
+               notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+
+       notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+
+       if (args != NULL) {
+               noti_err = notification_set_args(noti, args, NULL);
+               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                       MSG_DEBUG("Fail to notification_set_args : %d", noti_err);
+               }
+       }
+
+       noti_err = notification_set_time(noti, pMsg->displayTime);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               MSG_DEBUG("Fail to notification_set_time : %d", noti_err);
+       }
+
+       noti_err = notification_insert(noti, NULL);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               MSG_DEBUG("Fail to notification_insert");
+       }
+
+       noti_err = notification_free(noti);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               MSG_DEBUG("Fail to notification_free");
+       }
+
+       bundle_free(args);
+
+       return MSG_SUCCESS;
+}
 
 msg_error_t MsgInsertSmsReportToNoti(MsgDbHandler *pDbHandle, msg_message_id_t msgId, msg_delivery_report_status_t status)
 {
@@ -354,9 +456,6 @@ msg_error_t MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S
        notification_h noti = NULL;
        notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
 
-       msg_delivery_report_status_t    deliveryStatus;
-       msg_read_report_status_t                readStatus;
-
        char addressVal[MAX_ADDRESS_VAL_LEN+1];
        char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1];
        char displayName[MAX_DISPLAY_NAME_LEN+1];
@@ -370,17 +469,55 @@ msg_error_t MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S
        memset(contents, 0x00, sizeof(contents));
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.DELIVERY_REPORT_STATUS, B.READ_REPORT_STATUS \
-                       FROM %s A, %s B WHERE B.MSG_ID=%d AND A.CONV_ID=B.CONV_ID;",
-                       MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId);
+       int report_status_type;
+       int report_status_value;
+
+       if (pMsg->msgType.subType == MSG_DELIVERYIND_MMS) {
+               report_status_type = MSG_REPORT_TYPE_DELIVERY;
+               MSG_DEBUG("mms subtype is Delivery Report type");
+       } else if (pMsg->msgType.subType == MSG_READORGIND_MMS) {
+               report_status_type = MSG_REPORT_TYPE_READ;
+               MSG_DEBUG("mms subtype is Read Report type");
+       } else {
+               MSG_DEBUG("No matching subtype. subtype [%d]", pMsg->msgType.subType);
+               return MSG_SUCCESS;
+       }
+
+       MSG_ADDRESS_INFO_S *address_info_s = &pMsg->addressList[0];
+       MSG_DEBUG("address info : %s, type : %d", address_info_s->addressVal, address_info_s->addressType);
+
+       if (address_info_s->addressType == MSG_ADDRESS_TYPE_PLMN) {//FIXME: compare 10 char of address
+               snprintf(sqlQuery, sizeof(sqlQuery),
+                       "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.STATUS "
+                       "FROM %s A, %s B "
+                       "WHERE B.MSG_ID=%d AND B.STATUS_TYPE=%d AND A.ADDRESS_VAL LIKE \'%s\';"
+                       , MSGFW_ADDRESS_TABLE_NAME, MSGFW_REPORT_TABLE_NAME, pMsg->msgId, report_status_type, address_info_s->addressVal);
+       } else if (address_info_s->addressType == MSG_ADDRESS_TYPE_EMAIL) {//check full
+               snprintf(sqlQuery, sizeof(sqlQuery),
+                       "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.STATUS "
+                       "FROM %s A, %s B "
+                       "WHERE B.MSG_ID=%d AND B.STATUS_TYPE=%d AND A.ADDRESS_VAL=\'%s\';"
+                       , MSGFW_ADDRESS_TABLE_NAME, MSGFW_REPORT_TABLE_NAME, pMsg->msgId, report_status_type, address_info_s->addressVal);
+       } else {
+               snprintf(sqlQuery, sizeof(sqlQuery),
+                       "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.STATUS "
+                       "FROM %s A, %s B "
+                       "WHERE B.MSG_ID=%d B.STATUS_TYPE=%d;"
+                       , MSGFW_ADDRESS_TABLE_NAME, MSGFW_REPORT_TABLE_NAME, pMsg->msgId, report_status_type);
+       }
+
+       MSG_DEBUG("sqlQuery = [%s]", sqlQuery);
 
        if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
                return MSG_ERR_DB_PREPARE;
 
        if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
-               if (pDbHandle->columnText(0) != NULL)
+               if (pDbHandle->columnText(0) != NULL) {
                        strncpy(addressVal, (char*)pDbHandle->columnText(0), MAX_ADDRESS_VAL_LEN);
-
+                       MSG_DEBUG("addressVal is [%s]",addressVal);
+               } else {
+                       MSG_DEBUG("address Val is Null");
+               }
 
                char *pTempDisplayName = (char *)pDbHandle->columnText(1);
                if (pTempDisplayName != NULL && pTempDisplayName[0] != '\0') {
@@ -415,10 +552,10 @@ msg_error_t MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S
                        }
                }
 
-               deliveryStatus = (msg_delivery_report_status_t)pDbHandle->columnInt(4);
-               readStatus = (msg_read_report_status_t)pDbHandle->columnInt(5);
+               report_status_value = pDbHandle->columnInt(4);
 
        } else {
+               MSG_DEBUG("DB Query Result Fail");
                pDbHandle->finalizeQuery();
                return MSG_ERR_DB_STEP;
        }
@@ -443,7 +580,7 @@ msg_error_t MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S
 
        if (pMsg->msgType.subType == MSG_DELIVERYIND_MMS) {
 
-               switch(deliveryStatus) {
+               switch(report_status_value) {
                case MSG_DELIVERY_REPORT_NONE:
                        noti_err = notification_free(noti);
                        if (noti_err != NOTIFICATION_ERROR_NONE) {
@@ -497,7 +634,7 @@ msg_error_t MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S
 
        } else if (pMsg->msgType.subType == MSG_READORGIND_MMS) {
 
-               switch(readStatus) {
+               switch(report_status_value) {
                case MSG_READ_REPORT_NONE:
                        noti_err = notification_free(noti);
                        if (noti_err != NOTIFICATION_ERROR_NONE)
index 554e00e..d00a59d 100755 (executable)
@@ -79,28 +79,26 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo)
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' = FILTER_VALUE \
-                       UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE SUBSTR(FILTER_VALUE,1)||'%%' \
-                       UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%'||SUBSTR(FILTER_VALUE,1)||'%%';",
-                       MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_SAME, pMsgInfo->addressList[0].addressVal,
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE (CASE WHEN LENGTH(FILTER_VALUE)>%d-1 THEN '%%'||SUBSTR(FILTER_VALUE, LENGTH(FILTER_VALUE)-%d-1) ELSE FILTER_VALUE END) AND FILTER_ACTIVE = 1 \
+                       UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE SUBSTR(FILTER_VALUE,1)||'%%' AND FILTER_ACTIVE = 1 \
+                       UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%'||SUBSTR(FILTER_VALUE,1)||'%%' AND FILTER_ACTIVE = 1;",
+                       MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_SAME, pMsgInfo->addressList[0].addressVal, MAX_PRECONFIG_NUM, MAX_PRECONFIG_NUM,
                        MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_START, pMsgInfo->addressList[0].addressVal,
                        MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_INCLUDE, pMsgInfo->addressList[0].addressVal);
 
        err = pDbHandle->getTable(sqlQuery, &rowCnt);
 
+       if (err == MSG_ERR_DB_GETTABLE) {
+               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+       }
+
        if (rowCnt > 0) {
                MSG_DEBUG("Msg is Filtered by Address : [%s]", pMsgInfo->addressList[0].addressVal);
-
                pDbHandle->freeTable();
-
                pMsgInfo->folderId = MSG_SPAMBOX_ID;
-
                return true;
        } else {
                MSG_DEBUG("Msg is NOT Filtered by Address : [%s]", pMsgInfo->addressList[0].addressVal);
-
-               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-
                pDbHandle->freeTable();
        }
 
similarity index 81%
rename from plugin/sms_plugin/SmsPluginTextConvert.cpp
rename to utils/MsgTextConvert.cpp
index 8db889d..a72768a 100755 (executable)
 #include <glib.h>
 
 #include "MsgDebug.h"
-#include "SmsPluginTextConvert.h"
+#include "MsgTextConvert.h"
 
 
 /*==================================================================================================
                                      IMPLEMENTATION OF MsgConvertText - Member Functions
 ==================================================================================================*/
-SmsPluginTextConvert* SmsPluginTextConvert::pInstance = NULL;
 
-
-SmsPluginTextConvert* SmsPluginTextConvert::instance()
+MsgTextConvert::MsgTextConvert()
 {
-       if (!pInstance)
-               pInstance = new SmsPluginTextConvert();
+       extCharList.clear();
+       ucs2toGSM7DefList.clear();
+       ucs2toGSM7ExtList.clear();
+       ucs2toTurkishList.clear();
+       ucs2toSpanishList.clear();
+       ucs2toPortuList.clear();
+
+       extCharList[0x000C] = MSG_CHAR_GSM7EXT;
+       extCharList[0x005B] = MSG_CHAR_GSM7EXT;
+       extCharList[0x005C] = MSG_CHAR_GSM7EXT;
+       extCharList[0x005D] = MSG_CHAR_GSM7EXT;
+       extCharList[0x005E] = MSG_CHAR_GSM7EXT;
+       extCharList[0x007B] = MSG_CHAR_GSM7EXT;
+       extCharList[0x007C] = MSG_CHAR_GSM7EXT;
+       extCharList[0x007D] = MSG_CHAR_GSM7EXT;
+       extCharList[0x007E] = MSG_CHAR_GSM7EXT;
+       extCharList[0x20AC] = MSG_CHAR_GSM7EXT; // ��
+
+       extCharList[0x00E7] = MSG_CHAR_TURKISH;
+       extCharList[0x011E] = MSG_CHAR_TURKISH;
+       extCharList[0x011F] = MSG_CHAR_TURKISH;
+       extCharList[0x01E6] = MSG_CHAR_TURKISH;
+       extCharList[0x01E7] = MSG_CHAR_TURKISH;
+       extCharList[0x0130] = MSG_CHAR_TURKISH;
+       extCharList[0x0131] = MSG_CHAR_TURKISH;
+       extCharList[0x015E] = MSG_CHAR_TURKISH;
+       extCharList[0x015F] = MSG_CHAR_TURKISH;
+
+       extCharList[0x00C1] = MSG_CHAR_SPANISH;
+       extCharList[0x00E1] = MSG_CHAR_SPANISH;
+       extCharList[0x00CD] = MSG_CHAR_SPANISH;
+       extCharList[0x00ED] = MSG_CHAR_SPANISH;
+       extCharList[0x00D3] = MSG_CHAR_SPANISH;
+       extCharList[0x00F3] = MSG_CHAR_SPANISH;
+       extCharList[0x00DA] = MSG_CHAR_SPANISH;
+       extCharList[0x00FA] = MSG_CHAR_SPANISH;
+
+       extCharList[0x00D4] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00F4] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00CA] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00EA] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00C0] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00E7] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00C3] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00E3] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00D5] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00F5] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00C2] = MSG_CHAR_PORTUGUESE;
+       extCharList[0x00E2] = MSG_CHAR_PORTUGUESE;
+
+       for (unsigned char i = 0; i < 128; i++)
+       {
+               ucs2toGSM7DefList[g_GSM7BitToUCS2[i]] = i;
+       }
+
+       // GSM 7 bit Extension
+       ucs2toGSM7ExtList[0x005B] = 0x3C; // [
+       ucs2toGSM7ExtList[0x005D] = 0x3E; // ]
+       ucs2toGSM7ExtList[0x007B] = 0x28; // {
+       ucs2toGSM7ExtList[0x007D] = 0x29; // }
+       ucs2toGSM7ExtList[0x000C] = 0x0A; // Page Break
+       ucs2toGSM7ExtList[0x005C] = 0x2F; /* \ */
+       ucs2toGSM7ExtList[0x005E] = 0x14; // ^
+       ucs2toGSM7ExtList[0x007C] = 0x40; // |
+       ucs2toGSM7ExtList[0x007E] = 0x3D; // ~
+       ucs2toGSM7ExtList[0x20AC] = 0x65; // ��
+
+       // Turkish
+       ucs2toTurkishList[0x005B] = 0x3C; // [
+       ucs2toTurkishList[0x005D] = 0x3E; // ]
+       ucs2toTurkishList[0x007B] = 0x28; // {
+       ucs2toTurkishList[0x007D] = 0x29; // }
+       ucs2toTurkishList[0x000C] = 0x0A; // Page Break
+       ucs2toTurkishList[0x005C] = 0x2F; /* \ */
+       ucs2toTurkishList[0x005E] = 0x14; // ^
+       ucs2toTurkishList[0x007C] = 0x40; // |
+       ucs2toTurkishList[0x007E] = 0x3D; // ~
+       ucs2toTurkishList[0x20AC] = 0x65; // ��
+       ucs2toTurkishList[0x00E7] = 0x63; // c LATIN SMALL LETTER S WITH CEDILLA *
+       ucs2toTurkishList[0x011E] = 0x47; // G LATIN CAPITAL LETTER G WITH BREVE
+       ucs2toTurkishList[0x011F] = 0x67; // g LATIN SMALL LETTER G WITH BREVE
+       ucs2toTurkishList[0x01E6] = 0x47; // G LATIN CAPITAL LETTER G WITH CARON
+       ucs2toTurkishList[0x01E7] = 0x67; // g LATIN SMALL LETTER G WITH CARON
+       ucs2toTurkishList[0x0130] = 0x49; // I LATIN CAPITAL LETTER I WITH DOT ABOVE
+       ucs2toTurkishList[0x0131] = 0x69; // i LATIN SMALL LETTER DOTLESS
+       ucs2toTurkishList[0x015E] = 0x53; // S LATIN CAPITAL LETTER S WITH CEDILLA *
+       ucs2toTurkishList[0x015F] = 0x73; // s LATIN SMALL LETTER S WITH CEDILLA *
+
+       // Spanish
+       ucs2toSpanishList[0x005B] = 0x3C; // [
+       ucs2toSpanishList[0x005D] = 0x3E; // ]
+       ucs2toSpanishList[0x007B] = 0x28; // {
+       ucs2toSpanishList[0x007D] = 0x29; // }
+       ucs2toSpanishList[0x000C] = 0x0A; // Page Break
+       ucs2toSpanishList[0x005C] = 0x2F; /* \ */
+       ucs2toSpanishList[0x005E] = 0x14; // ^
+       ucs2toSpanishList[0x007C] = 0x40; // |
+       ucs2toSpanishList[0x007E] = 0x3D; // ~
+       ucs2toSpanishList[0x20AC] = 0x65; // ��
+       ucs2toSpanishList[0x00C1] = 0x41; // A
+       ucs2toSpanishList[0x00E1] = 0x61; // a
+       ucs2toSpanishList[0x00CD] = 0x49; // I
+       ucs2toSpanishList[0x00ED] = 0x69; // i
+       ucs2toSpanishList[0x00D3] = 0x4F; // O
+       ucs2toSpanishList[0x00F3] = 0x6F; // o
+       ucs2toSpanishList[0x00DA] = 0x55; // U
+       ucs2toSpanishList[0x00FA] = 0x75; // u
+
+       // Portuguese
+       ucs2toPortuList[0x005B] = 0x3C; // [
+       ucs2toPortuList[0x005D] = 0x3E; // ]
+       ucs2toPortuList[0x007B] = 0x28; // {
+       ucs2toPortuList[0x007D] = 0x29; // }
+       ucs2toPortuList[0x000C] = 0x0A; // Page Break
+       ucs2toPortuList[0x005C] = 0x2F; /* \ */
+       ucs2toPortuList[0x005E] = 0x14; // ^
+       ucs2toPortuList[0x007C] = 0x40; // |
+       ucs2toPortuList[0x007E] = 0x3D; // ~
+       ucs2toPortuList[0x20AC] = 0x65; // ��
+       ucs2toPortuList[0x00D4] = 0x0B; // O
+       ucs2toPortuList[0x00F4] = 0x0C; // o
+       ucs2toPortuList[0x00C1] = 0x0E; // A
+       ucs2toPortuList[0x00E1] = 0x0F; // a
+       ucs2toPortuList[0x00CA] = 0x1F; // E
+       ucs2toPortuList[0x00EA] = 0x05; // e
+       ucs2toPortuList[0x00C0] = 0x41; // A
+       ucs2toPortuList[0x00E7] = 0x09; // c
+       ucs2toPortuList[0x00CD] = 0x49; // I
+       ucs2toPortuList[0x00ED] = 0x69; // i
+       ucs2toPortuList[0x00D3] = 0x4F; // O
+       ucs2toPortuList[0x00F3] = 0x6F; // o
+       ucs2toPortuList[0x00DA] = 0x55; // U
+       ucs2toPortuList[0x00FA] = 0x75; // u
+       ucs2toPortuList[0x00C3] = 0x61; // A
+       ucs2toPortuList[0x00E3] = 0x7B; // a
+       ucs2toPortuList[0x00D5] = 0x5C; // O
+       ucs2toPortuList[0x00F5] = 0x7C; // o
+       ucs2toPortuList[0x00C2] = 0x61; // A
+       ucs2toPortuList[0x00E2] = 0x7F; // a
+       ucs2toPortuList[0x03A6] = 0x12; // ��
+       ucs2toPortuList[0x0393] = 0x13; // ��
+       ucs2toPortuList[0x03A9] = 0x15; // ��
+       ucs2toPortuList[0x03A0] = 0x16; // ��
+       ucs2toPortuList[0x03A8] = 0x17; // ��
+       ucs2toPortuList[0x03A3] = 0x18; // ��
+       ucs2toPortuList[0x0398] = 0x19; // ��
+}
 
-       return pInstance;
+
+MsgTextConvert::~MsgTextConvert()
+{
+       extCharList.clear();
+       ucs2toGSM7DefList.clear();
+       ucs2toGSM7ExtList.clear();
+       ucs2toTurkishList.clear();
+       ucs2toSpanishList.clear();
+       ucs2toPortuList.clear();
 }
 
 
-int SmsPluginTextConvert::convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT SMS_LANGUAGE_ID_T *pLangId)
+
+int MsgTextConvert::convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId)
 {
        int utf8Length = 0;
        int gsm7bitLength = 0;
@@ -72,7 +224,7 @@ return :
                byte length of converted UCS2 characters
                        -1 : converting error
 */
-int SmsPluginTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
+int MsgTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
 {
        int i, j;
        int textLen;
@@ -137,7 +289,7 @@ int SmsPluginTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int
 }
 
 
-int SmsPluginTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT msg_encode_type_t *pCharType)
+int MsgTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT msg_encode_type_t *pCharType)
 {
        int utf8Length = 0;
        int gsm7bitLength = 0;
@@ -191,7 +343,7 @@ int SmsPluginTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int
 return:
                bytelength of UTF8 text
 */
-int SmsPluginTextConvert::convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, IN SMS_LANG_INFO_S *pLangInfo)
+int MsgTextConvert::convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo)
 {
        int utf8Length = 0;
        int ucs2Length = 0;
@@ -220,7 +372,7 @@ return :
                byte length of converted UTF8 characters
                        -1 : The alpha isn't the gsm 7bit code
 */
-int SmsPluginTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN  int srcTextLen)
+int MsgTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN  int srcTextLen)
 {
        int remainedBuffer = maxLength;
        int utf8Length;
@@ -262,7 +414,7 @@ int SmsPluginTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int
 }
 
 
-int SmsPluginTextConvert::convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN  int srcTextLen)
+int MsgTextConvert::convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN  int srcTextLen)
 {
        int remainedBuffer = maxLength;
        int utf8Length;
@@ -315,7 +467,7 @@ return:
                bytelength of gsm7bit text
                -1 : converting error
 */
-int SmsPluginTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT SMS_LANGUAGE_ID_T *pLangId)
+int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId)
 {
        // for UNICODE
        int outTextLen = 0;
@@ -330,8 +482,8 @@ int SmsPluginTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN
        std::map<unsigned short, unsigned char>::iterator itChar;
        std::map<unsigned short, unsigned char>::iterator itExt;
 
-       SMS_CHAR_TYPE_T currType = SMS_CHAR_DEFAULT;
-       SMS_CHAR_TYPE_T newType = SMS_CHAR_DEFAULT;
+       MSG_CHAR_TYPE_T currType = MSG_CHAR_DEFAULT;
+       MSG_CHAR_TYPE_T newType = MSG_CHAR_DEFAULT;
 
        unsigned short inText;
 
@@ -351,7 +503,7 @@ int SmsPluginTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN
 
                if (itExt != extCharList.end())
                {
-                       newType = (SMS_CHAR_TYPE_T)itExt->second;
+                       newType = (MSG_CHAR_TYPE_T)itExt->second;
 
                        if (newType >= currType)
                        {
@@ -382,7 +534,7 @@ MSG_DEBUG("default char");
                }
                else
                {
-                       if (currType == SMS_CHAR_GSM7EXT)
+                       if (currType == MSG_CHAR_GSM7EXT)
                        {
                                itExt = ucs2toGSM7ExtList.find(inText);
 
@@ -403,9 +555,9 @@ MSG_DEBUG("default char");
                                        pDestText[outTextLen++] = 0x20;
                                }
                        }
-                       else if (currType == SMS_CHAR_TURKISH)
+                       else if (currType == MSG_CHAR_TURKISH)
                        {
-                               *pLangId = SMS_LANG_ID_TURKISH;
+                               *pLangId = MSG_LANG_ID_TURKISH;
 
                                itExt = ucs2toTurkishList.find(inText);
 
@@ -426,9 +578,9 @@ MSG_DEBUG("default char");
                                        pDestText[outTextLen++] = 0x20;
                                }
                        }
-                       else if (currType == SMS_CHAR_SPANISH)
+                       else if (currType == MSG_CHAR_SPANISH)
                        {
-                               *pLangId = SMS_LANG_ID_SPANISH;
+                               *pLangId = MSG_LANG_ID_SPANISH;
 
                                itExt = ucs2toSpanishList.find(inText);
 
@@ -449,9 +601,9 @@ MSG_DEBUG("default char");
                                        pDestText[outTextLen++] = 0x20;
                                }
                        }
-                       else if (currType == SMS_CHAR_PORTUGUESE)
+                       else if (currType == MSG_CHAR_PORTUGUESE)
                        {
-                               *pLangId = SMS_LANG_ID_PORTUGUESE;
+                               *pLangId = MSG_LANG_ID_PORTUGUESE;
 
                                itExt = ucs2toPortuList.find(inText);
 
@@ -499,7 +651,7 @@ MSG_DEBUG("no char");
 }
 
 
-int SmsPluginTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown)
+int MsgTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown)
 {
        // for UNICODE
        int outTextLen = 0;
@@ -585,7 +737,7 @@ int SmsPluginTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText,
                byte length of converted UCS2 characters
                        -1 : The alpha isn't the gsm 7bit code
 */
-int SmsPluginTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN SMS_LANG_INFO_S *pLangInfo)
+int MsgTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo)
 {
        int outTextLen = 0;
        unsigned char lowerByte = 0, upperByte = 0;
@@ -614,7 +766,7 @@ int SmsPluginTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN
                {
                        MSG_DEBUG("Locking Shift [%d]", pLangInfo->lockingLang);
 
-                       if (pLangInfo->lockingLang == SMS_LANG_ID_TURKISH)
+                       if (pLangInfo->lockingLang == MSG_LANG_ID_TURKISH)
                        {
                                // Check Escape
                                if (g_TurkishLockingToUCS2[pSrcText[i]] == 0x001B)
@@ -625,17 +777,17 @@ int SmsPluginTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN
                                        {
                                                MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang);
 
-                                               if (pLangInfo->singleLang == SMS_LANG_ID_TURKISH)
+                                               if (pLangInfo->singleLang == MSG_LANG_ID_TURKISH)
                                                {
                                                        lowerByte = g_TurkishSingleToUCS2[pSrcText[i]] & 0x00FF;
                                                        upperByte = (g_TurkishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
                                                }
-                                               else if (pLangInfo->singleLang == SMS_LANG_ID_SPANISH)
+                                               else if (pLangInfo->singleLang == MSG_LANG_ID_SPANISH)
                                                {
                                                        lowerByte = g_SpanishSingleToUCS2[pSrcText[i]] & 0x00FF;
                                                        upperByte = (g_SpanishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
                                                }
-                                               else if (pLangInfo->singleLang == SMS_LANG_ID_PORTUGUESE)
+                                               else if (pLangInfo->singleLang == MSG_LANG_ID_PORTUGUESE)
                                                {
                                                        lowerByte = g_PortuSingleToUCS2[pSrcText[i]] & 0x00FF;
                                                        upperByte = (g_PortuSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
@@ -658,7 +810,7 @@ int SmsPluginTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN
                                        upperByte = (g_TurkishLockingToUCS2[pSrcText[i]] & 0xFF00) >> 8;
                                }
                        }
-                       else if (pLangInfo->lockingLang == SMS_LANG_ID_PORTUGUESE)
+                       else if (pLangInfo->lockingLang == MSG_LANG_ID_PORTUGUESE)
                        {
                                // Check Escape
                                if (g_PortuLockingToUCS2[pSrcText[i]] == 0x001B)
@@ -669,17 +821,17 @@ int SmsPluginTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN
                                        {
                                                MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang);
 
-                                               if (pLangInfo->singleLang == SMS_LANG_ID_TURKISH)
+                                               if (pLangInfo->singleLang == MSG_LANG_ID_TURKISH)
                                                {
                                                        lowerByte = g_TurkishSingleToUCS2[pSrcText[i]] & 0x00FF;
                                                        upperByte = (g_TurkishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
                                                }
-                                               else if (pLangInfo->singleLang == SMS_LANG_ID_SPANISH)
+                                               else if (pLangInfo->singleLang == MSG_LANG_ID_SPANISH)
                                                {
                                                        lowerByte = g_SpanishSingleToUCS2[pSrcText[i]] & 0x00FF;
                                                        upperByte = (g_SpanishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
                                                }
-                                               else if (pLangInfo->singleLang == SMS_LANG_ID_PORTUGUESE)
+                                               else if (pLangInfo->singleLang == MSG_LANG_ID_PORTUGUESE)
                                                {
                                                        lowerByte = g_PortuSingleToUCS2[pSrcText[i]] & 0x00FF;
                                                        upperByte = (g_PortuSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
@@ -714,17 +866,17 @@ int SmsPluginTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN
                                {
                                        MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang);
 
-                                       if (pLangInfo->singleLang == SMS_LANG_ID_TURKISH)
+                                       if (pLangInfo->singleLang == MSG_LANG_ID_TURKISH)
                                        {
                                                lowerByte = g_TurkishSingleToUCS2[pSrcText[i]] & 0x00FF;
                                                upperByte = (g_TurkishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
                                        }
-                                       else if (pLangInfo->singleLang == SMS_LANG_ID_SPANISH)
+                                       else if (pLangInfo->singleLang == MSG_LANG_ID_SPANISH)
                                        {
                                                lowerByte = g_SpanishSingleToUCS2[pSrcText[i]] & 0x00FF;
                                                upperByte = (g_SpanishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
                                        }
-                                       else if (pLangInfo->singleLang == SMS_LANG_ID_PORTUGUESE)
+                                       else if (pLangInfo->singleLang == MSG_LANG_ID_PORTUGUESE)
                                        {
                                                lowerByte = g_PortuSingleToUCS2[pSrcText[i]] & 0x00FF;
                                                upperByte = (g_PortuSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
@@ -763,7 +915,7 @@ int SmsPluginTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN
 }
 
 
-void SmsPluginTextConvert::convertDumpTextToHex(const unsigned char *pText, int length)
+void MsgTextConvert::convertDumpTextToHex(const unsigned char *pText, int length)
 {
        printf("\n=======================================\n");
        printf("   Dump Text To Hex - Length :%d\n", length);
@@ -780,172 +932,3 @@ void SmsPluginTextConvert::convertDumpTextToHex(const unsigned char *pText, int
 
        printf("\n=======================================\n\n");
 }
-
-
-SmsPluginTextConvert::SmsPluginTextConvert()
-{
-       extCharList.clear();
-       ucs2toGSM7DefList.clear();
-       ucs2toGSM7ExtList.clear();
-       ucs2toTurkishList.clear();
-       ucs2toSpanishList.clear();
-       ucs2toPortuList.clear();
-
-       extCharList[0x000C] = SMS_CHAR_GSM7EXT;
-       extCharList[0x005B] = SMS_CHAR_GSM7EXT;
-       extCharList[0x005C] = SMS_CHAR_GSM7EXT;
-       extCharList[0x005D] = SMS_CHAR_GSM7EXT;
-       extCharList[0x005E] = SMS_CHAR_GSM7EXT;
-       extCharList[0x007B] = SMS_CHAR_GSM7EXT;
-       extCharList[0x007C] = SMS_CHAR_GSM7EXT;
-       extCharList[0x007D] = SMS_CHAR_GSM7EXT;
-       extCharList[0x007E] = SMS_CHAR_GSM7EXT;
-       extCharList[0x20AC] = SMS_CHAR_GSM7EXT; // ¢æ
-
-       extCharList[0x00E7] = SMS_CHAR_TURKISH;
-       extCharList[0x011E] = SMS_CHAR_TURKISH;
-       extCharList[0x011F] = SMS_CHAR_TURKISH;
-       extCharList[0x01E6] = SMS_CHAR_TURKISH;
-       extCharList[0x01E7] = SMS_CHAR_TURKISH;
-       extCharList[0x0130] = SMS_CHAR_TURKISH;
-       extCharList[0x0131] = SMS_CHAR_TURKISH;
-       extCharList[0x015E] = SMS_CHAR_TURKISH;
-       extCharList[0x015F] = SMS_CHAR_TURKISH;
-
-       extCharList[0x00C1] = SMS_CHAR_SPANISH;
-       extCharList[0x00E1] = SMS_CHAR_SPANISH;
-       extCharList[0x00CD] = SMS_CHAR_SPANISH;
-       extCharList[0x00ED] = SMS_CHAR_SPANISH;
-       extCharList[0x00D3] = SMS_CHAR_SPANISH;
-       extCharList[0x00F3] = SMS_CHAR_SPANISH;
-       extCharList[0x00DA] = SMS_CHAR_SPANISH;
-       extCharList[0x00FA] = SMS_CHAR_SPANISH;
-
-       extCharList[0x00D4] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00F4] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00CA] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00EA] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00C0] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00E7] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00C3] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00E3] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00D5] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00F5] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00C2] = SMS_CHAR_PORTUGUESE;
-       extCharList[0x00E2] = SMS_CHAR_PORTUGUESE;
-
-       for (unsigned char i = 0; i < 128; i++)
-       {
-               ucs2toGSM7DefList[g_GSM7BitToUCS2[i]] = i;
-       }
-
-       // GSM 7 bit Extension
-       ucs2toGSM7ExtList[0x005B] = 0x3C; // [
-       ucs2toGSM7ExtList[0x005D] = 0x3E; // ]
-       ucs2toGSM7ExtList[0x007B] = 0x28; // {
-       ucs2toGSM7ExtList[0x007D] = 0x29; // }
-       ucs2toGSM7ExtList[0x000C] = 0x0A; // Page Break
-       ucs2toGSM7ExtList[0x005C] = 0x2F; /* \ */
-       ucs2toGSM7ExtList[0x005E] = 0x14; // ^
-       ucs2toGSM7ExtList[0x007C] = 0x40; // |
-       ucs2toGSM7ExtList[0x007E] = 0x3D; // ~
-       ucs2toGSM7ExtList[0x20AC] = 0x65; // ¢æ
-
-       // Turkish
-       ucs2toTurkishList[0x005B] = 0x3C; // [
-       ucs2toTurkishList[0x005D] = 0x3E; // ]
-       ucs2toTurkishList[0x007B] = 0x28; // {
-       ucs2toTurkishList[0x007D] = 0x29; // }
-       ucs2toTurkishList[0x000C] = 0x0A; // Page Break
-       ucs2toTurkishList[0x005C] = 0x2F; /* \ */
-       ucs2toTurkishList[0x005E] = 0x14; // ^
-       ucs2toTurkishList[0x007C] = 0x40; // |
-       ucs2toTurkishList[0x007E] = 0x3D; // ~
-       ucs2toTurkishList[0x20AC] = 0x65; // ¢æ
-       ucs2toTurkishList[0x00E7] = 0x63; // c LATIN SMALL LETTER S WITH CEDILLA *
-       ucs2toTurkishList[0x011E] = 0x47; // G LATIN CAPITAL LETTER G WITH BREVE
-       ucs2toTurkishList[0x011F] = 0x67; // g LATIN SMALL LETTER G WITH BREVE
-       ucs2toTurkishList[0x01E6] = 0x47; // G LATIN CAPITAL LETTER G WITH CARON
-       ucs2toTurkishList[0x01E7] = 0x67; // g LATIN SMALL LETTER G WITH CARON
-       ucs2toTurkishList[0x0130] = 0x49; // I LATIN CAPITAL LETTER I WITH DOT ABOVE
-       ucs2toTurkishList[0x0131] = 0x69; // i LATIN SMALL LETTER DOTLESS
-       ucs2toTurkishList[0x015E] = 0x53; // S LATIN CAPITAL LETTER S WITH CEDILLA *
-       ucs2toTurkishList[0x015F] = 0x73; // s LATIN SMALL LETTER S WITH CEDILLA *
-
-       // Spanish
-       ucs2toSpanishList[0x005B] = 0x3C; // [
-       ucs2toSpanishList[0x005D] = 0x3E; // ]
-       ucs2toSpanishList[0x007B] = 0x28; // {
-       ucs2toSpanishList[0x007D] = 0x29; // }
-       ucs2toSpanishList[0x000C] = 0x0A; // Page Break
-       ucs2toSpanishList[0x005C] = 0x2F; /* \ */
-       ucs2toSpanishList[0x005E] = 0x14; // ^
-       ucs2toSpanishList[0x007C] = 0x40; // |
-       ucs2toSpanishList[0x007E] = 0x3D; // ~
-       ucs2toSpanishList[0x20AC] = 0x65; // ¢æ
-       ucs2toSpanishList[0x00C1] = 0x41; // A
-       ucs2toSpanishList[0x00E1] = 0x61; // a
-       ucs2toSpanishList[0x00CD] = 0x49; // I
-       ucs2toSpanishList[0x00ED] = 0x69; // i
-       ucs2toSpanishList[0x00D3] = 0x4F; // O
-       ucs2toSpanishList[0x00F3] = 0x6F; // o
-       ucs2toSpanishList[0x00DA] = 0x55; // U
-       ucs2toSpanishList[0x00FA] = 0x75; // u
-
-       // Portuguese
-       ucs2toPortuList[0x005B] = 0x3C; // [
-       ucs2toPortuList[0x005D] = 0x3E; // ]
-       ucs2toPortuList[0x007B] = 0x28; // {
-       ucs2toPortuList[0x007D] = 0x29; // }
-       ucs2toPortuList[0x000C] = 0x0A; // Page Break
-       ucs2toPortuList[0x005C] = 0x2F; /* \ */
-       ucs2toPortuList[0x005E] = 0x14; // ^
-       ucs2toPortuList[0x007C] = 0x40; // |
-       ucs2toPortuList[0x007E] = 0x3D; // ~
-       ucs2toPortuList[0x20AC] = 0x65; // ¢æ
-       ucs2toPortuList[0x00D4] = 0x0B; // O
-       ucs2toPortuList[0x00F4] = 0x0C; // o
-       ucs2toPortuList[0x00C1] = 0x0E; // A
-       ucs2toPortuList[0x00E1] = 0x0F; // a
-       ucs2toPortuList[0x00CA] = 0x1F; // E
-       ucs2toPortuList[0x00EA] = 0x05; // e
-       ucs2toPortuList[0x00C0] = 0x41; // A
-       ucs2toPortuList[0x00E7] = 0x09; // c
-       ucs2toPortuList[0x00CD] = 0x49; // I
-       ucs2toPortuList[0x00ED] = 0x69; // i
-       ucs2toPortuList[0x00D3] = 0x4F; // O
-       ucs2toPortuList[0x00F3] = 0x6F; // o
-       ucs2toPortuList[0x00DA] = 0x55; // U
-       ucs2toPortuList[0x00FA] = 0x75; // u
-       ucs2toPortuList[0x00C3] = 0x61; // A
-       ucs2toPortuList[0x00E3] = 0x7B; // a
-       ucs2toPortuList[0x00D5] = 0x5C; // O
-       ucs2toPortuList[0x00F5] = 0x7C; // o
-       ucs2toPortuList[0x00C2] = 0x61; // A
-       ucs2toPortuList[0x00E2] = 0x7F; // a
-       ucs2toPortuList[0x03A6] = 0x12; // ¥Õ
-       ucs2toPortuList[0x0393] = 0x13; // ¥Ã
-       ucs2toPortuList[0x03A9] = 0x15; // ¥Ø
-       ucs2toPortuList[0x03A0] = 0x16; // ¥Ð
-       ucs2toPortuList[0x03A8] = 0x17; // ¥×
-       ucs2toPortuList[0x03A3] = 0x18; // ¥Ò
-       ucs2toPortuList[0x0398] = 0x19; // ¥È
-}
-
-
-SmsPluginTextConvert::~SmsPluginTextConvert()
-{
-       extCharList.clear();
-       ucs2toGSM7DefList.clear();
-       ucs2toGSM7ExtList.clear();
-       ucs2toTurkishList.clear();
-       ucs2toSpanishList.clear();
-       ucs2toPortuList.clear();
-
-       if (pInstance)
-       {
-               delete pInstance;
-               pInstance = NULL;
-       }
-}
-
index b8deb33..e64ee27 100755 (executable)
@@ -887,7 +887,7 @@ void MsgMmsInitDir()
                return;
        }
 
-       // Remove temporal Mms folder (/opt/data/msg-service/msgdata/*.dir)
+       // Remove temporal Mms folder (/opt/usr/data/msg-service/msgdata/*.dir)
        while ((d = readdir(dir)) != NULL) {
                if (d->d_type == DT_DIR) {
                        if ((strcmp(".", d->d_name) == 0) || (strcmp("..", d->d_name) == 0))
index a45a11c..0d74686 100755 (executable)
@@ -357,17 +357,21 @@ int MsgEncodeStorageChangeData(const msg_storage_change_type_t storageChangeType
 }
 
 
-int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, char **ppDest)
+int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, int count, char **ppDest)
 {
        int dataSize = 0;
 
-       dataSize = (sizeof(MSG_REPORT_STATUS_INFO_S));
+       dataSize = (sizeof(MSG_REPORT_STATUS_INFO_S)*count + sizeof(int));
 
        *ppDest = (char*)new char[dataSize];
 
        void* p = (void*)*ppDest;
 
-       memcpy(p, pReportStatus, dataSize);
+       memcpy(p, &count, sizeof(int));
+
+       p = (void*)((int)p + sizeof(int));
+
+       memcpy(p, pReportStatus, sizeof(MSG_REPORT_STATUS_INFO_S)*count);
 
        return dataSize;
 }
@@ -564,33 +568,39 @@ void      MsgDecodeContactCount(char *pSrc,  MSG_THREAD_COUNT_INFO_S *pMsgThreadCount
 }
 
 
-void   MsgDecodeReportStatus(char *pSrc,  MSG_REPORT_STATUS_INFO_S *pReportStatus)
+void MsgDecodeReportStatus(char *pSrc,  msg_struct_list_s *report_list)
 {
        int count = 0;
 
        if(pSrc == NULL)
                return;
 
-       memcpy(&count, pSrc, sizeof(msg_delivery_report_status_t));
-       pSrc = pSrc + sizeof(msg_delivery_report_status_t);
-       pReportStatus->deliveryStatus = count;
+       memcpy(&count, pSrc, sizeof(int));
+       pSrc = pSrc + sizeof(int);
 
+       report_list->nCount = count;
 
-       memcpy(&count, pSrc, sizeof(time_t));
-       pSrc = pSrc + sizeof(time_t);
-       pReportStatus->deliveryStatusTime = count;
+       msg_struct_t *report_status =  (msg_struct_t *)new char[sizeof(msg_struct_t)*count];
+       for (int i = 0; i < count; i++) {
 
+               msg_struct_s *report_status_item = new msg_struct_s;
+               report_status_item->type = MSG_STRUCT_REPORT_STATUS_INFO;
+               report_status_item->data = new MSG_REPORT_STATUS_INFO_S;
+               memset(report_status_item->data, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S));
 
-       memcpy(&count, pSrc, sizeof(msg_read_report_status_t));
-       pSrc = pSrc + sizeof(msg_read_report_status_t);
-       pReportStatus->readStatus = count;
+               MSG_REPORT_STATUS_INFO_S *report_status_info =  (MSG_REPORT_STATUS_INFO_S *)report_status_item->data;
+               memcpy(report_status_info, pSrc, sizeof(MSG_REPORT_STATUS_INFO_S));
 
+               pSrc = pSrc + sizeof(MSG_REPORT_STATUS_INFO_S);
 
-       memcpy(&count, pSrc, sizeof(time_t));
-       pSrc = pSrc + sizeof(time_t);
-       pReportStatus->readStatusTime = count;
+               report_status[i] = (msg_struct_t)report_status_item;
 
+               MSG_DEBUG("Report_type = %d, status addr = %s, status = %d, time = %d",
+                               report_status_info->type, report_status_info->addressVal,
+                               report_status_info->status, report_status_info->statusTime);
+       }
 
+       report_list->msg_struct_info = report_status;
        return;
 }
 
index a5aaccc..8f59666 100755 (executable)
@@ -63,10 +63,10 @@ unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_IN
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, %d, 0, %d, 0, 0);",
+       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, 0, 0, 0);",
                        MSGFW_MESSAGE_TABLE_NAME, msgId, pMsgInfo->threadId, pMsgInfo->folderId, pMsgInfo->storageId, pMsgInfo->msgType.mainType,
                        pMsgInfo->msgType.subType, pMsgInfo->displayTime, pMsgInfo->dataSize, pMsgInfo->networkStatus, pMsgInfo->bRead, pMsgInfo->bProtected,
-                       pMsgInfo->priority, pMsgInfo->direction, 0, pMsgInfo->bBackup, MSG_DELIVERY_REPORT_NONE, MSG_READ_REPORT_NONE);
+                       pMsgInfo->priority, pMsgInfo->direction, 0, pMsgInfo->bBackup);
 
        MSG_DEBUG("QUERY : %s", sqlQuery);
 
@@ -477,7 +477,7 @@ msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t ms
        char lastName[MAX_DISPLAY_NAME_LEN+1];
 
        pAddress->nCount = 0;
-       pAddress->nCount = NULL;
+       pAddress->msg_struct_info = NULL;
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_TYPE, A.RECIPIENT_TYPE, \
@@ -659,11 +659,13 @@ msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t co
        char msgText[MAX_THREAD_DATA_LEN+1];
        char sqlQuery[MAX_QUERY_LEN+1];
 
+       memset(msgText, 0x00, sizeof(msgText));
+
        // Get Unread Count
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND FOLDER_ID = %d AND READ_STATUS = 0;",
-                       MSGFW_MESSAGE_TABLE_NAME, convId, MSG_INBOX_ID);
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND FOLDER_ID = %d AND STORAGE_ID = %d AND READ_STATUS = 0;",
+                       MSGFW_MESSAGE_TABLE_NAME, convId, MSG_INBOX_ID, MSG_STORAGE_PHONE);
 
        if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
                return MSG_ERR_DB_PREPARE;
@@ -682,8 +684,8 @@ msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t co
        // Get SMS Count
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND MAIN_TYPE = %d AND FOLDER_ID > 0 AND FOLDER_ID < %d;",
-                       MSGFW_MESSAGE_TABLE_NAME, convId, MSG_SMS_TYPE, MSG_SPAMBOX_ID);
+       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND MAIN_TYPE = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d;",
+                       MSGFW_MESSAGE_TABLE_NAME, convId, MSG_SMS_TYPE, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
 
        if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
                return MSG_ERR_DB_PREPARE;
@@ -704,8 +706,9 @@ msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t co
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s \
-                       WHERE CONV_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d) AND FOLDER_ID > 0 AND FOLDER_ID < %d;",
-                       MSGFW_MESSAGE_TABLE_NAME, convId, MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS, MSG_SPAMBOX_ID);
+                       WHERE CONV_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d) AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d;",
+                       MSGFW_MESSAGE_TABLE_NAME, convId, MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS,
+                       MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
 
        if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
                return MSG_ERR_DB_PREPARE;
@@ -730,8 +733,8 @@ msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t co
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, SUBJECT, MSG_TEXT FROM %s \
-                       WHERE CONV_ID = %d AND FOLDER_ID > 0 AND FOLDER_ID < %d ORDER BY DISPLAY_TIME DESC;",
-                       MSGFW_MESSAGE_TABLE_NAME, convId, MSG_SPAMBOX_ID);
+                       WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d ORDER BY DISPLAY_TIME DESC;",
+                       MSGFW_MESSAGE_TABLE_NAME, convId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE);
 
        if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
                return MSG_ERR_DB_PREPARE;
@@ -1395,6 +1398,22 @@ msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, msg_thread
        return err;
 }
 
+msg_error_t MsgStoUpdateNetworkStatus(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t status)
+{
+       msg_error_t err = MSG_SUCCESS;
+
+       char sqlQuery[MAX_QUERY_LEN+1];
+
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+       snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET NETWORK_STATUS = %d WHERE MSG_ID = %d;",
+                       MSGFW_MESSAGE_TABLE_NAME, status, pMsgInfo->msgId);
+
+       if (pDbHandle->execQuery(sqlQuery) != MSG_SUCCESS)
+               err = MSG_ERR_DB_EXEC;
+
+       return err;
+}
 
 char *MsgStoReplaceString(const char *origStr, const char *oldStr, const char *newStr)
 {