modify msg-service to support dpm feature
[platform/core/messaging/msg-service.git] / framework / submit-handler / MsgSubmitHandler.cpp
index d8e7fbe..82d0d20 100755 (executable)
@@ -25,7 +25,7 @@
 #include "MsgPluginManager.h"
 #include "MsgStorageHandler.h"
 #include "MsgSubmitHandler.h"
-
+#include "MsgUtilFunction.h"
 
 
 /*==================================================================================================
@@ -39,6 +39,13 @@ msg_error_t MsgSubmitReq(MSG_REQUEST_INFO_S *pReqInfo, bool bScheduled)
        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);