* limitations under the License.
*/
+#include <systemd/sd-login.h>
+
#include "MsgDebug.h"
#include "MsgContact.h"
+#include "MsgGconfWrapper.h"
+#include "MsgUtilFile.h"
#include "MsgUtilFunction.h"
+#include "MsgUtilStorage.h"
#include <system_info.h>
+#include <libintl.h>
+#include <locale.h>
+#include <vconf.h>
+#include <ctype.h>
+#include <aul.h>
+#include <aul_svc.h>
+#include <gio/gio.h>
+
+typedef struct _msg_launch_app_data {
+ char *app_id;
+ bundle *bundle_data;
+} msg_launch_app_data;
+
+#define DEFAULT_MIN_MATCH_DIGIT 8
+
+#define SYSPOPUP_BUS_NAME "org.tizen.DevicePolicyManager"
+#define SYSPOPUP_OBJECT_PATH "/org/tizen/DevicePolicyManager/Syspopup"
+#define SYSPOPUP_INTERFACE "org.tizen.DevicePolicyManager.Syspopup"
+#define SYSPOPUP_METHOD_SHOW "show"
+
+enum _FEATURE_INDEX_E {
+ FEATURE_INDEX_SMS = 0,
+ FEATURE_INDEX_MMS = 1,
+};
+
+static bool b_feature_cache_flag = false;
+static bool b_feature_support[] = {
+ [FEATURE_INDEX_SMS] = false,
+ [FEATURE_INDEX_MMS] = false,
+};
+
+static int dpm_policy_enable[] = {
+ [MSG_UNKNOWN_TYPE] = 0,
+ [MSG_SMS_TYPE] = 1,
+ [MSG_MMS_TYPE] = 1,
+};
+
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+static int phonenumberMinMatchDigit = -1;
+#endif
-bool b_feature_check_flag = false;
-bool b_feature_telephony = false;
-bool b_feature_telephony_mms = false;
+pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER;
- /*==================================================================================================
+/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
{
bool result = false;
- if (b_feature_check_flag == false) {
- system_info_get_platform_bool(MSG_TELEPHONY_FEATURE, &b_feature_telephony);
- system_info_get_platform_bool(MSG_TELEPHONY_MMS_FEATURE, &b_feature_telephony_mms);
- MSG_INFO("[%s] feature is [%d]", MSG_TELEPHONY_FEATURE, b_feature_telephony);
- MSG_INFO("[%s] feature is [%d]", MSG_TELEPHONY_MMS_FEATURE, b_feature_telephony_mms);
+ if (b_feature_cache_flag == false) {
+ if (system_info_get_platform_bool(MSG_TELEPHONY_SMS_FEATURE, &b_feature_support[FEATURE_INDEX_SMS]) != SYSTEM_INFO_ERROR_NONE)
+ MSG_WARN("fail to system_info_get_platform_bool [%s]", MSG_TELEPHONY_SMS_FEATURE);
- b_feature_check_flag = true;
+ if (system_info_get_platform_bool(MSG_TELEPHONY_MMS_FEATURE, &b_feature_support[FEATURE_INDEX_MMS]) != SYSTEM_INFO_ERROR_NONE)
+ MSG_WARN("fail to system_info_get_platform_bool [%s]", MSG_TELEPHONY_MMS_FEATURE);
+
+ MSG_INFO("[%s] feature is [%d]", MSG_TELEPHONY_SMS_FEATURE, b_feature_support[FEATURE_INDEX_SMS]);
+ MSG_INFO("[%s] feature is [%d]", MSG_TELEPHONY_MMS_FEATURE, b_feature_support[FEATURE_INDEX_MMS]);
+
+ b_feature_cache_flag = true;
}
- if (!g_strcmp0(feature_name, MSG_TELEPHONY_FEATURE)) {
- result = b_feature_telephony;
+ if (!g_strcmp0(feature_name, MSG_TELEPHONY_SMS_FEATURE)) {
+ result = b_feature_support[FEATURE_INDEX_SMS];
} else if (!g_strcmp0(feature_name, MSG_TELEPHONY_MMS_FEATURE)) {
- result = b_feature_telephony_mms;
- } else {
- result = false;
+ result = b_feature_support[FEATURE_INDEX_MMS];
}
return result;
}
-// Encoders
+
+int MsgContactGetMinMatchDigit()
+{
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+ if (phonenumberMinMatchDigit <= 0) {
+ if (MsgSettingGetInt(VCONFKEY_CONTACTS_SVC_PHONENUMBER_MIN_MATCH_DIGIT, &phonenumberMinMatchDigit) != MSG_SUCCESS) {
+ MSG_INFO("MsgSettingGetInt() is failed");
+ }
+ MSG_DEBUG("phonenumberMinMatchDigit [%d]", phonenumberMinMatchDigit);
+
+ if (phonenumberMinMatchDigit < 1) {
+ phonenumberMinMatchDigit = DEFAULT_MIN_MATCH_DIGIT;
+ }
+ }
+
+ return phonenumberMinMatchDigit;
+#else
+ return DEFAULT_MIN_MATCH_DIGIT;
+#endif
+}
+
+/* Encoders */
int MsgEncodeCountInfo(MSG_COUNT_INFO_S *pCountInfo, char **ppDest)
{
int dataSize = 0;
memcpy(p, &count, sizeof(int));
p = (void*)((char*)p + sizeof(int));
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
memcpy(p, &(pRecipientList->recipientAddr[i]), sizeof(MSG_ADDRESS_INFO_S));
p = (void*)((char*)p + sizeof(MSG_ADDRESS_INFO_S));
}
msg_struct_s *folder_info = NULL;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
folder_info = (msg_struct_s *)pFolderList->msg_struct_info[i];
memcpy(p, folder_info->data, sizeof(MSG_FOLDER_INFO_S));
p = (void*)((char*)p + sizeof(MSG_FOLDER_INFO_S));
msg_struct_s *filter_info = NULL;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
filter_info = (msg_struct_s *)pFilterList->msg_struct_info[i];
memcpy(p, filter_info->data, sizeof(MSG_FILTER_S));
p = (void*)((char*)p + sizeof(MSG_FILTER_S));
}
-int MsgEncodeMsgType(MSG_MESSAGE_TYPE_S *pMsgType, char **ppDest)
-{
- int dataSize = 0;
-
- dataSize = (sizeof(MSG_MESSAGE_TYPE_S));
-
- *ppDest = (char*)new char[dataSize];
-
- void* p = (void*)*ppDest;
-
- memcpy(p, pMsgType, dataSize);
-
- return dataSize;
-}
-
-
int MsgEncodeThreadViewList(msg_struct_list_s *pThreadViewList, char **ppDest)
{
int count = 0, dataSize = 0;
msg_struct_s *thread_info = NULL;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
thread_info = (msg_struct_s *)pThreadViewList->msg_struct_info[i];
memcpy(p, thread_info->data, sizeof(MSG_THREAD_VIEW_S));
p = (void*)((char*)p + sizeof(MSG_THREAD_VIEW_S));
memcpy(p, &count, sizeof(int));
p = (void*)((char*)p + sizeof(int));
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
memcpy(p, &(pConvViewList->msg_struct_info[i]), sizeof(msg_struct_list_s));
p = (void*)((char*)p + sizeof(msg_struct_list_s));
}
}
+int MsgEncodeThreadChangeData(const msg_storage_change_type_t storageChangeType, const msg_thread_id_t threadId, char **ppDest)
+{
+ int dataSize = 0;
+
+ dataSize = sizeof(msg_storage_change_type_t) + sizeof(msg_thread_id_t);
+
+ *ppDest = (char*)new char[dataSize];
+
+ void* p = (void*)*ppDest;
+
+ memcpy(p, &storageChangeType, sizeof(msg_storage_change_type_t));
+ p = (void*)((char*)p + sizeof(msg_storage_change_type_t));
+
+ memcpy(p, &threadId, sizeof(msg_thread_id_t));
+
+ return dataSize;
+}
+
+
int MsgEncodeReportMsgData(const msg_report_type_t msgReportType, const MSG_MESSAGE_INFO_S *pMsgInfo, char **ppDest)
{
int dataSize = 0;
}
-
-// Decoders
+/* Decoders */
void MsgDecodeMsgId(char *pSrc, msg_message_id_t *pMsgId)
{
memcpy(pMsgId, pSrc, sizeof(msg_message_id_t));
pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt];
memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt);
- for (int i=0; i<pMsgInfo->nAddressCnt; i++) {
+ for (int i = 0; i < pMsgInfo->nAddressCnt; i++) {
memcpy(&(pMsgInfo->addressList[i]), pSrc + (sizeof(MSG_ADDRESS_INFO_S)*i), sizeof(MSG_ADDRESS_INFO_S));
}
}
pSrc = pSrc + sizeof(MSG_SENDINGOPT_INFO_S);
-
if(pMsgInfo->nAddressCnt > 0) {
pMsgInfo->addressList = NULL;
pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt];
memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt);
- for (int i=0; i<pMsgInfo->nAddressCnt; i++) {
+ for (int i = 0; i < pMsgInfo->nAddressCnt; i++) {
memcpy(&(pMsgInfo->addressList[i]), pSrc + (sizeof(MSG_ADDRESS_INFO_S)*i), sizeof(MSG_ADDRESS_INFO_S));
}
}
memcpy(&count, pSrc, sizeof(int));
pSrc = pSrc + sizeof(int);
- pRecipientList->recipientCnt= count;
+ pRecipientList->recipientCnt = count;
pRecipientList->recipientAddr = (MSG_ADDRESS_INFO_S*)new char[sizeof(MSG_ADDRESS_INFO_S)*count];
MSG_ADDRESS_INFO_S* pInfoTmp = pRecipientList->recipientAddr;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
memcpy(pInfoTmp, pSrc, sizeof(MSG_ADDRESS_INFO_S));
pSrc = pSrc + sizeof(MSG_ADDRESS_INFO_S);
pInfoTmp++;
memcpy(&count, pSrc, sizeof(int));
pSrc = pSrc + sizeof(int);
- if( count > 0 )
- {
+ if( count > 0 ) {
pFolderList->nCount = count;
pFolderList->msg_struct_info = (msg_struct_t *)calloc(count, sizeof(msg_struct_t));
-
+ if (pFolderList->msg_struct_info == NULL) {
+ pFolderList->nCount = 0;
+ return;
+ }
msg_struct_s *pInfoTmp = NULL;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
pFolderList->msg_struct_info[i] = (msg_struct_t )new msg_struct_s;
pInfoTmp = (msg_struct_s *)pFolderList->msg_struct_info[i];
pInfoTmp->type = MSG_STRUCT_FOLDER_INFO;
memcpy(pInfoTmp->data, pSrc, sizeof(MSG_FOLDER_INFO_S));
pSrc = pSrc + sizeof(MSG_FOLDER_INFO_S);
}
- }
- else if ( count == 0 )
- {
+ } else if ( count == 0 ) {
pFolderList->nCount = count;
pFolderList->msg_struct_info = NULL;
}
memcpy(&count, pSrc, sizeof(int));
pSrc = pSrc + sizeof(int);
- if( count > 0 )
- {
+ if( count > 0 ) {
pFilterList->nCount = count;
pFilterList->msg_struct_info = (msg_struct_t *)calloc(count, sizeof(MSG_FILTER_S *));
+ if (pFilterList->msg_struct_info == NULL) {
+ pFilterList->nCount = 0;
+ return;
+ }
+
msg_struct_s *pStructTmp = NULL;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
pFilterList->msg_struct_info[i] = (msg_struct_t )new msg_struct_s;
pStructTmp = (msg_struct_s *)pFilterList->msg_struct_info[i];
pStructTmp->type = MSG_STRUCT_FILTER;
memcpy(pStructTmp->data, pSrc, sizeof(MSG_FILTER_S));
pSrc = pSrc + sizeof(MSG_FILTER_S);
}
- }
- else if ( count == 0 )
- {
+ } else if ( count == 0 ) {
pFilterList->nCount = count;
pFilterList->msg_struct_info = NULL;
}
-
}
msg_struct_t *report_status = (msg_struct_t *)new char[sizeof(msg_struct_t)*count];
for (int i = 0; i < count; i++) {
-
msg_struct_s *report_status_item = new msg_struct_s;
report_status_item->type = MSG_STRUCT_REPORT_STATUS_INFO;
report_status_item->data = new MSG_REPORT_STATUS_INFO_S;
memcpy(pThreadInfo, pSrc, sizeof(MSG_THREAD_VIEW_S));
}
-// Event Encoder
+/* Event Encoder */
int MsgMakeEvent(const void *pData, int DataSize, MSG_EVENT_TYPE_T MsgEvent, msg_error_t MsgError, void **ppEvent)
{
MSG_EVENT_S* pMsgEvent = NULL;
}
for (int i = 0; raw[i]; i++) {
-
if (raw[i] == '@') {
onlyNum = false;
{
int ret = 1;
- switch (src[ret++]-'0')
- {
+ switch (src[ret++]-'0') {
case 1:
case 7:
break;
case 2:
- switch (src[ret++]-'0')
- {
+ switch (src[ret++]-'0') {
case 0:
case 7:
break;
}
break;
case 3:
- switch (src[ret++]-'0')
- {
+ switch (src[ret++]-'0') {
case 0:
case 1:
case 2:
}
break;
case 4:
- switch (src[ret++]-'0')
- {
+ switch (src[ret++]-'0') {
case 0:
case 1:
case 3:
}
break;
case 5:
- switch (src[ret++]-'0')
- {
+ switch (src[ret++]-'0') {
case 1:
case 2:
case 3:
}
break;
case 6:
- switch (src[ret++]-'0')
- {
+ switch (src[ret++]-'0') {
case 0:
case 1:
case 2:
}
break;
case 8:
- switch (src[ret++]-'0')
- {
+ switch (src[ret++]-'0') {
case 1:
case 2:
case 4:
}
break;
case 9:
- switch (src[ret++]-'0')
- {
+ switch (src[ret++]-'0') {
case 0:
case 1:
case 2:
}
+char *getTranslateText(const char *pkg_name, const char *locale_dir, const char *text)
+{
+ char *notiMsg = NULL;
+ char *lang = NULL;
+
+ lang = vconf_get_str(VCONFKEY_LANGSET);
+
+ setlocale(LC_MESSAGES, lang);
+
+ bindtextdomain(pkg_name, locale_dir);
+
+ notiMsg = dgettext(pkg_name, text);
+
+ if (lang) {
+ free(lang);
+ lang = NULL;
+ }
+
+ return g_strdup(notiMsg);
+}
+
+
msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort)
{
char sql[128];
else
strncpy(order, "DESC", 5);
- //contacts-service is not used for gear
-#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
- int nameOrder = MsgGetContactNameOrder();
-#else
- int nameOrder = 0;
-#endif // MSG_CONTACTS_SERVICE_NOT_SUPPORTED
-
- switch (pSortRule->sortType)
- {
+ switch (pSortRule->sortType) {
case MSG_SORT_BY_DISPLAY_FROM :
- if (nameOrder == 0)
- snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order);
- else
- snprintf(sql, sizeof(sql), "ORDER BY B.LAST_NAME %s, B.FIRST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order);
+ snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order);
break;
case MSG_SORT_BY_DISPLAY_TO :
- if (nameOrder == 0)
- snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order);
- else
- snprintf(sql, sizeof(sql), "ORDER BY B.LAST_NAME %s, B.FIRST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order);
+ snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order);
break;
case MSG_SORT_BY_DISPLAY_TIME :
snprintf(sql, sizeof(sql), "ORDER BY DISPLAY_TIME %s;", order);
snprintf(sql, sizeof(sql), "ORDER BY A.STORAGE_ID %s, A.DISPLAY_TIME DESC;", order);
break;
case MSG_SORT_BY_THREAD_NAME :
- if (nameOrder == 0)
- snprintf(sql, sizeof(sql), "ORDER BY FIRST_NAME %s, LAST_NAME %s;", order, order);
- else
- snprintf(sql, sizeof(sql), "ORDER BY LAST_NAME %s, FIRST_NAME %s;", order, order);
+ snprintf(sql, sizeof(sql), "ORDER BY FIRST_NAME %s, LAST_NAME %s;", order, order);
break;
case MSG_SORT_BY_THREAD_DATE :
snprintf(sql, sizeof(sql), "ORDER BY MSG_TIME %s;", order);
return false;
return true;
}
+
+msg_error_t msg_write_text_to_msg_info(MSG_MESSAGE_INFO_S *pMsgInfo, char *text)
+{
+ if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN) {
+ pMsgInfo->bTextSms = false;
+
+ /* Save Message Data into File */
+ char fileName[MSG_FILENAME_LEN_MAX+1];
+ memset(fileName, 0x00, sizeof(fileName));
+
+ if(MsgCreateFileName(fileName) == false) {
+ MSG_DEBUG("MsgCreateFileName error");
+ return MSG_ERR_STORAGE_ERROR;
+ }
+
+ MSG_SEC_DEBUG("Save text into file : size[%d] name[%s]", pMsgInfo->dataSize, fileName);
+
+ if (MsgWriteIpcFile(fileName, text, pMsgInfo->dataSize) == false) {
+ MSG_DEBUG("MsgWriteIpcFile error");
+ return MSG_ERR_STORAGE_ERROR;
+ }
+
+ memset(pMsgInfo->msgData, 0x00, sizeof(pMsgInfo->msgData));
+ strncpy(pMsgInfo->msgData, fileName, MAX_MSG_DATA_LEN);
+ } else {
+ pMsgInfo->bTextSms = true;
+
+ memset(pMsgInfo->msgText, 0x00, sizeof(pMsgInfo->msgText));
+ memcpy(pMsgInfo->msgText, text, pMsgInfo->dataSize);
+ }
+
+ return MSG_SUCCESS;
+}
+
+/* change illegal filename character to '_' */
+void msg_replace_available_file_name(char *fileName)
+{
+ int idx = 0;
+ int len = 0;
+ bool is_converted = false;
+
+ if (fileName) {
+ len = strlen(fileName);
+
+ while (fileName[idx] != 0) {
+ if (idx >= len) {
+ MSG_WARN("idx : %d, len : %d", idx, len);
+ break;
+ }
+
+ if (fileName[idx] == '\\' || fileName[idx] == '/' || fileName[idx] == '?' || fileName[idx] == '%' || fileName[idx] == '*' ||
+ fileName[idx] == ':' || fileName[idx] == '|' || fileName[idx] == '"' || fileName[idx] == '<' || fileName[idx] == '>') {
+ fileName[idx++] = '_';
+ is_converted = true;
+ } else {
+ idx++;
+ }
+ }
+ }
+
+ if (is_converted)
+ MSG_SEC_DEBUG("converted filename : [%s]", fileName);
+}
+
+/* change character ' ' to '_' */
+void msg_replace_space_char(char *pszText)
+{
+ if (!pszText) {
+ MSG_ERR("pszText is NULL");
+ return;
+ }
+
+ char *spaceCharPtr = strchr(pszText, ' ');
+
+ while (spaceCharPtr) {
+ *spaceCharPtr = '_';
+ spaceCharPtr = strchr(pszText, ' ');
+ }
+}
+
+/* change non-ascii character to underscore */
+gchar * msg_replace_non_ascii_char(const gchar *pszText, gunichar replacementChar)
+{
+ if (!pszText) {
+ MSG_ERR(" msg_replace_non_ascii_char error : pszText is NULL");
+ return NULL;
+ }
+ gchar *res;
+ gsize result_len = 0;
+ const gchar *p;
+ result_len = g_utf8_strlen(pszText, -1) + 1; /* +1 for malloc of non-terminating chracter */
+ res = (gchar *)g_malloc (result_len * sizeof (gchar));
+ int i = 0;
+ for (p = pszText, i = 0; *p != '\0'; p = g_utf8_next_char(p), i++) {
+ res[i] = isascii(g_utf8_get_char(p)) ? *p : replacementChar;
+ }
+ res[i] = '\0';
+ return res;
+}
+
+
+static int __find_login_user(uid_t *uid)
+{
+ uid_t *uids = NULL;
+
+ int uids_len = sd_get_active_uids(&uids);
+ if (uids == NULL)
+ return -1;
+
+ if (uids_len != 1) {
+ free(uids);
+ return -1;
+ }
+
+ *uid = uids[0];
+
+ free(uids);
+ return 0;
+}
+
+
+uid_t msg_get_login_user()
+{
+ uid_t uid = -1;
+
+ if (__find_login_user(&uid) < 0) {
+ MSG_WARN("Cannot find login user");
+ }
+
+ MSG_DEBUG("login user id [%d]", uid);
+
+ return uid;
+}
+
+
+void* _msg_launch_app(void *data)
+{
+ pthread_mutex_lock(&mx);
+ if (data) {
+ msg_launch_app_data *ad = (msg_launch_app_data *)data;
+ int ret = aul_launch_app_for_uid(ad->app_id, ad->bundle_data, msg_get_login_user());
+ if (ret <= 0) {
+ MSG_ERR("aul_launch_app_for_uid() is failed : %d", ret);
+ }
+
+ g_free(ad->app_id);
+ bundle_free(ad->bundle_data);
+ g_free(ad);
+ }
+ pthread_mutex_unlock(&mx);
+
+ return NULL;
+}
+
+msg_error_t msg_launch_app(const char *app_id, bundle *bundle_data)
+{
+ msg_launch_app_data *data = (msg_launch_app_data *)calloc(1, sizeof(msg_launch_app_data));
+ if (data == NULL) {
+ MSG_ERR("Memory alloc failed!");
+ return MSG_ERR_MEMORY_ERROR;
+ }
+
+ data->app_id = g_strdup(app_id);
+ data->bundle_data = bundle_dup(bundle_data);
+ pthread_t thd;
+
+ if (pthread_create(&thd, NULL, &_msg_launch_app, data) < 0) {
+ MSG_ERR("pthread_create() error");
+ }
+
+ pthread_detach(thd);
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t msg_aul_svc_set_operation(bundle *bundle_data, const char *operation)
+{
+ int ret = aul_svc_set_operation(bundle_data, operation);
+ if (ret < 0) {
+ MSG_ERR("aul_svc_set_operation() is failed : %d", ret);
+ return MSG_ERR_UNKNOWN;
+ }
+
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t msg_aul_svc_set_uri(bundle *bundle_data, char *uri)
+{
+ int ret = aul_svc_set_uri(bundle_data, uri);
+ if (ret < 0) {
+ MSG_ERR("aul_svc_set_uri() is failed : %d", ret);
+ return MSG_ERR_UNKNOWN;
+ }
+
+ return MSG_SUCCESS;
+}
+
+
+void msg_set_dpm_policy(int type, int state)
+{
+ dpm_policy_enable[type] = state;
+}
+
+
+bool msg_check_dpm_policy(int type)
+{
+ return dpm_policy_enable[MSG_SMS_TYPE];
+// return dpm_policy_enable[type];
+}
+
+
+void msg_syspopup_message(bool is_sending)
+{
+ MSG_INFO("popup toast for dpm restriction. is_sending [%d]", is_sending);
+
+ GDBusConnection *connection = NULL;
+ GDBusProxy *dbus_proxy = NULL;
+ GVariant *result = NULL;
+ GError *error = NULL;
+
+ connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ MSG_ERR("Connecting to system bus failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+ dbus_proxy = g_dbus_proxy_new_sync(connection, G_DBUS_PROXY_FLAGS_NONE, NULL,
+ SYSPOPUP_BUS_NAME, SYSPOPUP_OBJECT_PATH, SYSPOPUP_INTERFACE, NULL, &error);
+ if (error) {
+ MSG_ERR("Connecting to proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+ result = g_dbus_proxy_call_sync(dbus_proxy, SYSPOPUP_METHOD_SHOW,
+ g_variant_new("(s)", is_sending ? "message-sending" : "message-retrieving"),
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+ if (error) {
+ MSG_ERR("invoking proxy call failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+_DBUS_ERROR:
+ if (error) {
+ g_error_free(error);
+ error = NULL;
+ }
+
+ if (connection) {
+ g_object_unref(connection);
+ connection = NULL;
+ }
+
+ if (dbus_proxy) {
+ g_object_unref(dbus_proxy);
+ dbus_proxy = NULL;
+ }
+
+ if (result) {
+ g_object_unref(result);
+ result = NULL;
+ }
+}