-PRAGMA user_version=1;
+PRAGMA user_version=2;
CREATE TABLE MSG_CONVERSATION_TABLE
(
ATTACHMENT_COUNT INTEGER DEFAULT 0 ,
SIM_INDEX INTEGER DEFAULT 0 ,
SIM_IMSI TEXT ,
+ DPM_RESTRICTED INTERGER DEFAULT 0 ,
FOREIGN KEY (CONV_ID) REFERENCES MSG_CONVERSATION_TABLE (CONV_ID) ,
FOREIGN KEY (FOLDER_ID) REFERENCES MSG_FOLDER_TABLE (FOLDER_ID)
#endif
}
+ if (msg_check_dpm_policy(pMsgInfo->msgType.mainType) == false) {
+ MSG_DEBUG("Messaging is restricted by DPM policy.");
+ pMsgInfo->bRestricted = true;
+ *pSendNoti = false;
+ *bOnlyNoti = false;
+ }
+
if (pMsgInfo->msgType.subType == MSG_NORMAL_SMS) {
MSG_DEBUG("Add Normal Message");
err = MsgStoAddMessage(pMsgInfo, &send_opt);
}
}
+ if (msg_check_dpm_policy(pMsgInfo->msgType.mainType) == false) {
+ MSG_DEBUG("Messaging is restricted by DPM policy.");
+ pMsgInfo->bRestricted = true;
+ *pSendNoti = false;
+ }
+
err = MsgStoAddMessage(pMsgInfo, NULL);
if (err != MSG_SUCCESS) {
#include "MsgStorageTypes.h"
#include "MsgCmdHandler.h"
#include "MsgUtilFile.h"
+#include "MsgUtilFunction.h"
#include "MsgUtilStorage.h"
#include "MsgNotificationWrapper.h"
MsgInitCallStatusManager();
+ msg_init_dpm_policy();
+
try {
/* storage handler initialize */
err = MsgStoInitDB(false);
MsgDeInitCallStatusManager();
+ msg_deinit_dpm_policy();
+
return 0;
}
#include "MsgPluginManager.h"
#include "MsgStorageHandler.h"
-#define MSG_DB_VERSION 1
+#define MSG_DB_VERSION 2
/*==================================================================================================
VARIABLES
}
+void MsgUpdateDBtoVer2()
+{
+ MsgDbHandler *dbHandle = getDbHandle();
+ msg_error_t err = MSG_SUCCESS;
+ char sqlQuery[MAX_QUERY_LEN+1] = {0};
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "ALTER TABLE %s "
+ "ADD (DPM_RESTRICTED INTEGER DEFAULT 0);",
+ MSGFW_MESSAGE_TABLE_NAME);
+
+ err = dbHandle->execQuery(sqlQuery);
+
+ if (err == MSG_SUCCESS)
+ MSG_SEC_DEBUG("SUCCESS : alter %s.", MSGFW_MESSAGE_TABLE_NAME);
+ else
+ MSG_SEC_DEBUG("FAIL : create %s [%d].", MSGFW_MESSAGE_TABLE_NAME, err);
+}
+
+
void MsgStoUpdateDBVersion()
{
MsgDbHandler *dbHandle = getDbHandle();
case 0 :
MsgUpdateDBtoVer1();
/* no break */
+ case 1 :
+ MsgUpdateDBtoVer2();
+ /* no break */
default :
MsgStoUpdateDBVersion();
/* no break */
#include "MsgStorageHandler.h"
#include "MsgNotificationWrapper.h"
#include "MsgDevicedWrapper.h"
+#include "MsgTransManager.h"
using namespace std;
/* Add Message */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %u, %d, %d, %d, %d, %d, %d, %d, %d, ?, '', '', ?, 0, %d, '%s');",
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %u, %d, %d, %d, %d, %d, %d, %d, %d, ?, '', '', ?, 0, %d, '%s', %d);",
MSGFW_MESSAGE_TABLE_NAME, rowId, convId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType,
(unsigned int)pMsg->displayTime, pMsg->dataSize, pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction,
- 0, pMsg->bBackup, pMsg->sim_idx, imsi);
+ 0, pMsg->bBackup, pMsg->sim_idx, imsi, pMsg->bRestricted);
MSG_DEBUG("QUERY : %s", sqlQuery);
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, \
SUB_TYPE, DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \
- BACKUP, PRIORITY, MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, THUMB_PATH, SIM_INDEX \
+ BACKUP, PRIORITY, MSG_DIRECTION, DPM_RESTRICTED, SCHEDULED_TIME, SUBJECT, MSG_TEXT, THUMB_PATH, SIM_INDEX \
FROM %s WHERE MSG_ID = %d;",
MSGFW_MESSAGE_TABLE_NAME, msgId);
pMsg->bBackup = dbHandle->columnInt(11);
pMsg->priority = dbHandle->columnInt(12);
pMsg->direction = dbHandle->columnInt(13);
+ pMsg->bRestricted = dbHandle->columnInt(14);
- strncpy(pMsg->subject, (char *)dbHandle->columnText(15), MAX_SUBJECT_LEN);
+ strncpy(pMsg->subject, (char *)dbHandle->columnText(16), MAX_SUBJECT_LEN);
/* Temp_File_Handling */
if (pMsg->msgType.mainType == MSG_SMS_TYPE || pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) {
char msgData[pMsg->dataSize+1];
memset(msgData, 0x00, sizeof(msgData));
- strncpy(msgData, (char *)dbHandle->columnText(16), pMsg->dataSize);
+ strncpy(msgData, (char *)dbHandle->columnText(17), pMsg->dataSize);
/* Save Message Data into File */
char fileName[MSG_FILENAME_LEN_MAX+1];
pMsg->bTextSms = false;
} else {
memset(pMsg->msgText, 0x00, sizeof(pMsg->msgText));
- strncpy(pMsg->msgText, (char *)dbHandle->columnText(16), pMsg->dataSize);
+ strncpy(pMsg->msgText, (char *)dbHandle->columnText(17), pMsg->dataSize);
/* For WAP PUSH SI Message */
if (pMsg->msgType.subType == MSG_WAP_SI_SMS) {
}
} else {
if (dbHandle->columnText(16) != NULL)
- strncpy(pMsg->msgText, (char *)dbHandle->columnText(16), MAX_MSG_TEXT_LEN);
+ strncpy(pMsg->msgText, (char *)dbHandle->columnText(17), MAX_MSG_TEXT_LEN);
}
/* thumbnail path */
- if (dbHandle->columnText(17)!= NULL && ((char *)dbHandle->columnText(17))[0] != '\0') {
- strncpy(pMsg->thumbPath, (char *)dbHandle->columnText(17), MSG_FILEPATH_LEN_MAX);
+ if (dbHandle->columnText(18)!= NULL && ((char *)dbHandle->columnText(18))[0] != '\0') {
+ strncpy(pMsg->thumbPath, (char *)dbHandle->columnText(18), MSG_FILEPATH_LEN_MAX);
MSG_DEBUG("pMsg->thumbPath : [%s]", pMsg->thumbPath);
}
- pMsg->sim_idx = dbHandle->columnInt(18);
+
+ if (pMsg->bRestricted == true) {
+ pMsg->dataSize = 0;
+ memset(pMsg->msgData, 0x00, sizeof(pMsg->msgData));
+ memset(pMsg->msgText, 0x00, sizeof(pMsg->msgText));
+ memset(pMsg->subject, 0x00, sizeof(pMsg->subject));
+ memset(pMsg->thumbPath, 0x00, sizeof(pMsg->thumbPath));
+
+ }
+
+ pMsg->sim_idx = dbHandle->columnInt(19);
} else {
dbHandle->finalizeQuery();
MSG_DEBUG("%s", sqlQuery);
return MSG_SUCCESS;
}
+
+
+msg_error_t MsgStoUpdateDPMRestrictedStatus(MSG_MAIN_TYPE_T msgType)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ char sqlQuery[MAX_QUERY_LEN+1];
+ MsgDbHandler *dbHandle = getDbHandle();
+
+ msg_id_list_s msgIdList = {0,};
+ int rowCnt = 0;
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE MAIN_TYPE = %d AND DPM_RESTRICTED = 1;",
+ MSGFW_MESSAGE_TABLE_NAME, msgType);
+
+ err = dbHandle->getTable(sqlQuery, &rowCnt, NULL);
+ if (err != MSG_SUCCESS) {
+ dbHandle->freeTable();
+ return err;
+ }
+
+ msg_message_id_t *msgIds = new msg_message_id_t[rowCnt];
+ for (int i = 0; i < rowCnt; i++) {
+ msgIds[i] = dbHandle->getColumnToInt(i + 1);
+ }
+
+ dbHandle->freeTable();
+
+ msgIdList.nCount = rowCnt;
+ msgIdList.msgIdList = msgIds;
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET DPM_RESTRICTED = 0 WHERE MAIN_TYPE = %d AND DPM_RESTRICTED = 1;",
+ MSGFW_MESSAGE_TABLE_NAME, msgType);
+
+ err = dbHandle->execQuery(sqlQuery);
+ if (err == MSG_SUCCESS) {
+ MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_UPDATE, &msgIdList);
+ }
+
+ if (msgIdList.msgIdList)
+ delete [] msgIdList.msgIdList;
+
+ return err;
+}
#include "MsgPluginManager.h"
#include "MsgStorageHandler.h"
#include "MsgSubmitHandler.h"
-
+#include "MsgUtilFunction.h"
/*==================================================================================================
pReqInfo->reqId = reqId;
reqId++;
+ if (msg_check_dpm_policy(pReqInfo->msgInfo.msgType.mainType) == false) {
+ MSG_DEBUG("Messaging is restricted by DPM policy.");
+ MsgDbHandler *dbHandle = getDbHandle();
+ MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
+ return MSG_ERR_DPM_RESTRICT;
+ }
+
MSG_DEBUG("==== Msg ID = [%d] ====", pReqInfo->msgInfo.msgId);
MSG_DEBUG("==== Folder ID = [%d] ====", pReqInfo->msgInfo.folderId);
MSG_INFO("==== Main Type = [%d] ====", pReqInfo->msgInfo.msgType.mainType);
}
} else if (msgInfo.msgPort.valid || (msgInfo.msgType.subType >= MSG_MWI_VOICE_SMS && msgInfo.msgType.subType <= MSG_MWI_OTHER_SMS)) {
MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo);
- } else if (msgInfo.folderId == MSG_SPAMBOX_ID) {
+ } else if (msgInfo.folderId == MSG_SPAMBOX_ID || msgInfo.bRestricted == true) {
MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
} else if (msgInfo.msgType.subType == MSG_STATUS_REPORT_SMS || msgInfo.msgType.subType == MSG_DELIVERYIND_MMS) {
MsgTransactionManager::instance()->broadcastReportMsgCB(err, MSG_REPORT_TYPE_DELIVERY, &msgInfo);
bool bStore; /**< Indicates whether the message is stored or not if it is MWI message. */
int sim_idx;
char msgURL[MMS_LOCATION_LEN + 1];
+ bool bRestricted; /**< Indicates whether the message is restricted by DPM(Device Policy Manager) or not. */
} MSG_MESSAGE_INFO_S;
void *pMmsData; /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
size_t mmsDataSize;
int simIndex;
+ bool bRestricted; /**< Indicates whether the message is restricted by DPM(Device Policy Manager) or not. */
} MSG_MESSAGE_HIDDEN_S;
char firstMediaPath[MSG_FILEPATH_LEN_MAX+1]; /**< First Media Path in mms; */
msg_list_handle_t multipart_list;
int simIndex;
+ bool bRestricted;
} MSG_CONVERSATION_VIEW_S;
typedef struct {
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 MsgStoUpdateDPMRestrictedStatus(MSG_MAIN_TYPE_T msgType);
#endif /* MSG_STORAGE_HANDLER_H */
MSG_MESSAGE_ADDR_LIST_HND, /**< Indicates the address information list. */
MSG_MESSAGE_REPLACE_BOOL, /**< Indicates whether the message is replace or not */
MSG_MESSAGE_SIM_INDEX_INT, /**< Indicates the sim index */
+ MSG_MESSAGE_DPM_RESTRICTED_BOOL, /**< Indicates whether the message is DPM restricted or not*/
MSG_MESSAGE_INFO_MAX, /**< Placeholder for max value of this enum*/
};
MSG_CONV_MSG_1ST_MEDIA_PATH_STR, /**< Indicates the First Media path of MMS */
MSG_CONV_MSG_MULTIPART_HND,
MSG_CONV_MSG_SIM_INDEX_INT, /**< Indicates the sim index */
+ MSG_CONV_MSG_DPM_RESTRICTED_BOOL, /**< */
MSG_CONV_INFO_MAX /**< Placeholder for max value of this enum */
};
MSG_ERR_DB_BUSY = -61, /**< DB file locked*/
MSG_ERR_NOT_SUPPORTED = -63, /**< Not supported */
MSG_ERR_NOT_ALLOWED_ZONE = -100, /**< Not allowed zone */
+ MSG_ERR_DPM_RESTRICT = -200, /**< DPM restriction */
};
msg_error_t msg_aul_svc_set_uri(bundle *bundle_data, char *uri);
-/* Dbus function */
-void MsgDbusInit();
-void MsgDbusDeinit();
+void msg_init_dpm_policy();
+
+void msg_deinit_dpm_policy();
+
+bool msg_check_dpm_policy(int type);
#endif /* MSG_UTIL_FUNCTION_H */
*value = false;
break;
}
+ case MSG_MESSAGE_DPM_RESTRICTED_BOOL:
+ *value = msg_data->bRestricted;
+ break;
default:
ret = MSG_ERR_INVALID_PARAMETER;
break;
case MSG_CONV_MSG_PROTECTED_BOOL:
*value = pConv->bProtected;
break;
+ case MSG_CONV_MSG_DPM_RESTRICTED_BOOL:
+ *value = pConv->bRestricted;
+ break;
default:
ret = MSG_ERR_INVALID_PARAMETER;
break;
BuildRequires: pkgconfig(cynara-session)
BuildRequires: pkgconfig(deviced)
BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(dpm)
BuildRequires: pkgconfig(eventsystem)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(icu-uc)
#include "MsgException.h"
#include "MsgGconfWrapper.h"
#include "MsgUtilFile.h"
+#include "MsgUtilFunction.h"
#include "MsgMmsMessage.h"
#include "MsgSerialize.h"
#include "MmsPluginDebug.h"
MSG_BEGIN();
try {
+ if (msg_check_dpm_policy(pReqInfo->msgInfo.msgType.mainType) == false) {
+ MSG_DEBUG("Messaging is restricted by DPM policy.");
+ return MSG_ERR_DPM_RESTRICT;
+ }
+
MmsPluginTransport::instance()->submitRequest(pReqInfo);
} catch (MsgException& e) {
MSG_FATAL("%s", e.what());
}
pDest->sim_idx = pSrc->simIndex;
+ pDest->bRestricted = pSrc->bRestricted;
MSG_END();
}
pDest->priority = pSrc->priority;
pDest->direction = pSrc->direction;
pDest->simIndex = pSrc->sim_idx;
+ pDest->bRestricted = pSrc->bRestricted;
/* Set Port Info. */
pDest->bPortValid = pSrc->msgPort.valid;
INCLUDE(FindPkgConfig)
-SET(PKG_MODULES glib-2.0 vconf dlog libxml-2.0 boost json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login libsmack csr)
+SET(PKG_MODULES glib-2.0 vconf dlog libxml-2.0 boost json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login libsmack csr dpm)
pkg_check_modules(utils_pkgs REQUIRED ${PKG_MODULES})
FOREACH(flag ${utils_pkgs_CFLAGS})
* limitations under the License.
*/
-#include <gio/gio.h>
#include <systemd/sd-login.h>
#include "MsgDebug.h"
#include "MsgGconfWrapper.h"
#include "MsgUtilFile.h"
#include "MsgUtilFunction.h"
+#include "MsgUtilStorage.h"
#include <system_info.h>
#include <libintl.h>
#include <ctype.h>
#include <aul.h>
#include <aul_svc.h>
+#include <dpm/restriction.h>
typedef struct _msg_launch_app_data {
char *app_id;
[FEATURE_INDEX_MMS] = false,
};
-int _dbus_owner_id = 0;
+static int dpm_policy_enable[] = {
+ [MSG_UNKNOWN_TYPE] = 0,
+ [MSG_SMS_TYPE] = 1,
+ [MSG_MMS_TYPE] = 1,
+};
+
+device_policy_manager_h dpm_handle = NULL;
+bool is_dpm_init = false;
+int dpm_sms_callback_id = 0;
+int dpm_mms_callback_id = 0;
+
#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
static int phonenumberMinMatchDigit = -1;
#endif
}
-void MsgDbusInit()
+void dpm_sms_policy_changed_callback(const char* name, const char* object, void *user_data)
+{
+ MSG_INFO("dpm_sms_policy_changed_callback called. name [%s] object [%s]", name, object);
+
+ int ret = 0;
+
+ ret = dpm_restriction_get_messaging_state(dpm_handle, &dpm_policy_enable[MSG_SMS_TYPE - 1]);
+ if (ret != DPM_ERROR_NONE) {
+ MSG_ERR("dpm_restriction_get_messaging_state failed [%d]", ret);
+ return;
+ }
+}
+
+
+void dpm_mms_policy_changed_callback(const char* name, const char* object, void *user_data)
+{
+ MSG_INFO("dpm_mms_policy_changed_callback called. name [%s] object [%s]", name, object);
+
+ int ret = 0;
+
+ ret = dpm_restriction_get_messaging_state(dpm_handle, &dpm_policy_enable[MSG_MMS_TYPE - 1]);
+ if (ret != DPM_ERROR_NONE) {
+ MSG_ERR("dpm_restriction_get_messaging_state failed [%d]", ret);
+ return;
+ }
+}
+
+
+static bool __get_dpm_policy()
{
- MSG_DEBUG();
+ int ret = 0;
+
+ ret = dpm_restriction_get_messaging_state(dpm_handle, &dpm_policy_enable[MSG_SMS_TYPE]);
+ if (ret != DPM_ERROR_NONE) {
+ MSG_ERR("dpm_restriction_get_messaging_state failed [%d]", ret);
+ return false;
+ }
+
+ MSG_DEBUG("sms policy [%d]", dpm_policy_enable[MSG_SMS_TYPE]);
+ MSG_DEBUG("mms policy [%d]", dpm_policy_enable[MSG_MMS_TYPE]);
+
+ ret = dpm_add_policy_changed_cb(dpm_handle, "messaging", dpm_sms_policy_changed_callback, NULL, &dpm_sms_callback_id);
+ if (ret != DPM_ERROR_NONE) {
+ MSG_ERR("dpm_add_policy_changed_cb failed [%d]", ret);
+ return false;
+ }
- _dbus_owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
- "msg-service.dbus.service",
- G_BUS_NAME_OWNER_FLAGS_NONE,
- NULL, NULL, NULL,
- NULL, NULL);
+ return true;
+}
+
+void msg_init_dpm_policy()
+{
+ MSG_BEGIN();
- if (_dbus_owner_id == 0) {
- MSG_ERR("g_bus_own_name() error");
+ dpm_handle = dpm_manager_create();
+ if (dpm_handle == NULL) {
+ MSG_ERR("dpm_manager_create() failed");
+ return;
}
- MSG_DEBUG("owner_id = [%d]", _dbus_owner_id);
+ is_dpm_init = __get_dpm_policy();
+
+ MSG_END();
+}
+
+
+void msg_deinit_dpm_policy()
+{
+ if (dpm_handle)
+ dpm_manager_destroy(dpm_handle);
+
+ if (dpm_sms_callback_id)
+ dpm_remove_policy_changed_cb(dpm_handle, dpm_sms_callback_id);
+
+ if (dpm_mms_callback_id)
+ dpm_remove_policy_changed_cb(dpm_handle, dpm_mms_callback_id);
+
+ is_dpm_init = false;
}
-void MsgDbusDeinit()
+bool msg_check_dpm_policy(int type)
{
- MSG_DEBUG();
- if (_dbus_owner_id)
- g_bus_unown_name(_dbus_owner_id);
+ if (is_dpm_init == false)
+ msg_init_dpm_policy();
- _dbus_owner_id = 0;
+ return dpm_policy_enable[MSG_SMS_TYPE];
+// return dpm_policy_enable[type];
}
+
char sqlQuery[MAX_QUERY_LEN+1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %u, %d, %d, %d, %d, %d, %d, %d, %d, ?, '', '', ?, 0, %d, '%s');",
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %u, %d, %d, %d, %d, %d, %d, %d, %d, ?, '', '', ?, 0, %d, '%s', %d);",
MSGFW_MESSAGE_TABLE_NAME, msgId, pMsgInfo->threadId, pMsgInfo->folderId, pMsgInfo->storageId, pMsgInfo->msgType.mainType,
pMsgInfo->msgType.subType, (unsigned int)pMsgInfo->displayTime, pMsgInfo->dataSize, pMsgInfo->networkStatus, pMsgInfo->bRead, pMsgInfo->bProtected,
- pMsgInfo->priority, pMsgInfo->direction, 0, pMsgInfo->bBackup, pMsgInfo->sim_idx, imsi);
+ pMsgInfo->priority, pMsgInfo->direction, 0, pMsgInfo->bBackup, pMsgInfo->sim_idx, imsi, pMsgInfo->bRestricted);
MSG_DEBUG("QUERY : %s", sqlQuery);
snprintf(sqlQuery, sizeof(sqlQuery),
"SELECT MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, LENGTH(SUBJECT), SUBJECT, MSG_TEXT "
"FROM %s "
- "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND SCHEDULED_TIME = 0 ORDER BY DISPLAY_TIME DESC;",
+ "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND DPM_RESTRICTED = 0 AND SCHEDULED_TIME = 0 ORDER BY DISPLAY_TIME DESC;",
MSGFW_MESSAGE_TABLE_NAME,
convId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE);
}
err = pDbHandle->stepQuery();
- if (err != MSG_ERR_DB_ROW) {
+ if (err == MSG_ERR_DB_DONE) {
+ pDbHandle->finalizeQuery();
+
+ memset(sqlQuery, 0x00, MAX_QUERY_LEN);
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "SELECT MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, 0, '', '' "
+ "FROM %s "
+ "WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d AND SCHEDULED_TIME = 0 ORDER BY DISPLAY_TIME DESC;",
+ MSGFW_MESSAGE_TABLE_NAME,
+ convId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE);
+
+ err = pDbHandle->prepareQuery(sqlQuery);
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("Fail to prepareQuery().");
+ return err;
+ }
+
+ err = pDbHandle->stepQuery();
+ if (err != MSG_ERR_DB_ROW) {
+ MSG_DEBUG("Fail to stepQuery().");
+ pDbHandle->finalizeQuery();
+ return err;
+ }
+
+ } else if (err != MSG_ERR_DB_ROW) {
MSG_DEBUG("Fail to stepQuery().");
pDbHandle->finalizeQuery();
return err;
tmpSize = strlen(sqlQuery);
#ifdef MSG_NOTI_INTEGRATION
snprintf(sqlQuery+tmpSize, MAX_QUERY_LEN-tmpSize,
- "UNREAD_CNT = (SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND (FOLDER_ID = %d OR FOLDER_ID = %d) AND STORAGE_ID = %d AND READ_STATUS = 0), ",
+ "UNREAD_CNT = (SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND (FOLDER_ID = %d OR FOLDER_ID = %d) AND STORAGE_ID = %d AND READ_STATUS = 0 AND DPM_RESTRICTED = 0), ",
MSGFW_MESSAGE_TABLE_NAME, convId, MSG_INBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
#else
snprintf(sqlQuery+tmpSize, MAX_QUERY_LEN-tmpSize,
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \
DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \
- MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, SIM_INDEX\
+ MSG_DIRECTION, DPM_RESTRICTED, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, SIM_INDEX\
FROM %s WHERE MSG_ID = %d;",
MSGFW_MESSAGE_TABLE_NAME, msgId);
pConv->bRead = dbHandle->getColumnToInt(index++);
pConv->bProtected = dbHandle->getColumnToInt(index++);
pConv->direction = dbHandle->getColumnToInt(index++);
+ pConv->bRestricted = dbHandle->getColumnToInt(index++);
pConv->scheduledTime = (time_t)dbHandle->getColumnToInt(index++);
dbHandle->getColumnToString(index++, MAX_SUBJECT_LEN, pConv->subject);
/*It does Not need to Get attach count in MSG_MESSAGE_TABLE. see MsgStoGetConversationPreview */
/*pConv->attachCount = dbHandle->getColumnToInt(index++); */
index++;
+ if (pConv->bRestricted == true) {
+ pConv->textSize = 0;
+ memset(pConv->subject, 0x00, sizeof(pConv->subject));
+ tmpText[0] = '\0';
+ }
+
pConv->simIndex = dbHandle->getColumnToInt(index++);
dbHandle->freeTable();
#ifdef MSG_NOTI_INTEGRATION
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \
DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \
- MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, SIM_INDEX \
+ MSG_DIRECTION, DPM_RESTRICTED, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, SIM_INDEX \
FROM %s WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d ORDER BY DISPLAY_TIME, MSG_ID ASC;",
MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE);
#else
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \
DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \
- MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT \
+ MSG_DIRECTION, DPM_RESTRICTED, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT \
FROM %s WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d ORDER BY DISPLAY_TIME, MSG_ID ASC;",
MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
#endif
pTmp->bRead = dbHandle->getColumnToInt(index++);
pTmp->bProtected = dbHandle->getColumnToInt(index++);
pTmp->direction = dbHandle->getColumnToInt(index++);
+ pTmp->bRestricted = dbHandle->getColumnToInt(index++);
index++; /* This field is reserved. */
dbHandle->getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject);
/*It does Not need to Get attach count in MSG_MESSAGE_TABLE. see MsgStoGetConversationPreview */
/*pTmp->attachCount = dbHandle->getColumnToInt(index++); */
index++;
+
+ if (pTmp->bRestricted == true) {
+ pTmp->textSize = 0;
+ memset(pTmp->subject, 0x00, sizeof(pTmp->subject));
+ tmpText[i][0] = '\0';
+ }
pTmp->simIndex = dbHandle->getColumnToInt(index++);
}
dbHandle->freeTable();
if (pListCond->pTextVal != NULL && multipartCnt > 0) {
memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset));
- snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FROM %s C, %s B, %s A WHERE A.CONV_ID > 0 AND A.CONV_ID = B.CONV_ID AND ",
+ snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FROM %s C, %s B, %s A WHERE A.CONV_ID > 0 AND A.CONV_ID = B.CONV_ID ",
MSGFW_MMS_MULTIPART_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME);
} else {
memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset));
- snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FROM %s B, %s A WHERE A.CONV_ID > 0 AND A.CONV_ID = B.CONV_ID AND ",
+ snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FROM %s B, %s A WHERE A.CONV_ID > 0 AND A.CONV_ID = B.CONV_ID ",
MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME);
}
strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery));
+ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset));
+ snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.DPM_RESTRICTED = 0 ");
+ strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery));
+
/* folder */
memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset));
if (pListCond->folderId == MSG_ALLBOX_ID)
- snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "A.FOLDER_ID > 0 AND A.FOLDER_ID < %d ", MSG_SPAMBOX_ID);
+ snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.FOLDER_ID > 0 AND A.FOLDER_ID < %d ", MSG_SPAMBOX_ID);
else if (pListCond->folderId == MSG_IOSBOX_ID)
- snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "A.FOLDER_ID > 0 AND A.FOLDER_ID < %d ", MSG_DRAFT_ID);
+ snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.FOLDER_ID > 0 AND A.FOLDER_ID < %d ", MSG_DRAFT_ID);
else
- snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "A.FOLDER_ID = %d ", pListCond->folderId);
+ snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.FOLDER_ID = %d ", pListCond->folderId);
strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery));
int msgIdCnt = 0;
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE MAIN_TYPE = %d AND CONV_ID = %d;",
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE MAIN_TYPE = %d AND DPM_RESTRICTED = 0 AND CONV_ID = %d;",
MSGFW_MESSAGE_TABLE_NAME, MSG_MMS_TYPE, threadId);
MSG_DEBUG("sqlQuery = [%s]", sqlQuery);