}
+msg_error_t MsgStoAllowTcsMessage(msg_message_id_t msgId)
+{
+ MSG_BEGIN();
+ MSG_MESSAGE_INFO_S msgInfo = {0,};
+ MSG_SENDINGOPT_INFO_S sendOptInfo = {0,};
+ msg_error_t err = MSG_SUCCESS;
+
+ err = MsgStoGetMessage(msgId, &msgInfo, &sendOptInfo);
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("MsgStoGetMessage error [%d]", err);
+ return MSG_ERR_STORAGE_ERROR;
+ }
+
+ if (msgInfo.networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS
+ && (msgInfo.msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || msgInfo.msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS)) {
+ MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE);
+ if (plg == NULL) {
+ MSG_ERR("plugin is null!");
+ return MSG_ERR_NULL_POINTER;
+ }
+
+ err = plg->updateMessage(&msgInfo, NULL, (char *)MSG_TCS_MESSAGE);
+ if (err != MSG_SUCCESS) {
+ MSG_ERR("plg->updateMessage() failed: (%d)", err);
+ }
+
+ MsgStoUpdateMMSMessage(&msgInfo);
+
+ } else {
+ MSG_DEBUG("Not Support Msg : main type = %d, sub type = %d, network status = %d",
+ msgInfo.msgType.mainType, msgInfo.msgType.subType, msgInfo.networkStatus);
+ }
+
+ /* Delete Temp File for Message Data */
+ if (msgInfo.bTextSms == false) {
+ MsgDeleteFile(msgInfo.msgData); //ipc
+ }
+
+ MSG_END();
+ return err;
+}
+
+
msg_error_t MsgStoUpdateDPMRestrictedStatus(MSG_MAIN_TYPE_T msgType)
{
msg_error_t err = MSG_SUCCESS;
return eventSize;
}
+
+
+int MsgAllowTcsMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ if (!pCmd || !ppEvent) {
+ MSG_ERR("pCmd or ppEvent is null");
+ return 0;
+ }
+
+ int eventSize = 0;
+
+ msg_message_id_t msgId;
+
+ memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_id_t));
+
+ err = MsgStoAllowTcsMessage(msgId);
+
+ //storage change CB
+ msg_id_list_s msgIdList;
+ msg_message_id_t msgIds[1];
+ memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
+
+ msgIdList.nCount = 1;
+ msgIds[0] = msgId;
+ msgIdList.msgIdList = msgIds;
+
+ MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList);
+
+ // Make Event Data
+ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_ALLOW_TCS_MESSAGE, err, (void**)ppEvent);
+ return eventSize;
+}
handlerMap[MSG_CMD_PLG_CHECK_UNIQUENESS] = &MsgCheckUniquenessHandler;
#endif
handlerMap[MSG_CMD_UPDATE_IMSI] = &MsgUpdateIMSIHandler;
+ handlerMap[MSG_CMD_ALLOW_TCS_MESSAGE] = &MsgAllowTcsMessageHandler;
}
MSG_CMD_PLG_CHECK_UNIQUENESS,
#endif
+ MSG_CMD_ALLOW_TCS_MESSAGE,
MSG_CMD_CHECK_PERMISSION,
MSG_CMD_REG_THREAD_CHANGE_CB,
MSG_CMD_PLG_THREAD_CHANGE_IND,
#ifdef FEATURE_SMS_CDMA
MSG_EVENT_PLG_CHECK_UNIQUENESS,
#endif
+ MSG_EVENT_ALLOW_TCS_MESSAGE,
MSG_EVENT_CHECK_PERMISSION,
MSG_EVENT_REG_THREAD_CHANGE_CB,
MSG_EVENT_PLG_THREAD_CHANGE_IND,
#define MSG_TELEPHONY_SMS_FEATURE "http://tizen.org/feature/network.telephony.sms"
#define MSG_TELEPHONY_MMS_FEATURE "http://tizen.org/feature/network.telephony.mms"
+#define MSG_TCS_MESSAGE "tcs_message"
+
/*==================================================================================================
TYPES
==================================================================================================*/
char mime_type[MAX_MIME_TYPE_LEN+1];
char media_item[MSG_FILEPATH_LEN_MAX+1];
char thumb_path[MSG_FILEPATH_LEN_MAX+1];
+ int tcs_level;
+ int malware_allow;
+ int thumb_tcs_level;
+ int thumb_malware_allow;
} MSG_MEDIA_INFO_S;
/**
int MsgAddSimMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgResendMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgUpdateIMSIHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgAllowTcsMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
#ifdef FEATURE_SMS_CDMA
int MsgCheckUniquenessHandler(const MSG_CMD_S *pCmd, char **ppEvent);
#endif
msg_error_t MsgCheckUniqueness(bool bInsert, msg_message_id_t msgId, MSG_UNIQUE_INDEX_S *p_msg);
#endif
msg_error_t MsgStoUpdateIMSI(int sim_idx);
+msg_error_t MsgStoAllowTcsMessage(msg_message_id_t msgId);
msg_error_t MsgStoUpdateDPMRestrictedStatus(MSG_MAIN_TYPE_T msgType);
#endif /* MSG_STORAGE_HANDLER_H */
*
* @see msg_db_free()
*/
+
int msg_db_select_with_query(msg_handle_t handle, const char *query, char ***db_res, int *row_count, int *col_count);
/**
*
* @see msg_db_select_with_query()
*/
+
int msg_db_free(msg_handle_t handle, char **db_res);
+
+/**
+ * @brief Allows TCS message with message ID.
+ * @details This API is used to update message to allow TCS.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.write
+ *
+ * @remarks This function MUST be called after Message handle is opened.
+ *
+ * @param[in] handle Message handle
+ * @param[in] msg_id The message ID to be updated
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval MSG_SUCCESS Success in operation
+ * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
+ * @retval MSG_ERR_STORAGE_ERROR Storage is error
+ * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval MSG_ERR_NOT_SUPPORTED Not supported
+ */
+
+int msg_allow_tcs_message(msg_handle_t handle, msg_message_id_t msg_id);
+
/**
* @}
*/
MSG_MEDIA_MIME_TYPE_STR, /**< Indicates the mimetype of a media file */
MSG_MEDIA_THUMB_PATH_STR, /**< Indicates the thumbnail path of a media file */
MSG_MEDIA_MESSAGE_ID_INT, /**< Indicates the message id */
+ MSG_MEDIA_TCS_LEVEL_INT, /**< Indicates detection of malware type */
+ MSG_MEDIA_MALWARE_ALLOW_INT, /**< Indicates malware allowed */
+ MSG_MEDIA_THUMBNAIL_TCS_LEVEL_INT, /**< Indicates thumbnail's detection of malware type */
+ MSG_MEDIA_THUMBNAIL_MALWARE_ALLOW_INT, /**< Indicates thumbnail's malware allowed */
};
/**
msg_error_t dbSelectWithQuery(const char *query, char ***db_res, int *row_count, int *col_count);
void dbFree(char **db_res);
+ msg_error_t allowTcsMessage(msg_message_id_t MsgId);
msg_error_t getRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList);
msg_error_t regStorageChangeCallback(msg_storage_change_cb onStorageChange, void *pUserParam);
case MSG_MEDIA_MESSAGE_ID_INT:
*value = pMedia->msg_id;
break;
+ case MSG_MEDIA_TCS_LEVEL_INT:
+ *value = pMedia->tcs_level;
+ break;
+ case MSG_MEDIA_MALWARE_ALLOW_INT:
+ *value = pMedia->malware_allow;
+ break;
+ case MSG_MEDIA_THUMBNAIL_TCS_LEVEL_INT:
+ *value = pMedia->thumb_tcs_level;
+ break;
+ case MSG_MEDIA_THUMBNAIL_MALWARE_ALLOW_INT:
+ *value = pMedia->thumb_malware_allow;
+ break;
default:
ret = MSG_ERR_INVALID_PARAMETER;
break;
return ret;
}
+
+EXPORT_API int msg_allow_tcs_message(msg_handle_t handle, msg_message_id_t msg_id)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ if (handle == NULL) {
+ return MSG_ERR_INVALID_PARAMETER;
+ }
+
+ try {
+ MsgHandle* pHandle = (MsgHandle*)handle;
+ err = pHandle->allowTcsMessage(msg_id);
+ } catch (MsgException& e) {
+ MSG_FATAL("%s", e.what());
+ return MSG_ERR_STORAGE_ERROR;
+ }
+
+ return err;
+}
msg_error_t err = MSG_SUCCESS;
try {
- if (pMsgInfo->networkStatus == MSG_NETWORK_NOT_SEND || pMsgInfo->networkStatus == MSG_NETWORK_SENDING) { /* draft update */
- err = MmsPluginStorage::instance()->updateMessage(pMsgInfo, pSendOptInfo, pFileData);
+ if (pFileData && strcmp(pFileData, MSG_TCS_MESSAGE) == 0) {
+ MSG_DEBUG("Update TCS Message");
+
+ if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS
+ && (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS
+ || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS)) {
+ MmsPluginStorage::instance()->updateMessage(pMsgInfo);
+ } else {
+ MSG_ERR("It is Not valid status, network = %d, subtype = %d", pMsgInfo->networkStatus, pMsgInfo->msgType.subType);
+ return MSG_ERR_INVALID_PARAMETER;
+ }
} else {
- /* [Update Message ID & File path only in case of retrieve. Else update Message ID] */
- if (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { /* retrieve conf */
- err = MmsPluginStorage::instance()->updateConfMessage(pMsgInfo);
+ if (pMsgInfo->networkStatus == MSG_NETWORK_NOT_SEND || pMsgInfo->networkStatus == MSG_NETWORK_SENDING) { /* draft update */
+ err = MmsPluginStorage::instance()->updateMessage(pMsgInfo, pSendOptInfo, pFileData);
} else {
- err = MmsPluginStorage::instance()->updateMsgServerID(pMsgInfo, pSendOptInfo); /* update send conf */
+ /* [Update Message ID & File path only in case of retrieve. Else update Message ID] */
+ if (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { /* retrieve conf */
+ err = MmsPluginStorage::instance()->updateConfMessage(pMsgInfo);
+ } else {
+ err = MmsPluginStorage::instance()->updateMsgServerID(pMsgInfo, pSendOptInfo); /* update send conf */
+ }
}
}
} catch (MsgException& e) {
MsgStoDbFree(db_res);
MSG_END();
}
+
+
+msg_error_t MsgHandle::allowTcsMessage(msg_message_id_t MsgId)
+{
+ MSG_BEGIN();
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ /* Set Command Parameters */
+ pCmd->cmdType = MSG_CMD_ALLOW_TCS_MESSAGE;
+
+ /* Copy Cookie */
+ memcpy((void*)pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+ /* Copy Command Data */
+ memcpy((void*)((char*)pCmd + sizeof(MSG_CMD_TYPE_T) + MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
+
+ /* Send Command to Messaging FW */
+ char* pEventData = NULL;
+ unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ /* Get Return Data */
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent == NULL) {
+ THROW(MsgException::INVALID_RESULT, "Event is NULL");
+ }
+
+ if (pEvent->eventType != MSG_EVENT_ALLOW_TCS_MESSAGE) {
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
+ }
+
+ return pEvent->result;
+}
case MSG_CMD_PLG_CHECK_UNIQUENESS:
return "MSG_CMD_PLG_CHECK_UNIQUENESS";
#endif
+ case MSG_CMD_ALLOW_TCS_MESSAGE:
+ return "MSG_CMD_ALLOW_TCS_MESSAGE";
case MSG_CMD_CHECK_PERMISSION:
return "MSG_CMD_CHECK_PERMISSION";
case MSG_CMD_REG_THREAD_CHANGE_CB:
case MSG_EVENT_PLG_CHECK_UNIQUENESS:
return "MSG_EVENT_PLG_CHECK_UNIQUENESS";
#endif
+ case MSG_EVENT_ALLOW_TCS_MESSAGE:
+ return "MSG_EVENT_ALLOW_TCS_MESSAGE";
case MSG_EVENT_CHECK_PERMISSION:
return "MSG_EVENT_CHECK_PERMISSION";
for (int i = 0; i < msgIdCnt; i++) {
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONTENT_TYPE, FILE_PATH, THUMB_FILE_PATH "
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, TCS_LEVEL, MALWARE_ALLOW, CONTENT_TYPE, FILE_PATH, THUMB_FILE_PATH, TCS_LEVEL, MALWARE_ALLOW "
"FROM %s WHERE MSG_ID = %d AND SEQ <> -1 AND (TCS_LEVEL = -1 OR MALWARE_ALLOW = 1);",
MSGFW_MMS_MULTIPART_TABLE_NAME, msgIds[i]);
}
MSG_MEDIA_INFO_S *pMedia = NULL;
+ int tcs_level = -1, malware_allow = 0, thumb_tcs_level = -1, thumb_malware_allow = 0;
char mime_type[MAX_MIME_TYPE_LEN+1], media_item[MSG_FILEPATH_LEN_MAX+1], thumb_path[MSG_FILEPATH_LEN_MAX+1];
for (int j = 0; j < rowCnt; j++) {
msg_id = dbHandle->getColumnToInt(index++);
+ tcs_level = dbHandle->getColumnToInt(index++);
+ malware_allow = dbHandle->getColumnToInt(index++);
memset(mime_type, 0x00, sizeof(mime_type));
dbHandle->getColumnToString(index++, MAX_MIME_TYPE_LEN, mime_type);
memset(media_item, 0x00, sizeof(media_item));
dbHandle->getColumnToString(index++, MSG_FILEPATH_LEN_MAX, media_item);
memset(thumb_path, 0x00, sizeof(thumb_path));
dbHandle->getColumnToString(index++, MSG_FILEPATH_LEN_MAX, thumb_path);
+ thumb_tcs_level = dbHandle->getColumnToInt(index++);
+ thumb_malware_allow = dbHandle->getColumnToInt(index++);
if (strstr(mime_type, "image") || strstr(mime_type, "video")) {
msg_struct_s *media_struct_s = new msg_struct_s;
pMedia = (MSG_MEDIA_INFO_S *)media_struct_s->data;
pMedia->msg_id = msg_id;
+ pMedia->tcs_level = tcs_level;
+ pMedia->malware_allow = malware_allow;
snprintf(pMedia->mime_type, MAX_MIME_TYPE_LEN, "%s", mime_type);
snprintf(pMedia->media_item, MSG_FILEPATH_LEN_MAX, "%s", media_item);
snprintf(pMedia->thumb_path, MSG_FILEPATH_LEN_MAX, "%s", thumb_path);
+ pMedia->thumb_tcs_level = thumb_tcs_level;
+ pMedia->thumb_malware_allow = thumb_malware_allow;
media_list = g_list_append(media_list, media_struct_s);
}