summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangseok Oh <seok.oh@samsung.com>2013-01-09 22:03:18 +0900
committerChangseok Oh <seok.oh@samsung.com>2013-01-09 22:03:18 +0900
commit8e11a02348eb5effb6b84ac587dcb8b3ca905828 (patch)
treed109f455e4703478a764a749b69c3c490c12f350
parenta429a331a6abf58f74b9ef86fbdb6777e9c59180 (diff)
downloadmsg-service-8e11a02348eb5effb6b84ac587dcb8b3ca905828.tar.gz
msg-service-8e11a02348eb5effb6b84ac587dcb8b3ca905828.tar.bz2
msg-service-8e11a02348eb5effb6b84ac587dcb8b3ca905828.zip
fix prevent issue
-rwxr-xr-xframework/deliver-handler/MsgDeliverHandler.cpp8
-rwxr-xr-xframework/main.cpp9
-rwxr-xr-xframework/storage-handler/MsgStorageMessage.cpp331
-rwxr-xr-xframework/submit-handler/MsgSubmitHandler.cpp4
-rwxr-xr-xinclude/framework/MsgSettingHandler.h2
-rwxr-xr-xinclude/mapi/msg_types.h4
-rwxr-xr-xinclude/msg_helper/MsgHelper.h2
-rwxr-xr-xinclude/utils/MsgNotificationWrapper.h12
-rwxr-xr-xmsg_helper/CMakeLists.txt2
-rwxr-xr-xmsg_helper/MsgSoundPlayer.cpp71
-rwxr-xr-xpackaging/msg-service.spec2
-rwxr-xr-xplugin/mms_plugin/CMakeLists.txt2
-rwxr-xr-xplugin/mms_plugin/MmsPluginCodecCommon.cpp192
-rwxr-xr-xplugin/mms_plugin/MmsPluginDecode.cpp348
-rwxr-xr-xplugin/mms_plugin/MmsPluginInternal.cpp10
-rwxr-xr-xplugin/mms_plugin/MmsPluginSmil.cpp39
-rwxr-xr-xplugin/mms_plugin/MmsPluginStorage.cpp100
-rwxr-xr-xplugin/mms_plugin/MmsPluginUserAgent.cpp4
-rwxr-xr-xplugin/mms_plugin/MmsPluginUtil.cpp39
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginCodecCommon.h4
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginDecode.h3
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginUtil.h4
-rwxr-xr-xplugin/sms_plugin/SmsPluginCallback.cpp31
-rwxr-xr-xplugin/sms_plugin/SmsPluginConcatHandler.cpp3
-rwxr-xr-xplugin/sms_plugin/SmsPluginEventHandler.cpp17
-rwxr-xr-xplugin/sms_plugin/SmsPluginMain.cpp4
-rwxr-xr-xplugin/sms_plugin/SmsPluginParamCodec.cpp4
-rwxr-xr-xplugin/sms_plugin/SmsPluginSetting.cpp15
-rwxr-xr-xplugin/sms_plugin/SmsPluginSimMsg.cpp6
-rwxr-xr-xplugin/sms_plugin/SmsPluginStorage.cpp47
-rwxr-xr-xplugin/sms_plugin/SmsPluginTpduCodec.cpp35
-rwxr-xr-xplugin/sms_plugin/SmsPluginTransport.cpp93
-rwxr-xr-xplugin/sms_plugin/SmsPluginWapPushHandler.cpp6
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginStorage.h2
-rwxr-xr-xproxy/MsgHandleControl.cpp66
-rwxr-xr-xproxy/MsgProxyListener.cpp2
-rwxr-xr-xutils/MsgContact.cpp140
-rwxr-xr-xutils/MsgDebug.cpp2
-rwxr-xr-xutils/MsgNotificationWrapper.cpp747
-rwxr-xr-xutils/MsgUtilFile.cpp5
-rwxr-xr-xutils/MsgUtilStorage.cpp18
-rwxr-xr-xutils/MsgVMessage.cpp6
-rwxr-xr-xvobject-engine/VCard.c7
-rwxr-xr-xvobject-engine/VMessage.c7
44 files changed, 887 insertions, 1568 deletions
diff --git a/framework/deliver-handler/MsgDeliverHandler.cpp b/framework/deliver-handler/MsgDeliverHandler.cpp
index f28858f..934d268 100755
--- a/framework/deliver-handler/MsgDeliverHandler.cpp
+++ b/framework/deliver-handler/MsgDeliverHandler.cpp
@@ -107,7 +107,7 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques
MSG_DEBUG("Enter MsgAddPhoneLog() for mms message.");
MsgAddPhoneLog(pMsgInfo);
- MsgInsertNoti(&dbHandle, pMsgInfo);
+ MsgInsertNoti(pMsgInfo);
} else if (subType == MSG_RETRIEVE_MANUALCONF_MMS) {
if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS) {
MSG_DEBUG("Manual success");
@@ -164,7 +164,7 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti)
err = MsgHandleSMS(pMsgInfo, pSendNoti, &bOnlyNoti);
- if (err == MSG_SUCCESS) {
+ if (err == MSG_SUCCESS&& ((*pSendNoti)||bOnlyNoti)) {
MsgSoundPlayStart(false);
if (*pSendNoti == true) {
int smsCnt = 0, mmsCnt = 0;
@@ -173,7 +173,7 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti)
mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE);
MsgSettingHandleNewMsg(smsCnt, mmsCnt);
- MsgInsertNoti(&dbHandle, pMsgInfo);
+ MsgInsertNoti(pMsgInfo);
} else if (bOnlyNoti == true) {
MsgInsertNoti(pMsgInfo);
}
@@ -364,7 +364,7 @@ msg_error_t MsgHandleMMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti)
mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE);
MsgSettingHandleNewMsg(smsCnt, mmsCnt);
- MsgInsertNoti(&dbHandle, pMsgInfo);
+ MsgInsertNoti(pMsgInfo);
}
request.msgInfo.msgId = pMsgInfo->msgId;
diff --git a/framework/main.cpp b/framework/main.cpp
index 87482e0..5aa0baa 100755
--- a/framework/main.cpp
+++ b/framework/main.cpp
@@ -301,6 +301,8 @@ void* InitMsgServer(void*)
{
msg_error_t err = MSG_SUCCESS;
+ MsgOpenContactSvc();
+
try
{
// plugin manager initialize
@@ -336,6 +338,9 @@ void* InitMsgServer(void*)
return (void*)0;
}
+ // Clear and reset notification
+ MsgCleanAndResetNoti();
+
MSG_SIM_STATUS_T simStatus = MSG_SIM_STATUS_NORMAL;
// Check Sim Status
@@ -379,13 +384,9 @@ void* InitMsgServer(void*)
MsgReleaseMemory();
- // Try to connect contact server if it is not opened.
- MsgOpenContactSvc();
-
// Register Callback to get the change of contact
MsgInitContactSvc(&MsgContactChangedCallback);
- MsgCleanAndResetNoti();
MsgSoundInitRepeatAlarm();
return (void*)0;
diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp
index 1c5af1e..bb5d6dc 100755
--- a/framework/storage-handler/MsgStorageMessage.cpp
+++ b/framework/storage-handler/MsgStorageMessage.cpp
@@ -473,7 +473,7 @@ msg_error_t MsgStoUpdateThreadReadStatus(msg_thread_id_t threadId)
MSG_DEBUG("updateUnreadMsgCount() Error");
}
- MsgRefreshNoti();
+ MsgRefreshNoti(false);
MSG_END();
@@ -508,9 +508,8 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication)
// Get SUB_TYPE, STORAGE_ID
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.MAIN_TYPE, A.SUB_TYPE, A.FOLDER_ID, A.STORAGE_ID, A.READ_STATUS, B.CONV_ID \
- FROM %s A, %s B WHERE A.MSG_ID = %d AND A.CONV_ID = B.CONV_ID;",
- MSGFW_MESSAGE_TABLE_NAME, MSGFW_CONVERSATION_TABLE_NAME, msgId);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, FOLDER_ID, STORAGE_ID, READ_STATUS, CONV_ID \
+ FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId);
if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
MSG_DEBUG("Query Failed [%s]", sqlQuery);
@@ -737,18 +736,19 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication)
return MSG_ERR_DB_EXEC;
}
- // Clear Conversation table
- if (MsgStoClearConversationTable(&dbHandle) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_DB_EXEC;
- }
+ if (convId > 0) {
+ // Clear Conversation table
+ if (MsgStoClearConversationTable(&dbHandle) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
- // Update conversation table.
- if (MsgStoUpdateConversation(&dbHandle, convId) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_STORAGE_ERROR;
+ // Update conversation table.
+ if (MsgStoUpdateConversation(&dbHandle, convId) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_STORAGE_ERROR;
+ }
}
-
dbHandle.endTrans(true);
if (msgType.mainType == MSG_SMS_TYPE && folderId == MSG_INBOX_ID) {
@@ -773,13 +773,9 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication)
MsgSettingSetIndicator(smsCnt, mmsCnt);
-// MsgDeleteNotiByMsgId(msgId);
- MsgRefreshNoti();
+ MsgRefreshNoti(false);
}
- //Delete phone log
-// MsgDeletePhoneLog(msgId);
-
return MSG_SUCCESS;
}
@@ -1063,7 +1059,7 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD
// err = MSG_ERR_UNKNOWN;
// }
- MsgRefreshNoti();
+ MsgRefreshNoti(false);
}
}
/*** **/
@@ -1189,7 +1185,7 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList)
char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
char dirPath[MSG_FILEPATH_LEN_MAX] = {0,};
- char thumbnailPath[MSG_FILEPATH_LEN_MAX] = {0,};
+// char thumbnailPath[MSG_FILEPATH_LEN_MAX] = {0,};
//get mms msg id list
memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -1301,13 +1297,6 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList)
#if 0
/*** 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));
@@ -1315,19 +1304,6 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList)
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
@@ -1344,7 +1320,7 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList)
/*** **/
#endif
- MsgRefreshNoti();
+ MsgRefreshNoti(false);
MSG_END();
return MSG_SUCCESS;
@@ -1683,7 +1659,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M
strncpy(msgData, (char *)dbHandle.columnText(16), pMsg->dataSize);
// Save Message Data into File
- char fileName[MAX_COMMON_INFO_SIZE+1];
+ char fileName[MSG_FILENAME_LEN_MAX+1];
memset(fileName, 0x00, sizeof(fileName));
if (MsgCreateFileName(fileName) == false) {
@@ -1986,7 +1962,7 @@ msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int extId, int
MsgSettingHandleNewMsg(smsCnt, mmsCnt);
- MsgInsertNoti(&dbHandle, pMsgInfo);
+ MsgInsertNoti(pMsgInfo);
MSG_END();
@@ -2387,7 +2363,6 @@ msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, bool bInclud
{
msg_error_t err = MSG_SUCCESS;
-#if 1
char sqlQuery[MAX_QUERY_LEN+1];
/*** Get msg id list **/
@@ -2432,272 +2407,6 @@ msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, bool bInclud
err = MsgStoDeleteMessageByList(pMsgIdList);
-#else
- char sqlQuery[MAX_QUERY_LEN+1];
- /*** Get msg id list **/
- msg_id_list_s *pToDeleteMsgIdList = NULL;
-
- int rowCnt = 0;
- int index = 1;
- // Set Indicator
- int smsCnt = 0;
- int mmsCnt = 0;
-
- 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 *);
-
- pToDeleteMsgIdList = (msg_id_list_s *)new char[sizeof(msg_id_list_s)];
- 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);
-
- err = dbHandle.getTable(sqlQuery, &rowCnt);
-
- if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
- MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-
- dbHandle.freeTable();
-
- goto FREE_MEMORY;
- }
-
- if (rowCnt <= 0) {
- dbHandle.freeTable();
- err = MSG_SUCCESS;
-
- goto FREE_MEMORY;
- }
-
- pToDeleteMsgIdList->nCount = rowCnt;
-
- MSG_DEBUG("pToDeleteMsgIdList->nCount [%d]", pToDeleteMsgIdList->nCount);
-
- pToDeleteMsgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t) * rowCnt];
-
- for (int i = 0; i < rowCnt; i++)
- pToDeleteMsgIdList->msgIdList[i] = dbHandle.getColumnToInt(index++);
-
- dbHandle.freeTable();
- /*** **/
-
- /*** Delete Sim Message **/
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE CONV_ID = %d AND STORAGE_ID = %d",
- MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_STORAGE_SIM);
-
- rowCnt = 0;
-
- err = dbHandle.getTable(sqlQuery, &rowCnt);
-
- if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
- MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-
- dbHandle.freeTable();
-
- goto FREE_MEMORY;
- }
-
- for (int i = 1; i <= rowCnt; i++) {
- err = MsgStoDeleteMessage(dbHandle.getColumnToInt(i), false);
-
- if (err != MSG_SUCCESS) {
- MSG_DEBUG("MsgStoDeleteMessage() Error!!!");
-
- dbHandle.freeTable();
-
- goto FREE_MEMORY;
- }
- }
-
- dbHandle.freeTable();
- /*** **/
-
- dbHandle.beginTrans();
-
- for (int i = 0; i < listCnt; i++) {
- if (!strcmp(tableList[i], MMS_PLUGIN_MESSAGE_TABLE_NAME)) {
-
- int rowCnt = 0;
-
- //get mms msg id list
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s A, %s B\
- WHERE A.CONV_ID = %d AND A.MAIN_TYPE = %d AND A.MSG_ID = B.MSG_ID;",
- MSGFW_MESSAGE_TABLE_NAME, MMS_PLUGIN_MESSAGE_TABLE_NAME, threadId, MSG_MMS_TYPE);
-
- 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);
-
- goto FREE_MEMORY;
- }
-
- for (int i = 1; i <= rowCnt; i++) {
-
- char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
- char dirPath[MSG_FILEPATH_LEN_MAX] = {0,};
- char thumbnailPath[MSG_FILEPATH_LEN_MAX] = {0,};
-
- 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);
-
- // remove directory also
- 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 MSG_ID IN \
- (SELECT MSG_ID FROM %s WHERE CONV_ID = %d);",
- tableList[i], MSGFW_MESSAGE_TABLE_NAME, threadId);
-
- // Delete Message in specific folder from table
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- MSG_DEBUG("sqlQuery [%s]", sqlQuery);
- dbHandle.endTrans(false);
- err = MSG_ERR_DB_EXEC;
-
- goto FREE_MEMORY;
- }
- }
-
- // Clear Conversation table
- if (MsgStoClearConversationTable(&dbHandle) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- err = MSG_ERR_DB_EXEC;
-
- goto FREE_MEMORY;
- }
-
- dbHandle.endTrans(true);
-
- MSG_MESSAGE_TYPE_S msgType;
-
- msgType.mainType = MSG_SMS_TYPE;
- msgType.subType = MSG_NORMAL_SMS;
- msgType.classType = MSG_CLASS_NONE;
-
- // Set memory status in SIM
- if (MsgStoCheckMsgCntFull(&dbHandle, &msgType, MSG_INBOX_ID) == MSG_SUCCESS) {
- MSG_DEBUG("Set Memory Status");
-
- MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE);
-
- if (plg == NULL) {
- MSG_DEBUG("SMS Plug-in is NULL");
- err = MSG_ERR_NULL_POINTER;
-
- goto FREE_MEMORY;
- }
-
- plg->setMemoryStatus(MSG_SUCCESS);
- }
-
- // Set Indicator
- smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE);
- mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE);
-
- MsgSettingSetIndicator(smsCnt, mmsCnt);
-
-/*** Set pMsgIdList **/
- if (pMsgIdList != NULL && pToDeleteMsgIdList->nCount > 0) {
- pMsgIdList->nCount = pToDeleteMsgIdList->nCount;
-
- pMsgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t)*pToDeleteMsgIdList->nCount];
- memcpy(pMsgIdList->msgIdList, pToDeleteMsgIdList->msgIdList, sizeof(msg_message_id_t)*pToDeleteMsgIdList->nCount);
- }
-/*** **/
-
- /*** Create thread for noti and phone log delete. **/
- if (pToDeleteMsgIdList->nCount > 0) {
- 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 = pToDeleteMsgIdList->nCount;
-
- pToDeleteMsgIdListCpy->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t)*pToDeleteMsgIdList->nCount];
- memcpy(pToDeleteMsgIdListCpy->msgIdList, pToDeleteMsgIdList->msgIdList, sizeof(msg_message_id_t)*pToDeleteMsgIdList->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;
- }
- }
- /*** **/
-
- return MSG_SUCCESS;
-
-FREE_MEMORY:
- MSG_DEBUG("Error case Free Memory");
- // memory free
- if (pToDeleteMsgIdList != NULL) {
- //free peer info list
- if (pToDeleteMsgIdList->msgIdList != NULL) {
- delete [] pToDeleteMsgIdList->msgIdList;
- pToDeleteMsgIdList->msgIdList = NULL;
- }
-
- delete [] pToDeleteMsgIdList;
- pToDeleteMsgIdList = NULL;
- }
-#endif
-
return err;
}
diff --git a/framework/submit-handler/MsgSubmitHandler.cpp b/framework/submit-handler/MsgSubmitHandler.cpp
index 1de9676..105a04c 100755
--- a/framework/submit-handler/MsgSubmitHandler.cpp
+++ b/framework/submit-handler/MsgSubmitHandler.cpp
@@ -90,8 +90,8 @@ msg_error_t MsgSubmitReqSMS(MSG_REQUEST_INFO_S *pReqInfo)
if (pReqInfo->msgInfo.msgPort.valid == false) {
pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID;
- if (pReqInfo->msgInfo.msgId > 0 && (pReqInfo->msgInfo.folderId == MSG_DRAFT_ID || pReqInfo->msgInfo.folderId == MSG_OUTBOX_ID))
- err = MsgStoUpdateMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo));
+ if (pReqInfo->msgInfo.msgId > 0 && (pReqInfo->msgInfo.folderId == MSG_DRAFT_ID || pReqInfo->msgInfo.folderId == MSG_OUTBOX_ID))
+ err = MsgStoUpdateMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo));
}
err = plg->submitReq(pReqInfo);
diff --git a/include/framework/MsgSettingHandler.h b/include/framework/MsgSettingHandler.h
index 3b32ad9..a3dca7d 100755
--- a/include/framework/MsgSettingHandler.h
+++ b/include/framework/MsgSettingHandler.h
@@ -40,7 +40,7 @@ msg_error_t MsgSetMMSRecvOpt(const MSG_SETTING_S *pSetting);
msg_error_t MsgSetMMSStyleOpt(const MSG_SETTING_S *pSetting);
msg_error_t MsgSetPushMsgOpt(const MSG_SETTING_S *pSetting);
msg_error_t MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim);
-msg_error_t MsgSetVoiceMailOpt(const MSG_SETTING_S *pSetting);
+
msg_error_t MsgSetVoiceMailOpt(const MSG_SETTING_S *pSetting, bool bSetSim);
msg_error_t MsgSetMsgSizeOpt(const MSG_SETTING_S *pSetting);
diff --git a/include/mapi/msg_types.h b/include/mapi/msg_types.h
index a528b39..49e0314 100755
--- a/include/mapi/msg_types.h
+++ b/include/mapi/msg_types.h
@@ -41,7 +41,7 @@
#define MAX_FOLDER_NAME_SIZE 20
#define MAX_WAPPUSH_ID_LEN 100
-#define MAX_WAPPUSH_CONTENT_TYPE_LEN 40
+#define MAX_WAPPUSH_CONTENT_TYPE_LEN 100
#define MAX_WAPPUSH_HREF_LEN 300
#define MAX_WAPPUSH_CONTENTS_LEN 2048
@@ -377,7 +377,7 @@ enum _MSG_STRUCT_E {
MSG_STRUCT_REQUEST_INFO = 0x4500, /**< Indicates the MSG_STRUCT_REQUEST_INFO */
MSG_STRUCT_SENT_STATUS_INFO = 0x4600, /**< Indicates the MSG_STRUCT_SENT_STATUS_INFO */
MSG_STRUCT_PUSH_CONFIG_INFO = 0x4700, /**< Indicates the MSG_STRUCT_PUSH_CONFIG_INFO */
- MSG_STRUCT_CB_MSG = 0x4800, /**< Indicates the MSG_STRUCT_PUSH_CONFIG_INFO */
+ MSG_STRUCT_CB_MSG = 0x4800, /**< Indicates the MSG_STRUCT_CB_MSG */
};
enum _MSG_MESSAGE_INFO_E_ {
diff --git a/include/msg_helper/MsgHelper.h b/include/msg_helper/MsgHelper.h
index a13eff2..4c09f57 100755
--- a/include/msg_helper/MsgHelper.h
+++ b/include/msg_helper/MsgHelper.h
@@ -47,7 +47,7 @@ msg_error_t MsgSoundPlayUninit();
void MsgSoundPlayStart(bool isEmergency);
void MsgSoundPlayStop();
int MsgSoundPlayMelody(char *pMsgToneFilePath, bool bIncreasing);
-void MsgSoundPlayVibration();
+void MsgSoundPlayVibration(bool isOnCall);
void MsgSoundPlayDtmf();
//Sensor FW wrapper.
diff --git a/include/utils/MsgNotificationWrapper.h b/include/utils/MsgNotificationWrapper.h
index 59d6321..b2c3d99 100755
--- a/include/utils/MsgNotificationWrapper.h
+++ b/include/utils/MsgNotificationWrapper.h
@@ -28,6 +28,7 @@
DEFINES
==================================================================================================*/
#define MSG_APP_PACKAGE_NAME "message"
+#define MSG_SYS_PACKAGE_NAME "sys_string"
#define NORMAL_MSG_ICON_PATH "/usr/apps/org.tizen.message/res/icons/default/small/org.tizen.message.noti.png"
#define VOICE_MSG_ICON_PATH "/usr/apps/org.tizen.message/res/icons/default/small/org.tizen.message.voice.png"
#define CB_MSG_ICON_PATH "/usr/apps/org.tizen.message/res/icons/default/small/org.tizen.message.noti.png"
@@ -40,22 +41,21 @@
#define MESSAGE_RETRIEVED "Message retrieved"
#define SMS_MESSAGE_SENT "Message sent"
#define SMS_MESSAGE_SENDING_FAIL "Sending message failed"
+#define MESSAGE "Message"
+#define NEW_MESSAGE "New message"
+#define NEW_MESSAGES "New messages"
+#define MSG_SYS_LOCALEDIR "/usr/share/locale"
#define NOTIFICATION_PRIV_ID DEFAULT_SETTING_PATH"/notification_priv_id"
/*==================================================================================================
FUNCTION PROTOTYPES
==================================================================================================*/
-
-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);
-msg_error_t MsgRefreshNoti();
+msg_error_t MsgRefreshNoti(bool bWithTicker);
msg_error_t MsgCleanAndResetNoti();
msg_error_t MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg);
diff --git a/msg_helper/CMakeLists.txt b/msg_helper/CMakeLists.txt
index ab024a4..ad060c3 100755
--- a/msg_helper/CMakeLists.txt
+++ b/msg_helper/CMakeLists.txt
@@ -29,7 +29,7 @@ INCLUDE_DIRECTORIES(
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(msg_helper_pkgs REQUIRED glib-2.0 dlog vconf devman_haptic mm-fileinfo mm-player mm-sound svi sensor)
+pkg_check_modules(msg_helper_pkgs REQUIRED glib-2.0 dlog vconf mm-fileinfo mm-player mm-sound sensor feedback)
FOREACH(flag ${msg_helper_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/msg_helper/MsgSoundPlayer.cpp b/msg_helper/MsgSoundPlayer.cpp
index 23b95f4..af754a6 100755
--- a/msg_helper/MsgSoundPlayer.cpp
+++ b/msg_helper/MsgSoundPlayer.cpp
@@ -23,13 +23,11 @@
#include "MsgUtilFile.h"
#include "MsgHelper.h"
-#include <devman_managed.h>
-#include <svi.h>
-
#include <mm_error.h>
#include <mm_player.h>
#include <mm_session_private.h>
#include <mm_sound.h>
+#include <feedback.h>
extern void worker_done();
@@ -39,7 +37,6 @@ extern void worker_done();
static MMHandleType hPlayerHandle = 0;
static bool bPlaying = false;
static bool bVibrating = false;
-static int dev_handle;
pthread_mutex_t muMmPlay = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cvMmPlay = PTHREAD_COND_INITIALIZER;
@@ -79,38 +76,6 @@ static gboolean MsgSoundMelodyTimeout(gpointer data)
return FALSE;
}
-
-static gboolean MsgSoundVibTimeout(gpointer data)
-{
- MSG_BEGIN();
-
- int ret = 0;
-
- if (bVibrating == true) {
- ret = device_haptic_stop_play(dev_handle);
-
- if (ret != 0) {
- MSG_DEBUG("Fail to stop haptic : [%d]", ret);
- }
-
- ret = device_haptic_close(dev_handle);
-
- if (ret != 0) {
- MSG_DEBUG("Fail to close haptic : [%d]", ret);
- }
-
- bVibrating = false;
- }
-
- if(!bPlaying && !bVibrating)
- worker_done();
-
- MSG_END();
-
- return FALSE;
-}
-
-
static int MsgSoundPlayCallback(int message, void *param, void *user_param)
{
switch (message)
@@ -218,14 +183,14 @@ void* MsgPlayThread(void *data)
MSG_DEBUG("Call is active & Alert on Call - Vibration");
if (bVibrationOn)
- MsgSoundPlayVibration();
+ MsgSoundPlayVibration(true);
}
} else{
MSG_DEBUG("Call is not active");
if (bVibrationOn) {
MSG_DEBUG("Play vibration.");
- MsgSoundPlayVibration();
+ MsgSoundPlayVibration(false);
}
if (bSoundOn) {
@@ -395,30 +360,32 @@ int MsgSoundPlayMelody(char *pMsgToneFilePath, bool bIncreasing)
}
-void MsgSoundPlayVibration()
+void MsgSoundPlayVibration(bool isOnCall)
{
MSG_BEGIN();
int ret = 0;
- int vibLevel = 0;
- char ivtFilePath[MAX_SOUND_FILE_LEN] = {0,};
- vibLevel = MsgSettingGetInt(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT);
+ ret = feedback_initialize();
- if (vibLevel > 0) {
- bVibrating = true;
+ if (ret != FEEDBACK_ERROR_NONE) {
+ MSG_DEBUG("Fail to feedback_initialize : [%d]", ret);
+ return;
+ }
- dev_handle = device_haptic_open(DEV_IDX_0, 0);
+ if (isOnCall)
+ ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE_ON_CALL);
+ else
+ ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE);
- g_timeout_add(MSG_VIBRATION_INTERVAL , MsgSoundVibTimeout, NULL);
+ if (ret != FEEDBACK_ERROR_NONE)
+ MSG_DEBUG("Fail to feedback_play_type");
- /* set timer to stop vibration, then play melody */
- svi_get_path(SVI_TYPE_VIB, SVI_VIB_NOTIFICATION_MESSAGE, ivtFilePath, sizeof(ivtFilePath));
- ret = device_haptic_play_file(dev_handle, ivtFilePath, HAPTIC_TEST_ITERATION, vibLevel);
+ ret = feedback_deinitialize();
- if (ret != 0) {
- MSG_DEBUG("Fail to play haptic : [%d]", ret);
- }
+ if (ret != FEEDBACK_ERROR_NONE) {
+ MSG_DEBUG("Fail to feedback_deinitialize : [%d]", ret);
+ return;
}
MSG_END();
diff --git a/packaging/msg-service.spec b/packaging/msg-service.spec
index 4914c02..4973e6c 100755
--- a/packaging/msg-service.spec
+++ b/packaging/msg-service.spec
@@ -19,7 +19,6 @@ BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(contacts-service2)
BuildRequires: pkgconfig(db-util)
-BuildRequires: pkgconfig(devman_haptic)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(drm-client)
BuildRequires: pkgconfig(glib-2.0)
@@ -42,6 +41,7 @@ BuildRequires: pkgconfig(sensor)
BuildRequires: pkgconfig(svi)
BuildRequires: pkgconfig(tapi)
BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(feedback)
%description
Description: Messaging Framework Library
diff --git a/plugin/mms_plugin/CMakeLists.txt b/plugin/mms_plugin/CMakeLists.txt
index 047d7b5..a9a0742 100755
--- a/plugin/mms_plugin/CMakeLists.txt
+++ b/plugin/mms_plugin/CMakeLists.txt
@@ -38,7 +38,7 @@ SET(MMS-PLUGIN-SRCS
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include/common
${CMAKE_SOURCE_DIR}/include/framework
- ${CMAKE_SOURCE_DIR}/include/msg_helper
+ #${CMAKE_SOURCE_DIR}/include/msg_helper
${CMAKE_SOURCE_DIR}/include/utils
${CMAKE_SOURCE_DIR}/include/mapi
${CMAKE_CURRENT_SOURCE_DIR}/include
diff --git a/plugin/mms_plugin/MmsPluginCodecCommon.cpp b/plugin/mms_plugin/MmsPluginCodecCommon.cpp
index 86878c4..d3b565b 100755
--- a/plugin/mms_plugin/MmsPluginCodecCommon.cpp
+++ b/plugin/mms_plugin/MmsPluginCodecCommon.cpp
@@ -903,7 +903,6 @@ char *MsgDecodeText(char *pOri)
int nCharset = MSG_CHARSET_UTF8;
int nTemp = 0;
char *pReturnStr = NULL;
- char *pConvertedStr = NULL;
char szTempBuf[MSG_LOCAL_TEMP_BUF_SIZE] = {0};
@@ -946,6 +945,8 @@ char *MsgDecodeText(char *pOri)
*pDecQ = '\0';
nCharset = _MsgGetCode(MSG_CHARSET, pDecStart + 2);
+ if(nCharset < 0)
+ goto __CATCH;
*pDecQ = MSG_CH_QUESTION;
}
@@ -1090,11 +1091,6 @@ __RETURN:
pTemp = NULL;
}
- if (pConvertedStr) {
- free(pConvertedStr);
- pConvertedStr = NULL;
- }
-
if(pRe) {
free(pRe);
pRe = NULL;
@@ -1109,11 +1105,6 @@ __RETURN:
__CATCH:
- if (pConvertedStr) {
- free(pConvertedStr);
- pConvertedStr = NULL;
- }
-
if(pRe) {
free(pRe);
pRe = NULL;
@@ -1801,4 +1792,183 @@ bool MmsInitMsgDRMInfo(MsgDRMInfo *pMsgDrmInfo)
return true;
}
+
+void MmsReleaseMsgDRMInfo(MsgDRMInfo *pDrmInfo)
+{
+ MSG_DEBUG("_MsgFreeDRMInfo: S T A R T !!! \n");
+
+ if (pDrmInfo == NULL) {
+ MSG_DEBUG("pDrmInfo is NULL");
+ return;
+ }
+
+ if (pDrmInfo->szContentDescription) {
+ free(pDrmInfo->szContentDescription);
+ pDrmInfo->szContentDescription = NULL;
+ }
+
+ if (pDrmInfo->szContentVendor) {
+ free(pDrmInfo->szContentVendor);
+ pDrmInfo->szContentVendor = NULL;
+ }
+
+ if (pDrmInfo->szContentName) {
+ free(pDrmInfo->szContentName);
+ pDrmInfo->szContentName = NULL;
+ }
+
+ if (pDrmInfo->szContentURI) {
+ free(pDrmInfo->szContentURI);
+ pDrmInfo->szContentURI = NULL;
+ }
+
+ if (pDrmInfo->szRightIssuer) {
+ free(pDrmInfo->szRightIssuer);
+ pDrmInfo->szRightIssuer = NULL;
+ }
+
+ if (pDrmInfo->szDrm2FullPath) {
+ free(pDrmInfo->szDrm2FullPath);
+ pDrmInfo->szDrm2FullPath = NULL;
+ }
+
+ pDrmInfo->contentType = MIME_UNKNOWN;
+ pDrmInfo->drmType = MSG_DRM_TYPE_NONE;
+}
+
#endif
+
+bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib)
+{
+ MSG_BEGIN();
+
+ if (pAttrib == NULL) {
+ MSG_DEBUG("pAttrib is NULL");
+ return false;
+ }
+
+ if (pAttrib->szTo) {
+ free(pAttrib->szTo);
+ pAttrib->szTo = NULL;
+ }
+
+ if (pAttrib->szCc) {
+ free(pAttrib->szCc);
+ pAttrib->szCc = NULL;
+ }
+
+ if (pAttrib->szBcc) {
+ free(pAttrib->szBcc);
+ pAttrib->szBcc = NULL;
+ }
+
+ //check if pMultiStatus should be freed or not, because pMultiStatus is not allocated
+ if (pAttrib->pMultiStatus) {
+ MmsMsgMultiStatus *pMultiStatus = pAttrib->pMultiStatus;
+ MmsMsgMultiStatus *pCurStatus = NULL;
+
+ while (pMultiStatus != NULL ) {
+ pCurStatus = pMultiStatus;
+ pMultiStatus = pMultiStatus->pNext;
+
+ if (pCurStatus) {
+ free(pCurStatus);
+ pCurStatus = NULL;
+ }
+ }
+
+ pAttrib->pMultiStatus = NULL;
+ }
+
+
+ MSG_END();
+
+ return true;
+}
+
+bool MmsReleaseMsgBody(MsgBody *pBody, int type)
+{
+ MSG_BEGIN();
+
+ if (pBody == NULL) {
+ MSG_DEBUG("pBody == NULL \n" );
+ MSG_END();
+
+ return false;
+ }
+
+ switch (type) {
+ case MIME_MULTIPART_REPORT:
+ case MIME_APPLICATION_VND_OMA_DRM_MESSAGE:
+ case MIME_APPLICATION_VND_WAP_MULTIPART_MIXED:
+ case MIME_APPLICATION_VND_WAP_MULTIPART_RELATED:
+ case MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC:
+ case MIME_MULTIPART_MIXED:
+ case MIME_MULTIPART_RELATED:
+ case MIME_MULTIPART_ALTERNATIVE:
+ case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE:
+ {
+ MsgMultipart *pMulti = pBody->body.pMultipart;
+ MsgMultipart *pCurrPart = NULL;
+ MsgBody *pPresentation = pBody->pPresentationBody;
+ while (pMulti != NULL) {
+ pCurrPart = pMulti;
+
+ pMulti = pMulti->pNext;
+
+ if (pCurrPart) {
+#ifdef __SUPPORT_DRM__
+ MmsReleaseMsgDRMInfo(&pCurrPart->type.drmInfo);
+#endif
+
+ if (pCurrPart->pBody) {
+ if (pCurrPart->pBody->body.pBinary) {
+ free(pCurrPart->pBody->body.pBinary);
+ pCurrPart->pBody->body.pBinary = NULL;
+ }
+ free(pCurrPart->pBody);
+ pCurrPart->pBody = NULL;
+ }
+ free(pCurrPart);
+ pCurrPart = NULL;
+ }
+ }
+
+ pBody->body.pMultipart = NULL;
+
+ if (pPresentation) {
+ if (pPresentation->body.pText) {
+ free(pPresentation->body.pText);
+ pPresentation->body.pText = NULL;
+ }
+ free(pPresentation);
+ pBody->pPresentationBody = NULL;
+ }
+
+ MmsInitMsgType(&pBody->presentationType);
+
+ break;
+ }
+
+ default:
+ /* Any single part */
+ if (pBody->body.pBinary) {
+ free(pBody->body.pBinary);
+ pBody->body.pBinary = NULL;
+ }
+
+ break;
+ }
+
+ MSG_END();
+ return true;
+}
+
+void MmsReleaseMmsMsg(MmsMsg *pMmsMsg)
+{
+ if (pMmsMsg) {
+ MmsReleaseMsgBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type);
+ MmsReleaseMmsAttrib(&pMmsMsg->mmsAttrib);
+ bzero(pMmsMsg, sizeof(MmsMsg));
+ }
+}
diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp
index 3a1c39a..decd4d7 100755
--- a/plugin/mms_plugin/MmsPluginDecode.cpp
+++ b/plugin/mms_plugin/MmsPluginDecode.cpp
@@ -79,9 +79,6 @@ static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int tota
static bool __MmsBinaryDecodeDRMContent(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int bodyLength, int totalLength);
#endif
-static bool __MsgInitMsgBody(MsgBody *pMsgBody);
-static bool __MsgInitMsgType(MsgType *pMsgType);
-
//util funcion
static void __MsgRemoveFilePath(char *pSrc);
static bool __MsgChangeSpace(char *pOrg, char **ppNew);
@@ -108,7 +105,6 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody);
static bool __MsgIsHexChar(char *pSrc);
static char __MsgConvertHexValue(char *pSrc);
static int __MsgConvertCharToInt(char ch);
-static bool __MsgInitMsgContentParam(MsgContentParam *pMsgContentParam);
static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2);
static bool __MsgCopyNestedMsgParam(MsgContentParam *pParam1, MsgContentParam *pParam2);
static bool __MsgIsMultipartMixed(int type);
@@ -2461,7 +2457,8 @@ __RETURN:
__CATCH:
if (isFileCreated)
- remove(szTempFilePath);
+ if(remove(szTempFilePath) != 0)
+ MSG_DEBUG("remove fail");
if (pRawData) {
free(pRawData);
@@ -2818,13 +2815,10 @@ bool MmsDrm2ConvertMsgBody(char *szOriginFilePath)
pszMmsLoadTempBuf = NULL;
}
- if (pszOrgData) {
- free(pszOrgData);
- pszOrgData = NULL;
- }
-
- remove(szTempFile);
- remove(szTempFilePath);
+ if(remove(szTempFile) != 0)
+ MSG_DEBUG("remove fail");
+ if(remove(szTempFilePath) != 0)
+ MSG_DEBUG("remove fail");
return true;
@@ -2886,9 +2880,9 @@ bool MmsDrm2ReadMsgConvertedBody(MSG_MESSAGE_INFO_S *pMsg, bool bSavePartsAsTemp
MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg);
MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMmsMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMmsMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type);
+ MmsReleaseMsgBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type);
if (MmsReadMsgBody(pMsg->msgId, bSavePartsAsTempFiles, bRetrieved, retrievedPath) == false) {
MSG_DEBUG("MmsDrm2ReadMsgConvertedBody: _MmsReadMsgBody with converted file is failed\n");
@@ -3876,9 +3870,6 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen
int charSetLen = 0;
int nTemp = 0;
char *pData = NULL;
- char *pTempData = NULL;
- unsigned short *mszTempStr = NULL;
- char *pConvertedStr = NULL;
MSG_DEBUG("__MmsBinaryDecodeEncodedString: decode string..\n");
@@ -3946,6 +3937,10 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen
const char *pFromCharSet = MmsPluginTextConvertGetCharSet(charset_code);
if (pFromCharSet == NULL || !strcmp(pFromCharSet, pToCharSet)) {
+ if (pData) {
+ free(pData);
+ pData = NULL;
+ }
return true;
}
@@ -3968,22 +3963,6 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen
pData = NULL;
}
- if (pTempData) {
- free(pTempData);
- pTempData = NULL;
- }
-
- if (mszTempStr) {
- free(mszTempStr);
- mszTempStr = NULL;
- }
-
- if (pConvertedStr) {
- free(pConvertedStr);
- pConvertedStr = NULL;
- }
-
-
return true;
__CATCH:
@@ -3993,21 +3972,6 @@ __CATCH:
pData = NULL;
}
- if (pTempData) {
- free(pTempData);
- pTempData = NULL;
- }
-
- if (mszTempStr) {
- free(mszTempStr);
- mszTempStr = NULL;
- }
-
- if (pConvertedStr) {
- free(pConvertedStr);
- pConvertedStr = NULL;
- }
-
return false;
}
@@ -4363,7 +4327,7 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe
if ((mmsHeader.msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED)||(mmsHeader.msgType.type == MIME_MULTIPART_MIXED)) {
if ((pMsg->nPartCount >= attachmax)&&(pMultipart->pNext != NULL)) {
- MsgFreeBody(pMultipart->pNext->pBody, pMultipart->pNext->type.type);
+ MmsReleaseMsgBody(pMultipart->pNext->pBody, pMultipart->pNext->type.type);
free(pMultipart->pNext->pBody);
pMultipart->pNext->pBody= NULL;
@@ -4455,10 +4419,10 @@ __CATCH:
}
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
MSG_DEBUG("_MmsReadMsgBody: E N D (fail) ******************** \n");
return false;
@@ -5075,8 +5039,8 @@ static MsgMultipart *__MsgAllocMultipart(void)
goto __CATCH;
}
- __MsgInitMsgType(&pMultipart->type);
- __MsgInitMsgBody(pMultipart->pBody);
+ MmsInitMsgType(&pMultipart->type);
+ MmsInitMsgBody(pMultipart->pBody);
pMultipart->pNext = NULL;
@@ -5097,70 +5061,6 @@ __CATCH:
return NULL;
}
-static bool __MsgInitMsgType(MsgType *pMsgType)
-{
- pMsgType->offset = 0;
- pMsgType->size = 0;
- pMsgType->contentSize = 0;
- pMsgType->disposition = 0;
- pMsgType->encoding = 0;
- pMsgType->type = MIME_UNKNOWN;
-#ifdef FEATURE_JAVA_MMS_MIME
- pMsgType->szMimeString[0] ='\0';
-#endif
- pMsgType->section = 0;
-
- pMsgType->szOrgFilePath[0] = '\0';
- pMsgType->szContentID[0] = '\0';
- pMsgType->szContentLocation[0] = '\0';
-
- pMsgType->szContentRepPos[0] = '\0';
- pMsgType->szContentRepSize[0] = '\0';
- pMsgType->szContentRepIndex[0] = '\0';
-
- __MsgInitMsgContentParam(&pMsgType->param);
-#ifdef __SUPPORT_DRM__
- MmsInitMsgDRMInfo(&pMsgType->drmInfo);
-#endif
-
- return true;
-}
-
-static bool __MsgInitMsgContentParam(MsgContentParam *pMsgContentParam)
-{
- pMsgContentParam->charset = MSG_CHARSET_UNKNOWN;
- pMsgContentParam->type = MIME_UNKNOWN;
- pMsgContentParam->szBoundary[0] = '\0';
- pMsgContentParam->szFileName[0] = '\0';
- pMsgContentParam->szName[0] = '\0';
-#ifdef FEATURE_JAVA_MMS
- pMsgContentParam->szApplicationID = NULL;
- pMsgContentParam->szReplyToApplicationID = NULL;
-#endif
- pMsgContentParam->szStart[0] = '\0';
- pMsgContentParam->szStartInfo[0] = '\0';
- pMsgContentParam->pPresentation = NULL;
-
- pMsgContentParam->reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN; // add only used as parameter of Content-Type: multipart/report; report-type
-
- return true;
-}
-
-static bool __MsgInitMsgBody(MsgBody *pMsgBody)
-{
- pMsgBody->offset = 0;
- pMsgBody->size = 0;
- pMsgBody->body.pText = NULL;
- pMsgBody->szOrgFilePath[0] = '\0';
-
- __MsgInitMsgType(&pMsgBody->presentationType);
- pMsgBody->pPresentationBody = NULL;
-
- memset(pMsgBody->szOrgFilePath, 0, MSG_FILEPATH_LEN_MAX);
-
- return true;
-}
-
static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char* szStart, MimeType typeParam)
{
char szTmpStart[MSG_MSG_ID_LEN + 3] = { 0, };
@@ -5254,7 +5154,7 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
pMsgBody->size -= pPresentationInfo->pCurPresentation->pBody->size;
if (pPresentationInfo->pCurPresentation) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pPresentationInfo->pCurPresentation->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pPresentationInfo->pCurPresentation->type.drmInfo);
#endif
free(pPresentationInfo->pCurPresentation);
pPresentationInfo->pCurPresentation = NULL;
@@ -5287,7 +5187,7 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
pNextPart = pNextPart->pNext;
if (pRemovePart->pBody) {
- MsgFreeBody(pRemovePart->pBody, pRemovePart->type.type);
+ MmsReleaseMsgBody(pRemovePart->pBody, pRemovePart->type.type);
free(pRemovePart->pBody);
pRemovePart->pBody = NULL;
}
@@ -5297,9 +5197,9 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
}
} else {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsgBody->presentationType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsgBody->presentationType.drmInfo);
#endif
- __MsgInitMsgType(&pMsgBody->presentationType);
+ MmsInitMsgType(&pMsgBody->presentationType);
pMsgBody->pPresentationBody = NULL;
}
}
@@ -5325,48 +5225,6 @@ static bool __MsgIsPresentablePart(int type)
}
#ifdef __SUPPORT_DRM__
-void MsgFreeDRMInfo(MsgDRMInfo *pDrmInfo)
-{
- MSG_DEBUG("_MsgFreeDRMInfo: S T A R T !!! \n");
-
- if (pDrmInfo == NULL) {
- MSG_DEBUG("pDrmInfo is NULL");
- return;
- }
-
- if (pDrmInfo->szContentDescription) {
- free(pDrmInfo->szContentDescription);
- pDrmInfo->szContentDescription = NULL;
- }
-
- if (pDrmInfo->szContentVendor) {
- free(pDrmInfo->szContentVendor);
- pDrmInfo->szContentVendor = NULL;
- }
-
- if (pDrmInfo->szContentName) {
- free(pDrmInfo->szContentName);
- pDrmInfo->szContentName = NULL;
- }
-
- if (pDrmInfo->szContentURI) {
- free(pDrmInfo->szContentURI);
- pDrmInfo->szContentURI = NULL;
- }
-
- if (pDrmInfo->szRightIssuer) {
- free(pDrmInfo->szRightIssuer);
- pDrmInfo->szRightIssuer = NULL;
- }
-
- if (pDrmInfo->szDrm2FullPath) {
- free(pDrmInfo->szDrm2FullPath);
- pDrmInfo->szDrm2FullPath = NULL;
- }
-
- pDrmInfo->contentType = MIME_UNKNOWN;
- pDrmInfo->drmType = MSG_DRM_TYPE_NONE;
-}
bool MsgCopyDrmInfo(MsgType *pPartType)
{
@@ -5428,134 +5286,7 @@ static bool __MsgIsText(int type)
}
}
-bool MsgFreeAttrib(MmsAttrib *pAttrib)
-{
- MSG_BEGIN();
-
- if (pAttrib == NULL) {
- MSG_DEBUG("pAttrib is NULL");
- return false;
- }
-
- if (pAttrib->szTo) {
- free(pAttrib->szTo);
- pAttrib->szTo = NULL;
- }
-
- if (pAttrib->szCc) {
- free(pAttrib->szCc);
- pAttrib->szCc = NULL;
- }
-
- if (pAttrib->szBcc) {
- free(pAttrib->szBcc);
- pAttrib->szBcc = NULL;
- }
-
- //check if pMultiStatus should be freed or not, because pMultiStatus is not allocated
- if (pAttrib->pMultiStatus) {
- MmsMsgMultiStatus *pMultiStatus = pAttrib->pMultiStatus;
- MmsMsgMultiStatus *pCurStatus = NULL;
-
- while (pMultiStatus != NULL ) {
- pCurStatus = pMultiStatus;
- pMultiStatus = pMultiStatus->pNext;
-
- if (pCurStatus) {
- free(pCurStatus);
- pCurStatus = NULL;
- }
- }
-
- pAttrib->pMultiStatus = NULL;
- }
-
-
- MSG_END();
-
- return true;
-}
-
-bool MsgFreeBody(MsgBody *pBody, int type)
-{
- MSG_DEBUG("_MsgFreeBody: S T A R T !!! \n") ;
-
- if (pBody == NULL) {
- MSG_DEBUG("_MsgFreeBody: pBody == NULL \n" );
- MSG_DEBUG("_MsgFreeBody: E N D (End)!!! \n") ;
-
- return false;
- }
-
- switch (type) {
- case MIME_MULTIPART_REPORT:
- case MIME_APPLICATION_VND_OMA_DRM_MESSAGE:
- case MIME_APPLICATION_VND_WAP_MULTIPART_MIXED:
- case MIME_APPLICATION_VND_WAP_MULTIPART_RELATED:
- case MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC:
- case MIME_MULTIPART_MIXED:
- case MIME_MULTIPART_RELATED:
- case MIME_MULTIPART_ALTERNATIVE:
- case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE:
- {
- MsgMultipart *pMulti = pBody->body.pMultipart;
- MsgMultipart *pCurrPart = NULL;
- MsgBody *pPresentation = pBody->pPresentationBody;
- while (pMulti != NULL) {
- pCurrPart = pMulti;
-
- pMulti = pMulti->pNext;
- if (pCurrPart) {
-#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pCurrPart->type.drmInfo);
-#endif
-
- if (pCurrPart->pBody) {
- if (pCurrPart->pBody->body.pBinary) {
- free(pCurrPart->pBody->body.pBinary);
- pCurrPart->pBody->body.pBinary = NULL;
- }
- free(pCurrPart->pBody);
- pCurrPart->pBody = NULL;
- }
- free(pCurrPart);
- pCurrPart = NULL;
- }
- }
-
- pBody->body.pMultipart = NULL;
-
- if (pPresentation) {
- if (pPresentation->body.pText) {
- free(pPresentation->body.pText);
- pPresentation->body.pText = NULL;
- }
- free(pPresentation);
- pBody->pPresentationBody = NULL;
- }
-
- __MsgInitMsgType(&pBody->presentationType);
-
- break;
- }
-
- default:
- /* Any single part */
-
- if (pBody->body.pBinary) {
- free(pBody->body.pBinary);
- pBody->body.pBinary = NULL;
- }
-
- break;
- }
-
- MSG_DEBUG("_MsgFreeBody: E N D (Successfully) !!! \n") ;
-
- return true;
-
-}
static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
{
@@ -5622,9 +5353,9 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
if (pRemoveList) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pRemoveList->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pRemoveList->type.drmInfo);
#endif
- MsgFreeBody(pRemoveList->pBody, pRemoveList->type.type);
+ MmsReleaseMsgBody(pRemoveList->pBody, pRemoveList->type.type);
free(pRemoveList->pBody);
free(pRemoveList);
@@ -5640,7 +5371,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
if (pSelectedPart != NULL) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo);
#endif
if (pSelectedPart->pBody != NULL) {
@@ -5696,7 +5427,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
if (pSelectedPart) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo);
#endif
free(pSelectedPart->pBody);
free(pSelectedPart);
@@ -5704,7 +5435,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
pSelectedPart = pTmpMultipart;
} else if (__MsgIsMultipartRelated(pSelectedPart->type.type) && pPrevPart != NULL) {
pPrevPart->pNext = pTmpMultipart = pSelectedPart->pNext;
- MsgFreeBody(pSelectedPart->pBody, pSelectedPart->type.type);
+ MmsReleaseMsgBody(pSelectedPart->pBody, pSelectedPart->type.type);
free(pSelectedPart->pBody);
free(pSelectedPart);
@@ -5769,7 +5500,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
pPartType->type = pSelectedPart->type.type;
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo);
#endif
free(pSelectedPart->pBody);
free(pSelectedPart);
@@ -5830,9 +5561,9 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
while (pTmpMultipart) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pTmpMultipart->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pTmpMultipart->type.drmInfo);
#endif
- MsgFreeBody(pTmpMultipart->pBody, pTmpMultipart->type.type);
+ MmsReleaseMsgBody(pTmpMultipart->pBody, pTmpMultipart->type.type);
pNextRemovePart = pTmpMultipart->pNext;
free(pTmpMultipart->pBody);
@@ -5850,7 +5581,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
if (pSelectedPart != NULL) {
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo);
#endif
if (pSelectedPart->pBody != NULL) {
free(pSelectedPart->pBody);
@@ -6028,6 +5759,9 @@ static int __MsgConvertCharToInt(char ch)
static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2)
{
+ if(!pMsgType1 || !pMsgType2)
+ return false;
+
if (pMsgType1->section == INVALID_HOBJ)
pMsgType1->section = pMsgType2->section;
@@ -7069,7 +6803,6 @@ __CATCH:
static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave)
{
FILE *pFile = 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.
@@ -7538,13 +7271,14 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType
strncpy(szText, szTempFileName, pExt+1 - szFileName);
}
} else {
- if (strrchr(szTempFileName, '.'))
+ pExt = strrchr(szTempFileName, '.');
+ if (pExt == NULL) {
+ memset(szText, 0, MSG_FILENAME_LEN_MAX+1);
+ strncpy(szText, szTempFileName, MSG_FILENAME_LEN_MAX - 1);
+ strcat(szText, ".");
+ } else {
return true;
-
- memset(szText, 0, MSG_FILENAME_LEN_MAX+1);
- strncpy(szText, szTempFileName, MSG_FILENAME_LEN_MAX - 1);
- //temporary commented to save file as original name.
- pExt = strrchr(szFileName, '.');
+ }
}
} else {
if (nUntitleIndex >= 1) {
@@ -7645,7 +7379,7 @@ bool MmsGetMediaPartHeader(int index, MsgType *pHeader)
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
- __MsgInitMsgType(pHeader);
+ MmsInitMsgType(pHeader);
/* Requires header of non-presentation */
diff --git a/plugin/mms_plugin/MmsPluginInternal.cpp b/plugin/mms_plugin/MmsPluginInternal.cpp
index 2c0bfa8..ac797e5 100755
--- a/plugin/mms_plugin/MmsPluginInternal.cpp
+++ b/plugin/mms_plugin/MmsPluginInternal.cpp
@@ -378,9 +378,9 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
MmsInitHeader();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
MSG_END();
@@ -536,7 +536,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
}
if (partHeader.contentSize > 0) {
- char szBuf[MSG_FILEPATH_LEN_MAX];
+ char szBuf[MSG_FILEPATH_LEN_MAX + 1];
strcpy((char *)szBuf, partHeader.param.szFileName);
sprintf(partHeader.param.szFileName, MSG_DATA_PATH"%s", szBuf);
@@ -580,9 +580,9 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
pStorage->getMmsMessage(&pMsg);
MmsInitHeader();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
MSG_END();
}
diff --git a/plugin/mms_plugin/MmsPluginSmil.cpp b/plugin/mms_plugin/MmsPluginSmil.cpp
index 16ef186..3011fdc 100755
--- a/plugin/mms_plugin/MmsPluginSmil.cpp
+++ b/plugin/mms_plugin/MmsPluginSmil.cpp
@@ -819,37 +819,16 @@ int MmsSmilGetMediaSrcForNormalMsg(char *szOutbuf, char *szInBuf, MsgMultipart *
if (strcasecmp(szContentID, szInBuf) == 0) {
strcpy(szOutbuf, pPart->type.param.szFileName);
- MSG_DEBUG("match with szContentID.");
+ MSG_DEBUG("match with szContentID");
+ goto RETURN;
+ } else if (strcasecmp(szContentLI, szInBuf) == 0) {
+ strcpy(szOutbuf, pPart->type.param.szFileName);
+ MSG_DEBUG("match with szContentLocation");
+ goto RETURN;
+ } else if (strcasecmp(pPart->type.param.szName, szInBuf) == 0) {
+ strcpy(szOutbuf, pPart->type.param.szFileName);
+ MSG_DEBUG("match with Parameter Name");
goto RETURN;
- } else {
- char *szInFileName = strrchr(szInBuf, '/');
-
- if (szInFileName == NULL) {
- szInFileName = szInBuf;
- } else
- szInFileName++;
-
- if (strcasecmp(szContentLI, szInFileName) == 0) {
- strcpy(szOutbuf, pPart->type.param.szFileName);
- MSG_DEBUG("match with szContentLI.");
- goto RETURN;
- } else if (strcasecmp(pPart->type.param.szName, szInBuf) == 0) {
- strcpy(szOutbuf, pPart->type.param.szFileName);
- MSG_DEBUG("match with pPart->type.param.szName.");
- goto RETURN;
- } else if (strlen(szContentID) > 4) {
- if (strcasecmp(strtok(szContentID, "."), strtok(szInBuf, ".")) == 0) {
- strcpy(szOutbuf, pPart->type.param.szFileName);
- MSG_DEBUG("only name is match with szContentID.");
- goto RETURN;
- }
- } else if (strlen(szContentLI) > 4) {
- if (strcasecmp(strtok(szContentLI, "."), strtok(szInBuf, ".")) == 0) {
- strcpy(szOutbuf, pPart->type.param.szFileName);
- MSG_DEBUG("only name is match with szContentLI.");
- goto RETURN;
- }
- }
}
nPart++;
diff --git a/plugin/mms_plugin/MmsPluginStorage.cpp b/plugin/mms_plugin/MmsPluginStorage.cpp
index 7c56c97..45f0c86 100755
--- a/plugin/mms_plugin/MmsPluginStorage.cpp
+++ b/plugin/mms_plugin/MmsPluginStorage.cpp
@@ -92,9 +92,9 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
MMS_MESSAGE_DATA_S mmsMsgData;
bzero(&mmsMsgData,sizeof(MMS_MESSAGE_DATA_S));
if (MmsComposeMessage(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData, pFileData) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS Message Compose Error");
@@ -109,8 +109,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
snprintf((char *)pMsgInfo->msgData, MAX_MSG_DATA_LEN+1, MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
if (addMmsMsgToDB(&mmsMsg, pMsgInfo, _MsgMmsGetAttachCount(&mmsMsgData)) != MSG_SUCCESS) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
@@ -122,15 +122,15 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
pFile = MsgOpenMMSFile(fileName);
if (!pFile) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS File open Error");
}
if (fchmod(fileno(pFile), file_mode) < 0) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
@@ -138,8 +138,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
}
if (MmsEncodeSendReq(pFile, &mmsMsg) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
@@ -159,8 +159,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
pMsgInfo->dataSize = size;
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
} else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) {
@@ -170,7 +170,7 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
//Need to store mms specific data (contents location, TrID, ExpiryTime, Delivery Report, message ID)
if (addMmsMsgToDB(&mmsMsg, pMsgInfo) != MSG_SUCCESS) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
}
} else if (pMsgInfo->msgType.subType == MSG_SENDCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS) {
@@ -217,14 +217,14 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
}
if (addMmsMsgToDB(pMsg, pMsgInfo) != MSG_SUCCESS) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
}
memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1);
strcpy((char *)pMsgInfo->msgData,szTemp);
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
} else if (pMsgInfo->msgType.subType == MSG_READREPLY_MMS || pMsgInfo->msgType.subType == MSG_READRECIND_MMS) {
MSG_DEBUG("######## MmsPlgAddMessage -> MSG_READREPLY_MMS || MSG_READRECIND_MMS ###########");
@@ -246,8 +246,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
MmsComposeReadReportMessage(&mmsMsg, pMsgInfo, selectedMsgId);
if (addMmsMsgToDB(&mmsMsg, pMsgInfo) != MSG_SUCCESS) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
}
@@ -255,8 +255,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
snprintf(filePath, MAX_FULL_PATH_SIZE+1, MSG_DATA_PATH"%d", mmsMsg.msgID);
pFile = MsgOpenMMSFile(filePath);
if (!pFile) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
@@ -264,8 +264,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
}
if (fchmod(fileno(pFile), file_mode) < 0) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
@@ -275,7 +275,7 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
if (version == 0x90) {
MSG_DEBUG("### version 1.0 ###");
if (MmsEncodeReadReport10(pFile, &mmsMsg, readStatus) != true) {
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
@@ -284,7 +284,7 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
} else {
MSG_DEBUG("### version 1.1 ###");
if (MmsEncodeReadReport11(pFile, &mmsMsg, readStatus) != true) {
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
@@ -296,9 +296,9 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
MsgCloseFile(pFile);
pFile = NULL;
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
} else if (pMsgInfo->msgType.subType == MSG_FORWARD_MMS) {
MSG_DEBUG("######## MmsPlgAddMessage -> MSG_FORWARD_MMS ###########");
@@ -309,8 +309,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
MMS_MESSAGE_DATA_S mmsMsgData;
if (MmsComposeMessage(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData, pFileData) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS Message Compose Error");
@@ -321,8 +321,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
snprintf((char *)pMsgInfo->msgData, MAX_MSG_DATA_LEN + 1, MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
if (addMmsMsgToDB(&mmsMsg, pMsgInfo, _MsgMmsGetAttachCount(&mmsMsgData)) != MSG_SUCCESS) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
@@ -334,8 +334,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
pFile = MsgOpenMMSFile(filePath);
if (!pFile) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
pFile = NULL;
@@ -344,8 +344,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
}
if (fchmod(fileno(pFile), file_mode) < 0) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
pFile = NULL;
@@ -354,8 +354,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
}
if (MmsEncodeSendReq(pFile, &mmsMsg) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
pFile = NULL;
@@ -366,8 +366,8 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I
MsgCloseFile(pFile);
pFile = NULL;
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
}
@@ -460,7 +460,7 @@ msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
MsgType partHeader;
MmsAttrib pMmsAttrib;
- char szBuf[MSG_FILEPATH_LEN_MAX] = {0, };
+ char szBuf[MSG_FILEPATH_LEN_MAX + 1] = {0, };
bool bMultipartRelated = false;
if (pSendOptInfo != NULL) {
@@ -576,9 +576,9 @@ msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
if (partHeader.contentSize > 0) {
if (!strcasecmp(partHeader.param.szFileName, "cid:")) {
- strncpy((char *)szBuf, &partHeader.param.szFileName[4], MSG_FILEPATH_LEN_MAX - 1);
+ strncpy((char *)szBuf, &partHeader.param.szFileName[4], MSG_FILEPATH_LEN_MAX);
} else {
- strcpy((char *)szBuf, partHeader.param.szFileName);
+ strncpy((char *)szBuf, partHeader.param.szFileName, MSG_FILEPATH_LEN_MAX);
}
sprintf(partHeader.param.szFileName, MSG_DATA_PATH"%s", szBuf);
@@ -613,9 +613,9 @@ msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
MmsInitHeader();
MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pStoMmsMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pStoMmsMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pStoMmsMsg->msgBody, pStoMmsMsg->msgType.type);
+ MmsReleaseMsgBody(&pStoMmsMsg->msgBody, pStoMmsMsg->msgType.type);
pMsg->dataSize = nSize;
@@ -638,9 +638,9 @@ L_CATCH:
MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
return MSG_ERR_STORAGE_ERROR;
}
@@ -673,8 +673,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
MMS_MESSAGE_DATA_S mmsMsgData;
if (MmsComposeMessage(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData, pFileData) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS Message Compose Error");
@@ -685,8 +685,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
pFile = MsgOpenMMSFile(filePath);
if (MmsEncodeSendReq(pFile, &mmsMsg) != true) {
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
@@ -695,8 +695,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
MsgCloseFile(pFile);
- MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
- MsgFreeAttrib(&mmsMsg.mmsAttrib);
+ MmsReleaseMsgBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MmsReleaseMmsAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
diff --git a/plugin/mms_plugin/MmsPluginUserAgent.cpp b/plugin/mms_plugin/MmsPluginUserAgent.cpp
index d3889c4..5c64475 100755
--- a/plugin/mms_plugin/MmsPluginUserAgent.cpp
+++ b/plugin/mms_plugin/MmsPluginUserAgent.cpp
@@ -657,9 +657,9 @@ ERR_MMS_UA_PROCESS_CONF:
MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MmsReleaseMsgDRMInfo(&pMsg->msgType.drmInfo);
#endif
- MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MmsReleaseMsgBody(&pMsg->msgBody, pMsg->msgType.type);
return false;
}
diff --git a/plugin/mms_plugin/MmsPluginUtil.cpp b/plugin/mms_plugin/MmsPluginUtil.cpp
index f23605c..12b1858 100755
--- a/plugin/mms_plugin/MmsPluginUtil.cpp
+++ b/plugin/mms_plugin/MmsPluginUtil.cpp
@@ -19,6 +19,8 @@
#include <mm_util_imgp.h>
#include <media-thumbnail.h>
#include <ctype.h>
+#include <errno.h>
+#include <sys/stat.h>
#include "MsgUtilFile.h"
#include "MmsPluginDebug.h"
#include "MmsPluginUtil.h"
@@ -337,7 +339,7 @@ char *MsgStrNCopy(const char *string, int length)
if (string) {
pDst = (char *)malloc(1 + length);
if (pDst == NULL) {
- MSG_DEBUG("MsgStrNCopy: pDst MemAlloc Fail \n");
+ MSG_DEBUG("pDst MemAlloc Fail \n");
return NULL;
}
@@ -368,3 +370,38 @@ bool MsgConvertCharToHex(char pSrc, char *pDest)
return true;
}
+
+
+FILE *MmsFileOpen(char *pFileName)
+{
+ int len;
+ mode_t file_mode = (S_IRUSR | S_IWUSR);
+
+ if (!pFileName) {
+ MSG_DEBUG("pFileName NULL: %s", strerror(errno));
+ return NULL;
+ }
+
+ MSG_DEBUG("pFileName = %s", pFileName);
+
+ FILE *pFile = MsgOpenFile(pFileName, "wb+");
+
+ if (pFile == NULL) {
+ MSG_FATAL("File Open Error: %s", strerror(errno));
+ return NULL;
+ }
+
+ if (MsgFseek(pFile, 0L, SEEK_CUR) < 0) {
+ MsgCloseFile(pFile);
+ MSG_DEBUG("File Read Error: %s", strerror(errno));
+ return NULL;
+ }
+
+ if (fchmod(fileno(pFile), file_mode) < 0) {
+ MsgCloseFile(pFile);
+ MSG_DEBUG("File chmod Error: %s", strerror(errno));
+ return NULL;
+ }
+
+ return pFile;
+}
diff --git a/plugin/mms_plugin/include/MmsPluginCodecCommon.h b/plugin/mms_plugin/include/MmsPluginCodecCommon.h
index 75037eb..4137ddd 100755
--- a/plugin/mms_plugin/include/MmsPluginCodecCommon.h
+++ b/plugin/mms_plugin/include/MmsPluginCodecCommon.h
@@ -50,7 +50,11 @@ bool MmsInitMsgAttrib(MmsAttrib *pAttrib);
#ifdef __SUPPORT_DRM__
bool MmsInitMsgDRMInfo(MsgDRMInfo *pMsgDrmInfo);
+void MmsReleaseMsgDRMInfo(MsgDRMInfo *pDrmInfo);
#endif//__SUPPORT_DRM__
+bool MmsReleaseMsgBody(MsgBody *pBody, int type);
+bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib);
+void MmsReleaseMmsMsg(MmsMsg *pMmsMsg);
#endif //MMS_PLUGIN_CODEC_COMMON_H
diff --git a/plugin/mms_plugin/include/MmsPluginDecode.h b/plugin/mms_plugin/include/MmsPluginDecode.h
index 0e37b5a..ee8a3e4 100755
--- a/plugin/mms_plugin/include/MmsPluginDecode.h
+++ b/plugin/mms_plugin/include/MmsPluginDecode.h
@@ -107,8 +107,6 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength);
bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength);
bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath);
-bool MsgFreeBody(MsgBody *pBody, int type);
-bool MsgFreeAttrib(MmsAttrib *pAttrib);
char *MsgChangeHexString(char *pOrg);
char *MsgResolveContentURI(char *szSrc);
@@ -124,7 +122,6 @@ bool MmsGetMediaPartHeader(int index, MsgType *pHeader);
bool MmsGetMsgAttrib(MmsMsgID msgID, MmsAttrib *pAttrib);
#ifdef __SUPPORT_DRM__
-void MsgFreeDRMInfo(MsgDRMInfo *pDrmInfo);
bool MsgCopyDrmInfo(MsgType *pPartType);
bool MmsDrm2ConvertMsgBody(char *szOriginFilePath);
bool MmsDrm2ReadMsgConvertedBody(MSG_MESSAGE_INFO_S *pMsg, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath);
diff --git a/plugin/mms_plugin/include/MmsPluginUtil.h b/plugin/mms_plugin/include/MmsPluginUtil.h
index d7348d6..b1ac716 100755
--- a/plugin/mms_plugin/include/MmsPluginUtil.h
+++ b/plugin/mms_plugin/include/MmsPluginUtil.h
@@ -17,6 +17,8 @@
#ifndef MMS_PLUGIN_UTIL_H
#define MMS_PLUGIN_UTIL_H
+#include <stdio.h>
+
bool makeImageThumbnail(char *srcPath, char *dstPath);
bool makeVideoThumbnail(char *srcPath, char *dstPath);
@@ -29,5 +31,5 @@ char *MsgStrCopy(const char *string);
char *MsgStrNCopy(const char *string, int length);
int MsgStrlen(char *pStr);
bool MsgConvertCharToHex(char pSrc, char *pDest);
-
+FILE *MmsFileOpen(char *pFileName);
#endif //MMS_PLUGIN_UTIL_H
diff --git a/plugin/sms_plugin/SmsPluginCallback.cpp b/plugin/sms_plugin/SmsPluginCallback.cpp
index c7e0b0f..1d1f7c8 100755
--- a/plugin/sms_plugin/SmsPluginCallback.cpp
+++ b/plugin/sms_plugin/SmsPluginCallback.cpp
@@ -114,6 +114,7 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
MSG_DEBUG("tpdu.data.deliver.dcs.msgClass : %d", tpdu.data.deliver.dcs.msgClass);
MSG_DEBUG("tpdu.data.deliver.dcs.codingScheme : %d", tpdu.data.deliver.dcs.codingScheme);
MSG_DEBUG("tpdu.data.deliver.dcs.codingGroup : %d", tpdu.data.deliver.dcs.codingGroup);
+ MSG_DEBUG("tpdu.data.deliver.dcs.bIndActive : %d", tpdu.data.deliver.dcs.bIndActive);
MSG_DEBUG("tpdu.data.deliver.originAddress.address : %s", tpdu.data.deliver.originAddress.address);
MSG_DEBUG("tpdu.data.deliver.timeStamp.time : %d/%d/%d %d:%d:%d ", tpdu.data.deliver.timeStamp.time.absolute.year, tpdu.data.deliver.timeStamp.time.absolute.month, tpdu.data.deliver.timeStamp.time.absolute.day,
tpdu.data.deliver.timeStamp.time.absolute.hour, tpdu.data.deliver.timeStamp.time.absolute.minute, tpdu.data.deliver.timeStamp.time.absolute.second);
@@ -155,21 +156,14 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
SmsPluginSimMsg::instance()->setSmsData((const char*)pDataPackage->Sca, (const char *)pDataPackage->szData, pDataPackage->MsgLength);
}
- if (tpdu.data.deliver.dcs.codingGroup == SMS_GROUP_DISCARD) {
- if (tpdu.data.deliver.dcs.bIndActive == false) {
- SmsPluginSetting::instance()->setMwiInfo(tpdu.data.deliver.dcs.indType + MSG_MWI_VOICE_SMS, 0);
- }
- SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
- } else {
- if (SmsPluginConcatHandler::instance()->IsConcatMsg(&(tpdu.data.deliver.userData)) == true ||
- SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(tpdu.data.deliver.userData)) == true)
- {
- SmsPluginConcatHandler::instance()->handleConcatMsg(&tpdu); // Call Concat Msg Handler
- }
- else
- {
- SmsPluginEventHandler::instance()->handleMsgIncoming(&tpdu); // Call Event Handler
- }
+ if (SmsPluginConcatHandler::instance()->IsConcatMsg(&(tpdu.data.deliver.userData)) == true ||
+ SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(tpdu.data.deliver.userData)) == true)
+ {
+ SmsPluginConcatHandler::instance()->handleConcatMsg(&tpdu); // Call Concat Msg Handler
+ }
+ else
+ {
+ SmsPluginEventHandler::instance()->handleMsgIncoming(&tpdu); // Call Event Handler
}
}
else if (tpdu.tpduType == SMS_TPDU_STATUS_REP)
@@ -779,13 +773,6 @@ void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *u
void TapiEventSetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("TapiEventSetMwiInfo is called. result = [%d]", result);
-
- bool bRet = true;
-
- if (result != TAPI_SIM_ACCESS_SUCCESS)
- bRet = false;
-
- SmsPluginSetting::instance()->setResultFromSim(bRet);
}
void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
diff --git a/plugin/sms_plugin/SmsPluginConcatHandler.cpp b/plugin/sms_plugin/SmsPluginConcatHandler.cpp
index 7be928e..18521ad 100755
--- a/plugin/sms_plugin/SmsPluginConcatHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginConcatHandler.cpp
@@ -608,7 +608,8 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
}
}
- int bufSize = (MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM) + 1;
+ //int bufSize = (MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM) + 1;
+ int bufSize = (DataSize*4) + 1; // For UTF8
char tmpBuf[bufSize];
memset(tmpBuf, 0x00, sizeof(tmpBuf));
diff --git a/plugin/sms_plugin/SmsPluginEventHandler.cpp b/plugin/sms_plugin/SmsPluginEventHandler.cpp
index e28bd2c..b529f30 100755
--- a/plugin/sms_plugin/SmsPluginEventHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginEventHandler.cpp
@@ -29,6 +29,7 @@
#include "SmsPluginConcatHandler.h"
#include "SmsPluginEventHandler.h"
+
/*==================================================================================================
IMPLEMENTATION OF SmsPluginEventHandler - Member Functions
==================================================================================================*/
@@ -119,6 +120,15 @@ void SmsPluginEventHandler::handleMsgIncoming(SMS_TPDU_S *pTpdu)
}
}
+ /** check discard & indicator inactive message **/
+ if (pTpdu->data.deliver.dcs.bMWI == true &&
+ pTpdu->data.deliver.dcs.bIndActive == false &&
+ pTpdu->data.deliver.dcs.codingGroup == SMS_GROUP_DISCARD) {
+ MSG_DEBUG("Discard and no-indication message!!");
+ SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
+ return;
+ }
+
/** convert to msgInfo */
convertTpduToMsginfo(pTpdu, &msgInfo);
@@ -527,6 +537,9 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
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->dcs.codingGroup == SMS_GROUP_DISCARD)
+ msgInfo->bStore = false;
+
MSG_DEBUG("Message waiting number : [%d]", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
SmsPluginSetting::instance()->setMwiInfo(msgInfo->msgType.subType, pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
@@ -819,12 +832,10 @@ bool SmsPluginEventHandler::getDeviceStatus()
ret = cv.timedwait(mx.pMutex(), 16);
- mx.unlock();
-
if (ret == ETIMEDOUT) {
MSG_DEBUG("WARNING: DEVICE STATUS TIME-OUT");
devStatus = false;
}
-
+ mx.unlock();
return devStatus;
}
diff --git a/plugin/sms_plugin/SmsPluginMain.cpp b/plugin/sms_plugin/SmsPluginMain.cpp
index 1eda548..3737d24 100755
--- a/plugin/sms_plugin/SmsPluginMain.cpp
+++ b/plugin/sms_plugin/SmsPluginMain.cpp
@@ -327,6 +327,10 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
MSG_DEBUG("######## addMessage Fail !!");
return MSG_ERR_PLUGIN_STORAGE;
}
+ if (SmsPluginStorage::instance()->addSmsSendOption(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo)) != MSG_SUCCESS) {
+ MSG_DEBUG("######## addSmsSendOption Fail !!");
+ return MSG_ERR_PLUGIN_STORAGE;
+ }
}
}
diff --git a/plugin/sms_plugin/SmsPluginParamCodec.cpp b/plugin/sms_plugin/SmsPluginParamCodec.cpp
index 8b4ecf4..4ac73e9 100755
--- a/plugin/sms_plugin/SmsPluginParamCodec.cpp
+++ b/plugin/sms_plugin/SmsPluginParamCodec.cpp
@@ -393,7 +393,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
pDCS->msgClass = SMS_MSG_CLASS_NONE;
pDCS->bMWI = true;
- pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? false:true;
+ pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
}
else if (((dcs & 0xF0) >> 4) == 0x0D)
@@ -404,7 +404,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
pDCS->msgClass = SMS_MSG_CLASS_NONE;
pDCS->bMWI = true;
- pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? false:true;
+ pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
}
else if (((dcs & 0xF0) >> 4) == 0x0E)
diff --git a/plugin/sms_plugin/SmsPluginSetting.cpp b/plugin/sms_plugin/SmsPluginSetting.cpp
index 32df04f..ef9c71b 100755
--- a/plugin/sms_plugin/SmsPluginSetting.cpp
+++ b/plugin/sms_plugin/SmsPluginSetting.cpp
@@ -768,12 +768,6 @@ void SmsPluginSetting::setMwiInfo(MSG_SUB_TYPE_T type, int count)
MSG_DEBUG("######## tel_set_sim_messagewaiting_info() Fail !!! return : %d #######", ret);
}
- if (getResultFromSim() == true) {
- MSG_DEBUG("######## Set message waiting info Success !!! #######");
- } else {
- MSG_DEBUG("######## Set message waiting info fail !!! #######");
- }
-
return;
}
@@ -878,10 +872,9 @@ bool SmsPluginSetting::getParamEvent(MSG_SMSC_DATA_S *pSmscData)
{
int ret = 0;
- bTapiResult = false;
-
mx.lock();
+ bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), 10);
mx.unlock();
@@ -925,10 +918,9 @@ bool SmsPluginSetting::getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt)
{
int ret = 0;
- bTapiResult = false;
-
mx.lock();
+ bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), 10);
mx.unlock();
@@ -995,10 +987,9 @@ bool SmsPluginSetting::getMailboxInfoEvent(MSG_VOICEMAIL_OPT_S *pVoiceOpt)
{
int ret = 0;
- bTapiResult = false;
-
mx.lock();
+ bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), 10);
mx.unlock();
diff --git a/plugin/sms_plugin/SmsPluginSimMsg.cpp b/plugin/sms_plugin/SmsPluginSimMsg.cpp
index 0c502f3..a6d3a78 100755
--- a/plugin/sms_plugin/SmsPluginSimMsg.cpp
+++ b/plugin/sms_plugin/SmsPluginSimMsg.cpp
@@ -584,10 +584,9 @@ bool SmsPluginSimMsg::getSimMsgEvent(MSG_MESSAGE_INFO_S *pMsgInfo)
{
int ret = 0;
- bTapiResult = false;
-
mx.lock();
+ bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), 10);
mx.unlock();
@@ -699,10 +698,9 @@ bool SmsPluginSimMsg::getSimEvent(msg_sim_id_t *pSimId)
{
int ret = 0;
- bTapiResult = false;
-
mx.lock();
+ bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), 10);
mx.unlock();
diff --git a/plugin/sms_plugin/SmsPluginStorage.cpp b/plugin/sms_plugin/SmsPluginStorage.cpp
index 9c02b33..7189e38 100755
--- a/plugin/sms_plugin/SmsPluginStorage.cpp
+++ b/plugin/sms_plugin/SmsPluginStorage.cpp
@@ -380,9 +380,6 @@ msg_error_t SmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
}
break;
}
- } else if (pMsgInfo->msgType.subType == MSG_STATUS_REPORT_SMS) {
- MSG_DEBUG("Add Status Report");
- err = addSmsMessage(pMsgInfo);
}
if (err == MSG_SUCCESS) {
@@ -441,6 +438,47 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
return MSG_SUCCESS;
}
+msg_error_t SmsPluginStorage::addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo)
+{
+ MSG_BEGIN();
+
+ msg_error_t err = MSG_SUCCESS;
+
+ if (pSendOptInfo->bSetting == false) {
+ MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSendOptInfo->bDeliverReq);
+ MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSendOptInfo->option.smsSendOptInfo.bReplyPath);
+
+ if (pSendOptInfo->bDeliverReq || pSendOptInfo->option.smsSendOptInfo.bReplyPath) {
+ pSendOptInfo->bSetting = true;
+ MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy);
+ }
+ }
+
+ if (pSendOptInfo->bSetting == true) {
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ dbHandle.beginTrans();
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d);",
+ MSGFW_SMS_SENDOPT_TABLE_NAME, pMsg->msgId, pSendOptInfo->bDeliverReq,
+ pSendOptInfo->bKeepCopy, pSendOptInfo->option.smsSendOptInfo.bReplyPath);
+
+ MSG_DEBUG("Query = [%s]", sqlQuery);
+
+ if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ err = MSG_ERR_DB_EXEC;
+ } else {
+ dbHandle.endTrans(true);
+ }
+ }
+
+ MSG_END();
+
+ return err;
+}
+
msg_error_t SmsPluginStorage::updateSmsMessage(MSG_MESSAGE_INFO_S *pMsg)
{
@@ -643,8 +681,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE);
MsgSettingHandleNewMsg(smsCnt, mmsCnt);
-// MsgDeleteNotiByMsgId(msgId);
- MsgRefreshNoti();
+ MsgRefreshNoti(false);
return MSG_SUCCESS;
}
diff --git a/plugin/sms_plugin/SmsPluginTpduCodec.cpp b/plugin/sms_plugin/SmsPluginTpduCodec.cpp
index daa2dd6..1398ecd 100755
--- a/plugin/sms_plugin/SmsPluginTpduCodec.cpp
+++ b/plugin/sms_plugin/SmsPluginTpduCodec.cpp
@@ -21,7 +21,6 @@
#include "MsgCppTypes.h"
#include "MsgException.h"
#include "MsgGconfWrapper.h"
-#include "MsgUtilFile.h"
#include "SmsPluginTpduCodec.h"
#include "SmsPluginParamCodec.h"
@@ -471,36 +470,16 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
{
int offset = 0, udLen = 0;
-#if 1
- char temp[2048];
- char tempcat[100];
- memset(temp, 0x00, sizeof(temp));
- memset(tempcat, 0x00, sizeof(tempcat));
- time_t rawtime;
- time ( &rawtime );
-
- sprintf(temp, "[MT] %s", ctime(&rawtime));
-
- for (int i = 0; i < TpduLen; i++)
- {
- sprintf(tempcat, "[%02x]\n", pTpdu[i]);
- strncat(temp, tempcat, sizeof(temp)-strlen(temp)-1);
- memset(tempcat, 0x00, sizeof(tempcat));
- }
-
-
- sprintf(tempcat, "\n\n\n");
- strncat(temp, tempcat, sizeof(temp)-strlen(temp)-1);
+ char tpduTmp[(TpduLen*2)+1];
+ memset(tpduTmp, 0x00, sizeof(tpduTmp));
+ for (int i = 0; i < TpduLen; i++) {
+ snprintf(tpduTmp+(i*2), sizeof(tpduTmp)-(i*2), "%02X", pTpdu[i]);
+ }
+ MSG_DEBUG("Deliver TPDU.");
+ MSG_DEBUG("[%s]", tpduTmp);
- //MsgOpenCreateAndOverwriteFile(TPDU_LOG_FILE, temp, strlen(temp));
- FILE* pFile=NULL ;
- pFile = MsgOpenFile(TPDU_LOG_FILE, "a");
- MsgWriteFile(temp, sizeof(char), strlen(temp), pFile);
- MsgFflush(pFile);
- MsgCloseFile(pFile);
-#endif
// TP-MMS
if (pTpdu[offset] & 0x04)
pDeliver->bMoreMsg = false;
diff --git a/plugin/sms_plugin/SmsPluginTransport.cpp b/plugin/sms_plugin/SmsPluginTransport.cpp
index 0ce2043..e71f897 100755
--- a/plugin/sms_plugin/SmsPluginTransport.cpp
+++ b/plugin/sms_plugin/SmsPluginTransport.cpp
@@ -21,8 +21,8 @@
#include "MsgCppTypes.h"
#include "MsgException.h"
#include "MsgGconfWrapper.h"
-#include "MsgNotificationWrapper.h"
#include "MsgUtilFile.h"
+#include "MsgNotificationWrapper.h"
#include "SmsPluginParamCodec.h"
#include "SmsPluginTpduCodec.h"
#include "SmsPluginEventHandler.h"
@@ -35,7 +35,6 @@ extern "C"
#include <ITapiNetText.h>
}
-#define MSG_DEBUG_BY_FILE
extern struct tapi_handle *pTapiHandle;
@@ -72,7 +71,7 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
{
MSG_BEGIN();
- SMS_TPDU_S tpdu;
+ SMS_TPDU_S tpdu = {0,};
tpdu.tpduType = SMS_TPDU_SUBMIT;
@@ -94,6 +93,16 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
MSG_DEBUG("DCS is changed by application : [%d]", tpdu.data.submit.dcs.codingScheme);
}
+#ifdef MSG_SMS_REPORT
+ // Update Msg Ref into Report Table
+ if (tpdu.data.submit.bStatusReport == true)
+ {
+ MSG_DEBUG("Update Msg Ref [%d] in Report Table", tpdu.data.submit.msgRef);
+
+ SmsPluginStorage::instance()->updateMsgRef(pReqInfo->msgInfo.msgId, tpdu.data.submit.msgRef);
+ }
+#endif
+
// Set SMSC Options
SMS_ADDRESS_S smsc;
setSmscOptions(&smsc);
@@ -114,12 +123,17 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
int smscLen = SmsPluginParamCodec::encodeSMSC(&smsc, smscAddr);
- if (smscLen <= 0) return;
+ if (smscLen <= 0) {
+ MSG_DEBUG("smscLen <= 0");
+ return;
+ }
- for (j = 0; j < smscLen; j++)
- {
- MSG_DEBUG("pSCAInfo [%02x]", smscAddr[j]);
+ char smscAddrTmp[(smscLen*2)+1];
+ memset(smscAddrTmp, 0x00, sizeof(smscAddrTmp));
+ for (j = 0; j < smscLen; j++) {
+ snprintf(smscAddrTmp+(j*2), sizeof(smscAddrTmp)-(j*2), "%02X", smscAddr[j]);
}
+ MSG_DEBUG("pSCAInfo [%s]", smscAddrTmp);
int bufLen = 0;
@@ -138,11 +152,9 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
tpdu.data.submit.destAddress.address[MAX_ADDRESS_LEN] = '\0';
}
-#ifdef MSG_FOR_DEBUG
MSG_DEBUG("ton [%d]", tpdu.data.submit.destAddress.ton);
MSG_DEBUG("npi [%d]", tpdu.data.submit.destAddress.npi);
MSG_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
-#endif
bool bStatusReport = false;
@@ -184,55 +196,17 @@ MSG_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
pkgInfo.Sca[smscLen] = '\0';
-#ifdef MSG_FOR_DEBUG
- MSG_DEBUG("[submitRequest] TPDU.");
- for (j = 0; j < pkgInfo.MsgLength; j++)
- {
- MSG_DEBUG("[%02x]", pkgInfo.szData[j]);
+ char pkgInfoTmp[(pkgInfo.MsgLength*2)+1];
+ memset(pkgInfoTmp, 0x00, sizeof(pkgInfoTmp));
+ for (j = 0; j < pkgInfo.MsgLength; j++) {
+ snprintf(pkgInfoTmp+(j*2), sizeof(pkgInfoTmp)-(j*2), "%02X", pkgInfo.szData[j]);
}
+ MSG_DEBUG("Submit Request TPDU.");
+ MSG_DEBUG("[%s]", pkgInfoTmp);
- for (j = 0; j < smscLen; j++)
- {
- MSG_DEBUG("pkgInfo.pSCA [%02x]", pkgInfo.Sca[j]);
- }
-#endif
-
-#ifdef MSG_DEBUG_BY_FILE
- char temp[2048];
- char tempcat[100];
- memset(temp, 0x00, sizeof(temp));
- memset(tempcat, 0x00, sizeof(tempcat));
-
- time_t rawtime;
- time(&rawtime);
-
- snprintf(temp, sizeof(temp), "[MO] %s", ctime(&rawtime));
-
- for (j = 0; j < pkgInfo.MsgLength; j++)
- {
- snprintf(tempcat, sizeof(tempcat), "[%02x]\n", pkgInfo.szData[j]);
- strncat(temp, tempcat, sizeof(temp)-strlen(temp)-1);
- memset(tempcat, 0x00, sizeof(tempcat));
- }
-
-
- snprintf(tempcat, sizeof(tempcat), "\n\n\n");
- strncat(temp, tempcat, sizeof(temp)-strlen(temp)-1);
-
- //MSG_DEBUG("temp [%s], length [%d]", temp, strlen(temp));
-
- //MsgOpenCreateAndOverwriteFile(TPDU_LOG_FILE, temp, strlen(temp));
- FILE* pFile=NULL ;
- pFile = MsgOpenFile(TPDU_LOG_FILE, "a");
- MsgWriteFile(temp, sizeof(char), strlen(temp), pFile);
-
- MsgFflush(pFile);
- MsgCloseFile(pFile);
-
-#endif
-
- SMS_SENT_INFO_S sentInfo = {};
+ SMS_SENT_INFO_S sentInfo;
+ memset(&sentInfo, 0x00, sizeof(SMS_SENT_INFO_S));
bool bMoreMsg = FALSE;
@@ -262,13 +236,13 @@ MSG_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
if (tapiRet == TAPI_API_SUCCESS)
{
- MSG_DEBUG("######## TelTapiSmsSend Success !!! return : [%d] #######", tapiRet);
+ MSG_DEBUG("######## tel_send_sms Success !!! return : [%d] #######", tapiRet);
}
else
{
SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
- THROW(MsgException::SMS_PLG_ERROR, "######## TelTapiSmsSend Fail !!! return : [%d] #######", tapiRet);
+ THROW(MsgException::SMS_PLG_ERROR, "######## tel_send_sms Fail !!! return : [%d] #######", tapiRet);
}
// Tizen Validation System
@@ -747,7 +721,7 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
// Read Message Data from File
if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false)
- THROW(MsgException::FILE_ERROR, "MsgOpenAndReadFile error");
+ THROW(MsgException::FILE_ERROR, "MsgOpenAndReadFile error");
MSG_DEBUG("file size : [%d] file data : [%s]", fileSize, pFileData);
@@ -771,7 +745,8 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
}
// Delete File
- MsgDeleteFile(pMsgInfo->msgData);
+ if (pMsgInfo->nAddressCnt == (addrIndex + 1))
+ MsgDeleteFile(pMsgInfo->msgData);
}
MSG_DEBUG("decode length : [%d]", decodeLen);
diff --git a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
index 1e03364..de5fe46 100755
--- a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
@@ -24,6 +24,7 @@
#include "SmsPluginEventHandler.h"
#include "SmsPluginWapPushHandler.h"
+
#include <drm_client.h>
#include <dbus/dbus-glib.h>
@@ -1074,6 +1075,7 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
MSG_END();
}
#else
+
static void launchProcessByAppcode(int appcode)
{
MSG_BEGIN();
@@ -1129,6 +1131,7 @@ static void launchProcessByAppcode(int appcode)
MSG_END();
}
+
void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen)
{
MSG_BEGIN();
@@ -1260,13 +1263,14 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
MSG_DEBUG("Received DRM V2");
// TODO: DRM V2
break;
-
+#if 0
case SMS_WAP_APPLICATION_PUSH_EMAIL:
case SMS_WAP_APPLICATION_PUSH_EMAIL_XML:
case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML:
MSG_DEBUG("Received Email");
// TODO: Email
break;
+#endif
case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
MSG_DEBUG("Received IMPS CIR");
diff --git a/plugin/sms_plugin/include/SmsPluginStorage.h b/plugin/sms_plugin/include/SmsPluginStorage.h
index 94608c4..b573064 100755
--- a/plugin/sms_plugin/include/SmsPluginStorage.h
+++ b/plugin/sms_plugin/include/SmsPluginStorage.h
@@ -52,6 +52,8 @@ public:
msg_error_t addMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
msg_error_t addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
+ msg_error_t addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo);
+
msg_error_t deleteSmsMessage(msg_message_id_t MsgId);
msg_error_t getRegisteredPushEvent(char* pPushHeader, int *count, char *app_id, char *content_type);
diff --git a/proxy/MsgHandleControl.cpp b/proxy/MsgHandleControl.cpp
index dc6fabc..5e9bc14 100755
--- a/proxy/MsgHandleControl.cpp
+++ b/proxy/MsgHandleControl.cpp
@@ -45,8 +45,8 @@ MsgHandle::~MsgHandle()
void MsgHandle::openHandle()
{
- int ret = 0;
- size_t cookieSize;
+// int ret = 0;
+// size_t cookieSize;
bool bReady = false;
@@ -209,7 +209,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I
if (pSrc->dataSize > MAX_MSG_TEXT_LEN) {
// Save Message Data into File
- char fileName[MAX_COMMON_INFO_SIZE+1];
+ char fileName[MSG_FILENAME_LEN_MAX+1];
memset(fileName, 0x00, sizeof(fileName));
if(MsgCreateFileName(fileName) == false)
@@ -403,7 +403,7 @@ void MsgHandle::convertSendOptStruct(const MSG_SENDINGOPT_S* pSrc, MSG_SENDINGOP
pDest->bSetting = pSrc->bSetting;
- if (pDest->bSetting == false) {
+ if (pSrc->bSetting == false) {
MSG_DEBUG("No Sending Option");
return;
}
@@ -417,34 +417,46 @@ void MsgHandle::convertSendOptStruct(const MSG_SENDINGOPT_S* pSrc, MSG_SENDINGOP
if (msgType.mainType == MSG_SMS_TYPE) {
msg_struct_s *pStruct = (msg_struct_s *)pSrc->smsSendOpt;
- SMS_SENDINGOPT_S *pSms = (SMS_SENDINGOPT_S *)pStruct->data;
- pDest->option.smsSendOptInfo.bReplyPath = pSms->bReplyPath;
+ if(pStruct)
+ {
+ SMS_SENDINGOPT_S *pSms = (SMS_SENDINGOPT_S *)pStruct->data;
+ if(pSms)
+ {
+ pDest->option.smsSendOptInfo.bReplyPath = pSms->bReplyPath;
+ }
+ }
} else if (msgType.mainType == MSG_MMS_TYPE) {
msg_struct_s *pStruct = (msg_struct_s *)pSrc->mmsSendOpt;
- MMS_SENDINGOPT_S *pMms = (MMS_SENDINGOPT_S *)pStruct->data;
- pDest->option.mmsSendOptInfo.priority = pMms->priority;
- pDest->option.mmsSendOptInfo.bReadReq = pMms->bReadReq;
-
- MSG_DEBUG("pDest->option.mmsSendOpt.priority = %d", pMms->priority);
- MSG_DEBUG("pDest->option.mmsSendOpt.bReadReq = %d", pMms->bReadReq);
+ if(pStruct)
+ {
+ MMS_SENDINGOPT_S *pMms = (MMS_SENDINGOPT_S *)pStruct->data;
+ if(pMms)
+ {
+ pDest->option.mmsSendOptInfo.priority = pMms->priority;
+ pDest->option.mmsSendOptInfo.bReadReq = pMms->bReadReq;
+
+ MSG_DEBUG("pDest->option.mmsSendOpt.priority = %d", pMms->priority);
+ MSG_DEBUG("pDest->option.mmsSendOpt.bReadReq = %d", pMms->bReadReq);
+
+ if (pMms->expiryTime == 0) {
+ pDest->option.mmsSendOptInfo.expiryTime.type = MMS_TIMETYPE_NONE;
+ pDest->option.mmsSendOptInfo.expiryTime.time = pMms->expiryTime;
+ } else {
+ pDest->option.mmsSendOptInfo.expiryTime.type = MMS_TIMETYPE_RELATIVE;
+ pDest->option.mmsSendOptInfo.expiryTime.time = pMms->expiryTime;
+ }
- if (pMms->expiryTime == 0) {
- pDest->option.mmsSendOptInfo.expiryTime.type = MMS_TIMETYPE_NONE;
- pDest->option.mmsSendOptInfo.expiryTime.time = pMms->expiryTime;
- } else {
- pDest->option.mmsSendOptInfo.expiryTime.type = MMS_TIMETYPE_RELATIVE;
- pDest->option.mmsSendOptInfo.expiryTime.time = pMms->expiryTime;
- }
+ if (pMms->bUseDeliveryCustomTime == true) {
+ pDest->option.mmsSendOptInfo.bUseDeliveryCustomTime = true;
+ } else {
+ pDest->option.mmsSendOptInfo.bUseDeliveryCustomTime = false;
+ }
+ pDest->option.mmsSendOptInfo.deliveryTime.type = MMS_TIMETYPE_RELATIVE;
+ pDest->option.mmsSendOptInfo.deliveryTime.time = pMms->deliveryTime;
- if (pMms->bUseDeliveryCustomTime == true) {
- pDest->option.mmsSendOptInfo.bUseDeliveryCustomTime = true;
- } else {
- pDest->option.mmsSendOptInfo.bUseDeliveryCustomTime = false;
+ MSG_DEBUG("pDest->option.mmsSendOpt.expiryTime = %d", pDest->option.mmsSendOptInfo.expiryTime.time);
+ }
}
- pDest->option.mmsSendOptInfo.deliveryTime.type = MMS_TIMETYPE_RELATIVE;
- pDest->option.mmsSendOptInfo.deliveryTime.time = pMms->deliveryTime;
-
- MSG_DEBUG("pDest->option.mmsSendOpt.expiryTime = %d", pDest->option.mmsSendOptInfo.expiryTime.time);
}
MSG_END();
diff --git a/proxy/MsgProxyListener.cpp b/proxy/MsgProxyListener.cpp
index f1999de..2fa85ff 100755
--- a/proxy/MsgProxyListener.cpp
+++ b/proxy/MsgProxyListener.cpp
@@ -738,7 +738,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
strncpy(tempFileName, pMmsRecvData->retrievedFilePath, MSG_FILENAME_LEN_MAX);
memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN+1);
- memcpy(pMsgInfo->msgData, tempFileName + strlen(MSG_DATA_PATH), strlen(tempFileName));
+ memcpy(pMsgInfo->msgData, tempFileName + strlen(MSG_DATA_PATH), MAX_MSG_DATA_LEN);
it = matchList.begin();
diff --git a/utils/MsgContact.cpp b/utils/MsgContact.cpp
index 455e6bb..a706028 100755
--- a/utils/MsgContact.cpp
+++ b/utils/MsgContact.cpp
@@ -28,7 +28,7 @@ extern "C"
/*==================================================================================================
VARIABLES
==================================================================================================*/
-//static bool isContactSvcOpened = false;
+__thread bool isContactSvcConnected = false;
MsgDbHandler ContactDbHandle;
@@ -51,20 +51,20 @@ msg_error_t MsgOpenContactSvc()
{
int errCode = CONTACTS_ERROR_NONE;
-// if (!isContactSvcOpened) {
+ if (!isContactSvcConnected) {
errCode = contacts_connect2();
if (errCode == CONTACTS_ERROR_NONE) {
MSG_DEBUG("Connect to Contact Service Success");
-// isContactSvcOpened = true;
+ isContactSvcConnected = true;
} else {
MSG_DEBUG("Connect to Contact Service Fail [%d]", errCode);
-// isContactSvcOpened = false;
+ isContactSvcConnected = false;
return MSG_ERR_DB_CONNECT;
}
-// } else {
-// MSG_DEBUG("Already connected to Contact Service.");
-// }
+ } else {
+ MSG_DEBUG("Already connected to Contact Service.");
+ }
return MSG_SUCCESS;
}
@@ -74,7 +74,7 @@ msg_error_t MsgCloseContactSvc()
{
int errCode = CONTACTS_ERROR_NONE;
-// if (isContactSvcOpened) {
+ if (isContactSvcConnected) {
errCode = contacts_disconnect2();
if (errCode == CONTACTS_ERROR_NONE) {
@@ -83,7 +83,7 @@ msg_error_t MsgCloseContactSvc()
MSG_DEBUG("Disconnect to Contact Service Fail [%d]", errCode);
return MSG_ERR_DB_DISCONNECT;
}
-// }
+ }
return MSG_SUCCESS;
}
@@ -93,6 +93,11 @@ msg_error_t MsgInitContactSvc(MsgContactChangeCB cb)
{
int errCode = CONTACTS_ERROR_NONE;
+ if (!isContactSvcConnected) {
+ MSG_DEBUG("Contact Service Not Opened.");
+ return MSG_ERR_UNKNOWN;
+ }
+
if (cb != NULL)
cbFunction = cb;
@@ -116,6 +121,11 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
memset(pContactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
+ if (!isContactSvcConnected) {
+ MSG_DEBUG("Contact Service Not Opened.");
+ return MSG_ERR_UNKNOWN;
+ }
+
if (pAddrInfo->addressType == MSG_ADDRESS_TYPE_PLMN && strlen(pAddrInfo->addressVal) > (MAX_PHONE_NUMBER_LEN+1)) {
MSG_DEBUG("Phone Number is too long [%s]", pAddrInfo->addressVal);
return MSG_SUCCESS;
@@ -361,7 +371,8 @@ void MsgSyncContact()
}
}
- MsgSettingSetInt(CONTACT_SYNC_TIME, finalSyncTime);
+ if(MsgSettingSetInt(CONTACT_SYNC_TIME, finalSyncTime) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetInt fail : CONTACT_SYNC_TIME");
MSG_DEBUG("lastSyncTime : %d", finalSyncTime);
contacts_list_destroy(contactsList, true);
@@ -520,6 +531,12 @@ bool MsgDeleteContact(int index)
int MsgGetContactNameOrder()
{
+
+ if (!isContactSvcConnected) {
+ MSG_DEBUG("Contact Service Not Opened.");
+ return 0; // return default value : FIRSTLAST
+ }
+
int ret = CONTACTS_ERROR_NONE;
contacts_name_display_order_e order = CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST;
@@ -539,63 +556,73 @@ int MsgGetContactNameOrder()
void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo)
{
- int ret = 0;
+ if (!isContactSvcConnected) {
+ MSG_DEBUG("Contact Service Not Opened.");
+ return;
+ }
- MSG_DEBUG("folderId [%d], number [%s]", pMsgInfo->folderId, pMsgInfo->addressList[0].addressVal);
+ if(pMsgInfo->nAddressCnt < 1) {
+ MSG_DEBUG("address count is [%d]", pMsgInfo->nAddressCnt);
+ return;
+ }
- contacts_record_h plog = NULL;
+ for (int i = 0; pMsgInfo->nAddressCnt > i; i++) {
+ int ret = 0;
+ contacts_record_h plog = NULL;
- ret = contacts_record_create(_contacts_phone_log._uri, &plog);
- if (ret != CONTACTS_ERROR_NONE) {
- MSG_DEBUG("contacts_record_create() Error [%d]", ret);
- contacts_record_destroy(plog, true);
- }
+ ret = contacts_record_create(_contacts_phone_log._uri, &plog);
+ if (ret != CONTACTS_ERROR_NONE) {
+ MSG_DEBUG("contacts_record_create() Error [%d]", ret);
+ contacts_record_destroy(plog, true);
+ break;
+ }
- contacts_record_set_str(plog, _contacts_phone_log.address, (char*)pMsgInfo->addressList[0].addressVal);
- contacts_record_set_int(plog, _contacts_phone_log.log_time, (int)time(NULL));
+ contacts_record_set_str(plog, _contacts_phone_log.address, (char*)pMsgInfo->addressList[i].addressVal);
+ contacts_record_set_int(plog, _contacts_phone_log.log_time, (int)time(NULL));
- char strText[101];
- memset(strText, 0x00, sizeof(strText));
+ char strText[101];
+ memset(strText, 0x00, sizeof(strText));
- if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE) {
- strncpy(strText, pMsgInfo->msgText, 100);
- MSG_DEBUG("msgText : %s", strText);
- } else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE) {
- if (strlen(pMsgInfo->subject) > 0 || pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) {
- strncpy(strText, pMsgInfo->subject, 100);
- MSG_DEBUG("subject : %s", strText);
- } else {
+ if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE) {
strncpy(strText, pMsgInfo->msgText, 100);
MSG_DEBUG("msgText : %s", strText);
+ } else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE) {
+ if (strlen(pMsgInfo->subject) > 0 || pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) {
+ strncpy(strText, pMsgInfo->subject, 100);
+ MSG_DEBUG("subject : %s", strText);
+ } else {
+ strncpy(strText, pMsgInfo->msgText, 100);
+ MSG_DEBUG("msgText : %s", strText);
+ }
}
- }
- contacts_record_set_str(plog, _contacts_phone_log.extra_data2, strText);
- contacts_record_set_int(plog, _contacts_phone_log.extra_data1, (int)pMsgInfo->msgId);
+ contacts_record_set_str(plog, _contacts_phone_log.extra_data2, strText);
+ contacts_record_set_int(plog, _contacts_phone_log.extra_data1, (int)pMsgInfo->msgId);
+
+ if (pMsgInfo->folderId == MSG_INBOX_ID) {
+ if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE)
+ contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_INCOMMING);
+ else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE)
+ contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_MMS_INCOMMING);
+ } else if (pMsgInfo->folderId == MSG_OUTBOX_ID) {
+ if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE)
+ contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_OUTGOING);
+ else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE)
+ contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_MMS_OUTGOING);
+ } else if (pMsgInfo->folderId == MSG_SPAMBOX_ID) {
+ if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE)
+ contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_BLOCKED);
+ else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE)
+ contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_MMS_BLOCKED);
+ }
- if (pMsgInfo->folderId == MSG_INBOX_ID) {
- if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE)
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_INCOMMING);
- else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE)
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_MMS_INCOMMING);
- } else if (pMsgInfo->folderId == MSG_OUTBOX_ID) {
- if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE)
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_OUTGOING);
- else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE)
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_MMS_OUTGOING);
- } else if (pMsgInfo->folderId == MSG_SPAMBOX_ID) {
- if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE)
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_BLOCKED);
- else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE)
- contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_MMS_BLOCKED);
- }
+ ret = contacts_db_insert_record(plog, NULL);
+ if (ret != CONTACTS_ERROR_NONE) {
+ MSG_DEBUG("contacts_db_insert_record() Error [%d]", ret);
+ }
- ret = contacts_db_insert_record(plog, NULL);
- if (ret != CONTACTS_ERROR_NONE) {
- MSG_DEBUG("contacts_db_insert_record() Error [%d]", ret);
+ contacts_record_destroy(plog, true);
}
-
- contacts_record_destroy(plog, true);
}
@@ -603,6 +630,11 @@ void MsgDeletePhoneLog(msg_message_id_t msgId)
{
MSG_DEBUG("MsgDeletePhoneLog [%d]", msgId);
+ if (!isContactSvcConnected) {
+ MSG_DEBUG("Contact Service Not Opened.");
+ return;
+ }
+
int ret = CONTACTS_ERROR_NONE;
int index = 0;
unsigned int count = 0;
diff --git a/utils/MsgDebug.cpp b/utils/MsgDebug.cpp
index e1dc88a..20e2371 100755
--- a/utils/MsgDebug.cpp
+++ b/utils/MsgDebug.cpp
@@ -185,7 +185,6 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType)
case MSG_CMD_GET_MSG_SIZE_OPT:
return "MSG_CMD_GET_MSG_SIZE_OPT";
-
case MSG_CMD_SET_SMSC_OPT:
return "MSG_CMD_SET_SMSC_OPT";
@@ -225,6 +224,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType)
return "MSG_CMD_DELETE_PUSH_EVENT";
case MSG_CMD_UPDATE_PUSH_EVENT:
return "MSG_CMD_UPDATE_PUSH_EVENT";
+
default:
return "Unknown Command Type!!!";
}
diff --git a/utils/MsgNotificationWrapper.cpp b/utils/MsgNotificationWrapper.cpp
index b2189ff..0ef5fe5 100755
--- a/utils/MsgNotificationWrapper.cpp
+++ b/utils/MsgNotificationWrapper.cpp
@@ -29,424 +29,218 @@ extern "C"
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
-msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
+void MsgSmsClass0Noti(MSG_MESSAGE_INFO_S* pMsg, notification_h noti, bundle* args)
{
-
- int notiPrivId = MsgSettingGetInt(NOTIFICATION_PRIV_ID);
-
- notification_h noti = NULL;
+ MSG_BEGIN();
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- bundle* args;
-
- int contactId = 0;
- msg_thread_id_t threadId = 0;
- time_t msgTime = 0;
char tempId[6];
- 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));
- memset(addressVal, 0x00, sizeof(addressVal));
- 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, 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);
-
- if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
- return MSG_ERR_DB_PREPARE;
-
- if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
- threadId = pDbHandle->columnInt(0);
-
- if (pDbHandle->columnText(1) != NULL)
- strncpy(addressVal, (char*)pDbHandle->columnText(1), MAX_ADDRESS_VAL_LEN);
-
-
- char *pTempDisplayName = (char *)pDbHandle->columnText(2);
- if (pTempDisplayName != NULL && pTempDisplayName[0] != '\0') {
- strncpy(displayName, pTempDisplayName, MAX_DISPLAY_NAME_LEN);
- } else {
- if (pDbHandle->columnText(3) != NULL)
- strncpy(firstName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN);
-
- if (pDbHandle->columnText(4) != NULL)
- strncpy(lastName, (char*)pDbHandle->columnText(4), MAX_DISPLAY_NAME_LEN);
-
- int order = MsgGetContactNameOrder();
-
- if (order == 0) {
- if (firstName[0] != '\0') {
- strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN);
- }
-
- if (lastName[0] != '\0') {
- strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
- strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
- }
- } else if (order == 1) {
- if (lastName[0] != '\0') {
- strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN);
- strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
- }
- if (firstName[0] != '\0') {
- strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
- }
- }
- }
-
- 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;
+ noti_err = notification_set_application(noti, "org.tizen.msg-ui-class0");
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
}
- pDbHandle->finalizeQuery();
-
-
- args = bundle_create();
-
- if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_CB_SMS) {
-
- noti = notification_create(NOTIFICATION_TYPE_NOTI);
- if (noti == NULL) {
- MSG_DEBUG("notification_new is failed.");
- bundle_free(args);
- return MSG_ERR_UNKNOWN;
- }
-
- noti_err = notification_set_application(noti, "org.tizen.message");
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
- }
- noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
- }
-
- noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, CB_MSG_ICON_PATH);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
- }
-
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "CB Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New CB Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- if (displayName[0] == '\0')
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- if (pMsg->msgType.mainType == MSG_SMS_TYPE)
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->subject, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- // set time.
- notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, msgTime);
- memset(&tempId, 0x00, sizeof(tempId));
-
- bundle_add(args, "type", "msg_id");
-
- snprintf(tempId, 5, "%d", pMsg->msgId);
- bundle_add(args, "msgId", tempId);
-
-
- 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_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");
- }
-
-
- } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.classType == MSG_CLASS_0) {
-
- noti = notification_create(NOTIFICATION_TYPE_NOTI);
- if (noti == NULL) {
- MSG_DEBUG("notification_new is failed.");
- bundle_free(args);
- return MSG_ERR_UNKNOWN;
- }
-
- noti_err = notification_set_application(noti, "org.tizen.msg-ui-class0");
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
- }
+ noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
+ }
- 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_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);
+ }
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "CLASS 0 Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "CLASS 0 Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New CLASS 0 Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New CLASS 0 Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- if (displayName[0] == '\0')
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (pMsg->addressList[0].displayName[0] == '\0')
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, pMsg->addressList[0].addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ else
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, pMsg->addressList[0].displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- if (pMsg->msgType.mainType == MSG_SMS_TYPE)
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->subject, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- // set time.
- notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, msgTime);
- bundle_add(args, "type", "msg_id");
+ // set time.
+ notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, pMsg->displayTime);
- snprintf(tempId, 5, "%d", pMsg->msgId);
- bundle_add(args, "msgId", tempId);
+ bundle_add(args, "type", "msg_id");
- 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);
- }
- }
+ snprintf(tempId, 5, "%d", pMsg->msgId);
+ bundle_add(args, "msgId", tempId);
- noti_err = notification_insert(noti, NULL);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_insert");
- }
+ MSG_END();
+}
- noti_err = notification_free(noti);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_free");
- }
+void MsgSmsCBNoti(MSG_MESSAGE_INFO_S* pMsg, notification_h noti, bundle* args)
+{
+ MSG_BEGIN();
- } else if (pMsg->msgType.mainType == MSG_SMS_TYPE &&
- (pMsg->msgType.subType >= MSG_MWI_VOICE_SMS && pMsg->msgType.subType <= MSG_MWI_OTHER_SMS)) {
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+ char tempId[6];
- 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, "org.tizen.call");
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
- }
+ memset(tempId, 0x00, sizeof(tempId));
- noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
- }
+ noti_err = notification_set_application(noti, "org.tizen.message");
+ 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);
- }
+ noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
+ }
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Voice Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, CB_MSG_ICON_PATH);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+ }
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Voice Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "CB Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- if (displayName[0] == '\0')
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New CB Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- if (pMsg->msgType.mainType == MSG_SMS_TYPE)
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->subject, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (pMsg->addressList[0].displayName[0] == '\0')
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, pMsg->addressList[0].addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ else
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, pMsg->addressList[0].displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- // set time.
- notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, msgTime);
- memset(&tempId, 0x00, sizeof(tempId));
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- //FIXME :: Temp code for voice number, 2012.08.16 sangkoo.kim
- bundle_add(args, "launch-type", "MO");
- bundle_add(args, "number", addressVal);
+ // set time.
+ notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, pMsg->displayTime);
+ memset(&tempId, 0x00, sizeof(tempId));
- 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);
- }
- }
+ bundle_add(args, "type", "msg_id");
- noti_err = notification_insert(noti, NULL);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_insert");
- }
+ snprintf(tempId, 5, "%d", pMsg->msgId);
+ bundle_add(args, "msgId", tempId);
- noti_err = notification_free(noti);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_free");
- }
+ MSG_END();
+}
- } else {
+void MsgSmsVoiceNoti(MSG_MESSAGE_INFO_S* pMsg, notification_h noti, bundle* args)
+{
+ MSG_BEGIN();
- int unreadMsgCnt = MsgStoGetUnreadCnt(pDbHandle, MSG_SMS_TYPE);
- unreadMsgCnt += MsgStoGetUnreadCnt(pDbHandle, MSG_MMS_TYPE);
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- MSG_DEBUG("notiPrivId [%d], unreadMsgCnt [%d]", notiPrivId, unreadMsgCnt);
+ noti_err = notification_set_application(noti, "org.tizen.call");
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
+ }
- if (notiPrivId > 0) {
- noti = notification_load(NULL, notiPrivId);
- if (noti == NULL)
- MSG_DEBUG("notification_load is failed.");
- }
+ noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
+ }
- if (noti == NULL) {
- noti = notification_create(NOTIFICATION_TYPE_NOTI);
- if (noti == NULL) {
- MSG_DEBUG("notification_new is failed.");
- bundle_free(args);
- return MSG_ERR_UNKNOWN;
- }
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Voice Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- notiPrivId = 0;
- }
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Voice Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- noti_err = notification_set_application(noti, "org.tizen.message");
- 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);
+ }
- 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);
- }
+ if (pMsg->addressList[0].displayName[0] == '\0')
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, pMsg->addressList[0].addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ else
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, pMsg->addressList[0].displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- if (unreadMsgCnt > 1) {
+ // set time.
+ notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, pMsg->displayTime);
- noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_MULTIPLE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_layout : %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);
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ MSG_END();
+}
- char unreadMsgCntStr[5] = {0,};
- snprintf(unreadMsgCntStr, 5, "%d", unreadMsgCnt);
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+void MsgSmsReportNoti(MSG_MESSAGE_INFO_S* pMsg, notification_h noti, bundle* args)
+{
+ MSG_BEGIN();
- if (displayName[0] == '\0')
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+ char tempId[6];
- if (pMsg->msgType.mainType == MSG_SMS_TYPE)
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->subject, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ memset(tempId, 0x00, sizeof(tempId));
- // set time.
- notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, msgTime);
+ noti_err = notification_set_application(noti, "org.tizen.message");
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
+ }
+ noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
+ }
- } else {
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
- }
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Delivery Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NOTI_MSG_ICON_PATH);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+ }
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (pMsg->addressList[0].displayName[0] == '\0')
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, pMsg->addressList[0].addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ else
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, pMsg->addressList[0].displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- if (displayName[0] == '\0')
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- if (pMsg->msgType.mainType == MSG_SMS_TYPE)
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->subject, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ // set time.
+ notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, pMsg->displayTime);
- // set time.
- notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, msgTime);
+ // get msg id
+ MsgDbHandler dbhandler;
+ char sqlQuery[MAX_QUERY_LEN+1];
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "SELECT MSG_ID "
+ "FROM %s "
+ "WHERE CONV_ID IN (SELECT CONV_ID FROM %s WHERE ADDRESS_VAL LIKE '%%%s') AND FOLDER_ID=%d "
+ "ORDER BY DISPLAY_TIME DESC;"
+ , MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, pMsg->addressList[0].addressVal, MSG_SENTBOX_ID);
- }
- memset(&tempId, 0x00, sizeof(tempId));
+ MSG_DEBUG("sqlQuery - %s", sqlQuery);
- bundle_add(args, "type", "msg_id");
+ if (dbhandler.prepareQuery(sqlQuery) == MSG_SUCCESS) {
- snprintf(tempId, 5, "%d", pMsg->msgId);
- bundle_add(args, "msgId", tempId);
+ if (dbhandler.stepQuery() == MSG_ERR_DB_ROW) {
+ memset(&tempId, 0x00, sizeof(tempId));
- 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);
- }
- }
+ bundle_add(args, "type", "report");
- if (notiPrivId > 0) {
- noti_err = notification_update(noti);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_update");
- }
- } else {
- noti_err = notification_insert(noti, &notiPrivId);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_insert");
- }
+ snprintf(tempId, 5, "%d", dbhandler.columnInt(0));
+ bundle_add(args, "msgId", tempId);
- MsgSettingSetInt(NOTIFICATION_PRIV_ID, notiPrivId);
- MSG_DEBUG("Insert notiPrivId [%d]", notiPrivId);
+ MSG_DEBUG("msgId [%s] add.", tempId);
}
- noti_err = notification_free(noti);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_free");
- }
+ dbhandler.finalizeQuery();
}
- bundle_free(args);
-
- return MSG_SUCCESS;
+ MSG_END();
}
+
msg_error_t MsgInsertNoti(MSG_MESSAGE_INFO_S* pMsg)
{
-
+ MSG_DEBUG("Start to Insert Notification.");
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);
+ bundle* args = NULL;
noti = notification_create(NOTIFICATION_TYPE_NOTI);
if (noti == NULL) {
@@ -454,57 +248,46 @@ msg_error_t MsgInsertNoti(MSG_MESSAGE_INFO_S* pMsg)
return MSG_ERR_UNKNOWN;
}
- 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_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_layout(noti, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
- }
-
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Voice Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Voice Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- 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 if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_STATUS_REPORT_SMS) {
-
- noti_err = notification_set_application(noti, "com.samsung.message");
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
- }
-
- noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
+ if (pMsg->msgType.mainType == MSG_SMS_TYPE) {
+ switch(pMsg->msgType.subType)
+ {
+ case MSG_CB_SMS :
+ args = bundle_create();
+ MsgSmsCBNoti(pMsg, noti, args);
+ break;
+ case MSG_MWI_VOICE_SMS :
+ case MSG_MWI_FAX_SMS :
+ case MSG_MWI_EMAIL_SMS :
+ case MSG_MWI_OTHER_SMS :
+ args = bundle_create();
+ MsgSmsVoiceNoti(pMsg, noti, args);
+ break;
+ case MSG_STATUS_REPORT_SMS :
+ args = bundle_create();
+ MsgSmsReportNoti(pMsg, noti, args);
+ break;
+ default :
+ MsgRefreshNoti(true);
+ noti_err = notification_free(noti);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_free");
+ }
+ return MSG_SUCCESS;
+ break;
}
-
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Delivery Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NOTI_MSG_ICON_PATH);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+ } else if (pMsg->msgType.mainType == MSG_MMS_TYPE) {
+ switch(pMsg->msgType.subType)
+ {
+ default :
+ MsgRefreshNoti(true);
+ noti_err = notification_free(noti);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_free");
+ }
+ return MSG_SUCCESS;
+ break;
}
-
} else {
-
MSG_DEBUG("Message type does not match.");
noti_err = notification_free(noti);
@@ -515,16 +298,6 @@ msg_error_t MsgInsertNoti(MSG_MESSAGE_INFO_S* pMsg)
return MSG_ERR_INVALID_PARAMETER;
}
- if (displayName[0] == '\0')
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- // set time.
- notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, pMsg->displayTime);
-
if (args != NULL) {
noti_err = notification_set_args(noti, args, NULL);
if (noti_err != NOTIFICATION_ERROR_NONE) {
@@ -551,126 +324,6 @@ msg_error_t MsgInsertNoti(MSG_MESSAGE_INFO_S* pMsg)
return MSG_SUCCESS;
}
-msg_error_t MsgInsertSmsReportToNoti(MsgDbHandler *pDbHandle, msg_message_id_t msgId, msg_delivery_report_status_t status)
-{
-
- notification_h noti = NULL;
- notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
-
- 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 contents[MAX_DISPLAY_NAME_LEN+1];
- char sqlQuery[MAX_QUERY_LEN+1];
-
- memset(addressVal, 0x00, sizeof(addressVal));
- memset(firstName, 0x00, sizeof(firstName));
- memset(lastName, 0x00, sizeof(lastName));
- memset(displayName, 0x00, sizeof(displayName));
- 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 \
- 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, msgId);
-
- if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
- return MSG_ERR_DB_PREPARE;
-
- if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
- if (pDbHandle->columnText(0) != NULL)
- strncpy(addressVal, (char*)pDbHandle->columnText(0), MAX_ADDRESS_VAL_LEN);
-
- if (pDbHandle->columnText(1) != NULL) {
- strncpy(displayName, (char*)pDbHandle->columnText(1), MAX_DISPLAY_NAME_LEN);
- } else {
- if (pDbHandle->columnText(2) != NULL)
- strncpy(firstName, (char*)pDbHandle->columnText(2), MAX_DISPLAY_NAME_LEN);
-
- if (pDbHandle->columnText(3) != NULL)
- strncpy(lastName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN);
-
- int order = MsgGetContactNameOrder();
-
- if (order == 0) {
- if (firstName[0] != '\0') {
- strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN);
- }
-
- if (lastName[0] != '\0') {
- strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
- strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
- }
- } else if (order == 1) {
- if (lastName[0] != '\0') {
- strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN);
- strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
- }
-
- if (firstName[0] != '\0') {
- strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
- }
- }
- }
- } else {
- MSG_DEBUG("query : %s", sqlQuery);
-
- pDbHandle->finalizeQuery();
-
- return MSG_ERR_DB_STEP;
- }
-
- pDbHandle->finalizeQuery();
-
-
- noti = notification_create(NOTIFICATION_TYPE_NOTI);
- if (noti == NULL) {
- MSG_DEBUG("notification_create is failed.");
- return MSG_ERR_UNKNOWN;
- }
- noti_err = notification_set_application(noti, "org.tizen.call");
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
- }
- noti_err = notification_set_layout(noti, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
- }
-
- noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NOTI_MSG_ICON_PATH);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
- }
-
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Delivery Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- if (displayName[0] == '\0')
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- else
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- if (status == MSG_DELIVERY_REPORT_SUCCESS)
- snprintf(contents, MAX_DISPLAY_NAME_LEN, "Delivered.");
- else
- snprintf(contents, MAX_DISPLAY_NAME_LEN, "Deliver Failed.");
-
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_2, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
-
- 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");
- }
-
- return MSG_SUCCESS;
-}
-
msg_error_t MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
{
@@ -933,7 +586,7 @@ msg_error_t MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S
}
-msg_error_t MsgRefreshNoti()
+msg_error_t MsgRefreshNoti(bool bWithTicker)
{
MsgDbHandler dbhandler;
@@ -965,7 +618,7 @@ msg_error_t MsgRefreshNoti()
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, B.MSG_ID, B.MSG_TEXT, B.SUBJECT, B.MAIN_TYPE \
- FROM %s A, %s B WHERE A.CONV_ID=B.CONV_ID AND B.READ_STATUS=0 AND B.FOLDER_ID=%d ORDER BY B.DISPLAY_TIME, B.MSG_ID ASC;",
+ FROM %s A, %s B WHERE A.CONV_ID=B.CONV_ID AND B.READ_STATUS=0 AND B.FOLDER_ID=%d ORDER BY B.DISPLAY_TIME DESC;",
MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MSG_INBOX_ID);
if (dbhandler.prepareQuery(sqlQuery) != MSG_SUCCESS)
@@ -1035,7 +688,7 @@ msg_error_t MsgRefreshNoti()
// No unread message.
if (notiPrivId > 0) {
- notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, notiPrivId);
+ noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, notiPrivId);
if (noti_err != NOTIFICATION_ERROR_NONE) {
MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
}
@@ -1043,7 +696,8 @@ msg_error_t MsgRefreshNoti()
notiPrivId = 0;
- MsgSettingSetInt(NOTIFICATION_PRIV_ID, notiPrivId);
+ if(MsgSettingSetInt(NOTIFICATION_PRIV_ID, notiPrivId) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetInt fail : NOTIFICATION_PRIV_ID");
return MSG_ERR_DB_STEP;
}
@@ -1091,13 +745,18 @@ msg_error_t MsgRefreshNoti()
MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
}
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text_domain(noti, MSG_SYS_PACKAGE_NAME, MSG_SYS_LOCALEDIR);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_text_domain.");
+ }
+
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Message", MESSAGE, NOTIFICATION_VARIABLE_TYPE_NONE);
char unreadMsgCntStr[5] = {0,};
snprintf(unreadMsgCntStr, 5, "%d", unreadMsgCnt);
notification_set_text(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Messages", NEW_MESSAGES, NOTIFICATION_VARIABLE_TYPE_NONE);
if (displayName[0] == '\0')
notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
@@ -1119,9 +778,14 @@ msg_error_t MsgRefreshNoti()
MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
}
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ noti_err = notification_set_text_domain(noti, MSG_SYS_PACKAGE_NAME, MSG_SYS_LOCALEDIR);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_text_domain.");
+ }
+
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Message", MESSAGE, NOTIFICATION_VARIABLE_TYPE_NONE);
- notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Message", NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "New Message", NEW_MESSAGE, NOTIFICATION_VARIABLE_TYPE_NONE);
if (displayName[0] == '\0')
notification_set_text(noti, NOTIFICATION_TEXT_TYPE_INFO_1, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
@@ -1137,6 +801,17 @@ msg_error_t MsgRefreshNoti()
notification_set_time_to_text(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, msgTime);
}
+ {
+ if (bWithTicker)
+ noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_ALL);
+ else
+ noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_TICKER);
+
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_display_applist : %d", noti_err);
+ }
+ }
+
memset(&tempId, 0x00, sizeof(tempId));
bundle_add(args, "type", "msg_id");
@@ -1162,7 +837,8 @@ msg_error_t MsgRefreshNoti()
MSG_DEBUG("Fail to notification_insert");
}
- MsgSettingSetInt(NOTIFICATION_PRIV_ID, notiPrivId);
+ if (MsgSettingSetInt(NOTIFICATION_PRIV_ID, notiPrivId) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetInt fail: NOTIFICATION_PRIV_ID");
MSG_DEBUG("Insert notiPrivId [%d]", notiPrivId);
}
@@ -1181,13 +857,13 @@ msg_error_t MsgCleanAndResetNoti()
msg_error_t err = MSG_SUCCESS;
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- noti_err = notification_delete_all_by_type("msg-server", NOTIFICATION_TYPE_NOTI);
+ noti_err = notification_delete_all_by_type("/usr/bin/msg-server", NOTIFICATION_TYPE_NOTI);
if (noti_err != NOTIFICATION_ERROR_NONE) {
MSG_DEBUG("Fail to notification_delete_all_by_type noti_err [%d]", noti_err);
return MSG_ERR_UNKNOWN;
}
- err = MsgRefreshNoti();
+ err = MsgRefreshNoti(false);
if (err != MSG_SUCCESS) {
MSG_DEBUG("Fail to MsgRefreshNoti");
}
@@ -1195,6 +871,7 @@ msg_error_t MsgCleanAndResetNoti()
return err;
}
+
msg_error_t MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg)
{
diff --git a/utils/MsgUtilFile.cpp b/utils/MsgUtilFile.cpp
index bf2fdc2..f822434 100755
--- a/utils/MsgUtilFile.cpp
+++ b/utils/MsgUtilFile.cpp
@@ -253,7 +253,8 @@ bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize)
return false;
}
- *ppData = new char[FileSize];
+ *ppData = new char[FileSize+1];
+ memset(*ppData, 0x00, (FileSize+1));
if (MsgFseek(pFile, 0L, SEEK_SET) < 0) {
MsgCloseFile(pFile);
@@ -815,6 +816,8 @@ unsigned int MsgDu(const char *pDirPath)
if (dirSize == 0) {
MSG_FATAL("error MsgDu");
+ closedir(dir);
+ free(path);
return dirSize;
}
diff --git a/utils/MsgUtilStorage.cpp b/utils/MsgUtilStorage.cpp
index 3aa2626..2a852b8 100755
--- a/utils/MsgUtilStorage.cpp
+++ b/utils/MsgUtilStorage.cpp
@@ -143,8 +143,7 @@ msg_error_t MsgStoSetReadStatus(MsgDbHandler *pDbHandle, msg_message_id_t msgId,
MsgSettingSetIndicator(smsCnt, mmsCnt);
-// MsgDeleteNotiByMsgId(msgId);
- MsgRefreshNoti();
+ MsgRefreshNoti(false);
return MSG_SUCCESS;
}
@@ -359,17 +358,17 @@ msg_error_t MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *
for (int i=0; i<pMsg->nAddressCnt; i++) {
unsigned int addrId;
- MSG_CONTACT_INFO_S contactInfo = {0};
+ MSG_CONTACT_INFO_S contactInfo;
+ memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
// Get Contact Info
- err = MsgGetContactInfo(&(pMsg->addressList[i]), &contactInfo);
-
- if (err != MSG_SUCCESS) {
- MSG_DEBUG("MsgGetContactInfo() fail [%d]", err);
- return err;
+ if (MsgGetContactInfo(&(pMsg->addressList[i]), &contactInfo) != MSG_SUCCESS) {
+ MSG_DEBUG("MsgGetContactInfo() fail.");
}
- if (pDbHandle->getRowId(MSGFW_ADDRESS_TABLE_NAME, &addrId) != MSG_SUCCESS) {
+ err = pDbHandle->getRowId(MSGFW_ADDRESS_TABLE_NAME, &addrId);
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("pDbHandle->getRowId fail. [%d]", err);
return err;
}
@@ -644,7 +643,6 @@ msg_error_t MsgStoGetAddressByConvId(MsgDbHandler *pDbHandle, msg_thread_id_t co
return MSG_SUCCESS;
}
-
/* Have to use trigger for this function. */
msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t convId)
{
diff --git a/utils/MsgVMessage.cpp b/utils/MsgVMessage.cpp
index 43277f5..f124b52 100755
--- a/utils/MsgVMessage.cpp
+++ b/utils/MsgVMessage.cpp
@@ -271,7 +271,8 @@ if(strlen(pMsg->subject) > 0)
}
MSG_DEBUG("FILE SIZE IS %d", fileSize);
msgText = (char *)calloc(1, fileSize);
- memcpy(msgText, pFileData, fileSize);
+ if(pFileData)
+ memcpy(msgText, pFileData, fileSize);
pObject->numOfBiData = fileSize;
pObject->pszValue[0] = msgText;
pObject->valueCount = 1;
@@ -567,7 +568,8 @@ if(strlen(pMsg->subject) > 0)
}
MSG_DEBUG("FILE SIZE IS %d", fileSize);
msgText = (char *)calloc(1, fileSize);
- memcpy(msgText, pFileData, fileSize);
+ if(pFileData)
+ memcpy(msgText, pFileData, fileSize);
pObject->numOfBiData = fileSize;
pObject->pszValue[0] = msgText;
pObject->valueCount = 1;
diff --git a/vobject-engine/VCard.c b/vobject-engine/VCard.c
index 71810d4..1790789 100755
--- a/vobject-engine/VCard.c
+++ b/vobject-engine/VCard.c
@@ -1365,8 +1365,11 @@ __VCardTypeEncode( VObject *pTypeObj, char *pType )
return NULL;
}
memset( pRes, '\0', ( len + 30 ) );
- memcpy( pRes, pEncode, len );
- VFREE(pEncode);
+ if(pEncode)
+ {
+ memcpy( pRes, pEncode, len );
+ VFREE(pEncode);
+ }
}
if((pRes = (char *)realloc(pRes, strlen(pRes) + 3)) == NULL)
diff --git a/vobject-engine/VMessage.c b/vobject-engine/VMessage.c
index 406820b..c223119 100755
--- a/vobject-engine/VMessage.c
+++ b/vobject-engine/VMessage.c
@@ -1459,8 +1459,11 @@ __VMsgTypeEncode( VObject *pTypeObj, char *pType )
return NULL;
}
memset( pRes, '\0', ( len + 30 ) );
- memcpy( pRes, pEncode, len );
- VFREE(pEncode);
+ if(pEncode)
+ {
+ memcpy( pRes, pEncode, len );
+ VFREE(pEncode);
+ }
}
if((pRes = (char *)realloc(pRes, strlen(pRes) + 3)) == NULL)