)
INCLUDE(FindPkgConfig)
-pkg_check_modules(externals_pkgs REQUIRED glib-2.0 alarm-service notification badge iniparser capi-appfw-application lbs-dbus feedback capi-system-device motion capi-media-player capi-media-sound-manager)
+pkg_check_modules(externals_pkgs REQUIRED glib-2.0 alarm-service notification badge iniparser capi-appfw-package-manager capi-appfw-application lbs-dbus feedback capi-system-device motion capi-media-player capi-media-sound-manager)
FOREACH(flag ${externals_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
#include <notification_setting_internal.h>
#include <feedback.h>
#include <badge_internal.h>
+#include <package_manager.h>
#endif /* MSG_WEARABLE_PROFILE */
}
void createActiveInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info);
void clearInfoData(notification_h noti_h, MSG_NOTI_INFO_S *noti_info);
+msg_error_t getAppIcon(const char *app_id, char **icon_path);
msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessage);
void setProperty(notification_h noti_h, MSG_NOTI_INFO_S *noti_info);
setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NO_CONTACT_PROFILE_ICON_PATH);
}
- setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_SUB, MSG_MESSAGE_APP_SUB_ICON);
+ char *msg_icon_path = NULL;
+ if (getAppIcon(MSG_DEFAULT_APP_ID, &msg_icon_path) == MSG_SUCCESS) {
+ setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_SUB, msg_icon_path);
+ g_free(msg_icon_path);
+ } else {
+ MSG_ERR("fail to get message-app icon");
+ }
}
}
break;
else
setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NO_CONTACT_PROFILE_ICON_PATH);
- setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_SUB, MSG_MESSAGE_APP_SUB_ICON);
+ char *msg_icon_path = NULL;
+ if (getAppIcon(MSG_DEFAULT_APP_ID, &msg_icon_path) == MSG_SUCCESS) {
+ setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_SUB, msg_icon_path);
+ g_free(msg_icon_path);
+ } else {
+ MSG_ERR("fail to get message-app icon");
+ }
+
break;
}
}
+msg_error_t getAppIcon(const char *app_id, char **icon_path)
+{
+ MSG_BEGIN();
+
+ package_info_h pkg_info_h = NULL;
+ int pkg_err = PACKAGE_MANAGER_ERROR_NONE;
+ int ret = MSG_SUCCESS;
+
+ if (app_id == NULL) {
+ MSG_ERR("app id is NULL");
+ ret = MSG_ERR_UNKNOWN;
+ goto END_OF_GET_APP_ICON;
+ }
+
+ pkg_err = package_info_create(app_id, &pkg_info_h);
+ if (pkg_err != PACKAGE_MANAGER_ERROR_NONE) {
+ MSG_ERR("package_info_create failed (%d)", pkg_err);
+ ret = MSG_ERR_UNKNOWN;
+ goto END_OF_GET_APP_ICON;
+ }
+
+ pkg_err = package_info_get_icon(pkg_info_h, icon_path);
+ if (pkg_err != PACKAGE_MANAGER_ERROR_NONE) {
+ MSG_ERR("package_info_get_icon failed (%d)", pkg_err);
+ } else {
+ if (icon_path == NULL) {
+ MSG_WARN("icon path is NULL");
+ ret = MSG_ERR_UNKNOWN;
+ }
+ }
+
+END_OF_GET_APP_ICON:
+ if (pkg_info_h) {
+ pkg_err = package_info_destroy(pkg_info_h);
+ if (pkg_err != PACKAGE_MANAGER_ERROR_NONE) {
+ MSG_ERR("package_info_destroy failed (%d)", pkg_err);
+ }
+
+ pkg_info_h = NULL;
+ }
+
+ return ret;
+}
+
+
msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessage)
{
MSG_BEGIN();
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(fw_handler_pkgs REQUIRED glib-2.0 gio-2.0 dlog vconf capi-appfw-application)
+pkg_check_modules(fw_handler_pkgs REQUIRED glib-2.0 gio-2.0 dlog vconf capi-appfw-application aul)
FOREACH(flag ${fw_handler_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -std=c++0x")
#ifndef MSG_WEARABLE_PROFILE
#include <app_control.h>
+#include <aul.h>
#endif // MSG_WEARABLE_PROFILE
+#include <bundle.h>
+#include <eventsystem.h>
#include "MsgDebug.h"
#include "MsgUtilFile.h"
#include "MsgContact.h"
+#include "MsgUtilFunction.h"
#include "MsgUtilStorage.h"
#include "MsgGconfWrapper.h"
#include "MsgSoundPlayer.h"
// add phone log
MSG_DEBUG("Enter MsgAddPhoneLog() for mms message.");
MsgAddPhoneLog(pMsgInfo);
+ /* Send system event */
+ bundle *b = NULL;
+ b = bundle_create();
+ if (b) {
+ bundle_add_str(b, EVT_KEY_MSG_TYPE, EVT_VAL_MMS);
+ char msgId[MSG_EVENT_MSG_ID_LEN] = {0, };
+ snprintf(msgId, sizeof(msgId), "%u", pMsgInfo->msgId);
+ bundle_add_str(b, EVT_KEY_MSG_ID, msgId);
+ eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
+ bundle_add_str(b, "cmd", "incoming_msg");
+ int ret = aul_launch_app_for_uid("org.tizen.msg-manager", b, msg_get_login_user());
+ if (ret <= 0) {
+ MSG_DEBUG("aul_launch_app_for_uid() is failed : %d", ret);
+ }
+ bundle_free(b);
+ }
#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
if (pMsgInfo->folderId == MSG_INBOX_ID)
#include <time.h>
+#include <aul.h>
+#include <bundle.h>
+#include <eventsystem.h>
+
#include "MsgDebug.h"
#include "MsgException.h"
#include "MsgUtilFile.h"
/* normal process */
err = MsgHandleIncomingMsg(&msgInfo, &sendNoti);
+ if (msgInfo.msgType.mainType == MSG_SMS_TYPE) {
+ /* Send system event */
+ bundle *b = NULL;
+ b = bundle_create();
+ if (b) {
+ char msgId[MSG_EVENT_MSG_ID_LEN] = {0, };
+ snprintf(msgId, sizeof(msgId), "%u", msgInfo.msgId);
+ bundle_add_str(b, EVT_KEY_MSG_ID, msgId);
+
+ if (msgInfo.msgType.subType >= MSG_WAP_SI_SMS && msgInfo.msgType.subType <= MSG_WAP_CO_SMS) {
+ bundle_add_str(b, EVT_KEY_MSG_TYPE, EVT_VAL_PUSH);
+ } else {
+ bundle_add_str(b, EVT_KEY_MSG_TYPE, EVT_VAL_SMS);
+ bundle_add_str(b, "cmd", "incoming_msg");
+ int ret = aul_launch_app_for_uid("org.tizen.msg-manager", b, msg_get_login_user());
+ if (ret <= 0) {
+ MSG_DEBUG("aul_launch_app_for_uid() is failed : %d", ret);
+ }
+ }
+ eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
+ bundle_free(b);
+ }
+ }
+
if (isClass2msg == true) {
msgIdList.nCount = 2;
msgIds[0] = class2msgId;
#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
MSG_SEC_DEBUG("Enter MsgAddPhoneLog() : msgInfo.addressList[0].addressVal [%s]", msgInfo.addressList[0].addressVal);
MsgAddPhoneLog(&msgInfo);
+ /* Send system event */
+ bundle *b = NULL;
+ b = bundle_create();
+ if (b) {
+ bundle_add_str(b, EVT_KEY_MSG_TYPE, EVT_VAL_MMS);
+ char msgId[MSG_EVENT_MSG_ID_LEN] = {0, };
+ snprintf(msgId, sizeof(msgId), "%u", msgInfo.msgId);
+ bundle_add_str(b, EVT_KEY_MSG_ID, msgId);
+ eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
+ bundle_add_str(b, "cmd", "incoming_msg");
+ int ret = aul_launch_app_for_uid("org.tizen.msg-manager", b, msg_get_login_user());
+ if (ret <= 0) {
+ MSG_DEBUG("aul_launch_app_for_uid() is failed : %d", ret);
+ }
+ bundle_free(b);
+ }
#endif /*MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
}
#include <sys/stat.h>
#include <pthread.h>
-#include <bundle_internal.h>
+#include <bundle.h>
#include <eventsystem.h>
#include "MsgDebug.h"
#include "MsgTransManager.h"
#define MSG_CHECK_PRIVILEGE
-#define MSG_EVENT_MSG_ID_LEN (32)
void MsgMakeErrorEvent(MSG_CMD_TYPE_T cmdType, msg_error_t errType, int *pEventSize, char **ppEvent)
{
}
}
- /* Send system event */
- bundle *b = NULL;
- b = bundle_create();
- if (b) {
- if (msgInfo->msgType.subType >= MSG_WAP_SI_SMS && msgInfo->msgType.subType <= MSG_WAP_CO_SMS) {
- bundle_add(b, EVT_KEY_MSG_TYPE, EVT_VAL_PUSH);
- } else {
- bundle_add(b, EVT_KEY_MSG_TYPE, EVT_VAL_SMS);
- }
- char msgId[MSG_EVENT_MSG_ID_LEN] = {0, };
- snprintf(msgId, sizeof(msgId), "%u", msgInfo->msgId);
- bundle_add(b, EVT_KEY_MSG_ID, msgId);
- eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
- bundle_free(b);
- }
-
MSG_END();
}
bundle *b = NULL;
b = bundle_create();
if (b) {
- bundle_add(b, EVT_KEY_MSG_TYPE, EVT_VAL_CB);
+ bundle_add_str(b, EVT_KEY_MSG_TYPE, EVT_VAL_CB);
char msgId[MSG_EVENT_MSG_ID_LEN] = {0, };
snprintf(msgId, sizeof(msgId), "%u", cbMsgId);
- bundle_add(b, EVT_KEY_MSG_ID, msgId);
+ bundle_add_str(b, EVT_KEY_MSG_ID, msgId);
eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
bundle_free(b);
}
#define MAX_VCONFKEY_NAME_LEN 128
#define MAX_SIM_IMSI_LEN 16
#define MAX_TAPI_SIM_API_TIMEOUT 70
+#define MSG_EVENT_MSG_ID_LEN (32)
#define SMS_MINIMUM_SPACE (1 * 1024 * 1024)
#define MMS_MINIMUM_SPACE (1 * 1024 * 1024)
#define MSG_TELEPHONY_SMS_FEATURE "http://tizen.org/feature/network.telephony.sms"
#define MSG_TELEPHONY_MMS_FEATURE "http://tizen.org/feature/network.telephony.mms"
+/*below defines will be removed */
+#define SYS_EVENT_OUTGOING_MSG "tizen.system.event.outgoing_msg"
+#define EVT_VAL_MMS "mms"
+#define EVT_KEY_OUT_MSG_ID "msg_id"
+#define EVT_KEY_OUT_MSG_TYPE "msg_type"
+
/*==================================================================================================
TYPES
==================================================================================================*/
#define MSG_EMERGENCY_ICON_PATH TZ_SYS_RO_APP_PATH MSG_DEFAULT_APP_ID "/res/icons/default/small/noti_emergency_mode.png"
#define MSG_NO_CONTACT_PROFILE_ICON_PATH TZ_SYS_RO_APP_PATH MSG_NOTIFICATION_ICON_DIR "/Contact/noti_contact_default.png"
#define MSG_ACTIVE_PUSH_ICON_PATH "reserved:push_message"
-#define MSG_MESSAGE_APP_SUB_ICON TZ_SYS_RO_APP_PATH MSG_DEFAULT_APP_ID "/res/icons/default/small/org.tizen.message.png"
/* status bar icon */
#define MSG_NORMAL_STATUS_ICON TZ_SYS_RO_APP_PATH MSG_STATUS_ICON_DIR "/Notify/B03_notify_message.png"
gchar * msg_replace_non_ascii_char(const gchar *pszText, gunichar replacementChar);
+uid_t msg_get_login_user();
+
/* Dbus function */
void MsgDbusInit();
void MsgDbusDeinit();
contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_INCOMING);
else
contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_MMS_INCOMING);
- } else if (contact_info->folderId == MSG_OUTBOX_ID) {
+ } else if (contact_info->folderId == MSG_OUTBOX_ID || contact_info->folderId == MSG_SENTBOX_ID) {
if (contact_info->msgType != MSG_TYPE_MMS && contact_info->msgType != MSG_TYPE_MMS_NOTI && contact_info->msgType != MSG_TYPE_MMS_JAVA)
contacts_record_set_int(plog, _contacts_phone_log.log_type, CONTACTS_PLOG_TYPE_SMS_OUTGOING);
else
#include "msg-manager-contact.h"
#include "msg-manager-debug.h"
+/* below defines will be removed */
+#define EVENT_KEY_OUT_MSG_TYPE "msg_type"
+#define EVENT_KEY_OUT_MSG_ID "msg_id"
+
bool service_app_create(void *data)
{
- MSG_MGR_DEBUG("app_create");
+ MSG_MGR_INFO("app_create");
return true;
}
void service_app_terminate(void *data)
{
- // Todo: add your code here.
+ MSG_MGR_INFO("app_terminate");
+
+ MsgMgrCloseContactSvc();
+
return;
}
char *rcv_msg_type = NULL;
char *rcv_msg_id = NULL;
- ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_TYPE, &rcv_msg_type);
- if (ret != APP_CONTROL_ERROR_NONE || rcv_msg_type == NULL)
- return;
-
- MSG_MGR_INFO("rcv_msg_type(%s)", rcv_msg_type);
- if (g_strcmp0(rcv_msg_type, EVENT_VAL_SMS) != 0)
+ ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_ID, &rcv_msg_id);
+ if (ret != APP_CONTROL_ERROR_NONE || rcv_msg_id == NULL) {
+ MSG_MGR_ERR("app_control_get_extra_data failed");
return;
+ }
- ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_ID, &rcv_msg_id);
- if (ret != APP_CONTROL_ERROR_NONE || rcv_msg_id == NULL)
+ ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_TYPE, &rcv_msg_type);
+ if (ret != APP_CONTROL_ERROR_NONE || rcv_msg_type == NULL) {
+ MSG_MGR_ERR("app_control_get_extra_data failed");
+ g_free(rcv_msg_id);
return;
+ }
- MSG_MGR_INFO("rcv_msg_id(%s)", rcv_msg_id);
+ MSG_MGR_INFO("rcv_msg_type(%s), rcv_msg_id(%s)", rcv_msg_type, rcv_msg_id);
int msg_err = MSG_SUCCESS;
msg_message_id_t msg_id = atoi(rcv_msg_id);
msg_release_struct(&msg);
msg_release_struct(&opt);
-#if 0
- char **db_res = NULL;
- int row_cnt = 0, col_cnt = 0;
- msg_err = msg_db_select_with_query(msg_handle, "MSG_ID FROM MSG_MESSAGE_TABLE;", &db_res, &row_cnt, &col_cnt);
- if (msg_err != MSG_SUCCESS) {
- MSG_MGR_ERR("msg_db_select_with_query() failed [%d]", msg_err);
- return;
- }
-
- MSG_MGR_DEBUG("row count [%d] col count [%d]", row_cnt, col_cnt);
- if (db_res == NULL || *db_res == NULL) {
- MSG_MGR_DEBUG("NULL");
- } else {
- for (int i = col_cnt; i < col_cnt * (row_cnt + 1); i++) {
- MSG_MGR_DEBUG("db_res[%d] [%s]", i, db_res[i]);
- }
- }
-
- msg_err = msg_db_free(msg_handle, db_res);
- if (msg_err != MSG_SUCCESS) {
- MSG_MGR_ERR("msg_db_free() failed [%d]", msg_err);
- return;
- }
-#endif
-
msg_close_msg_handle(&msg_handle);
- g_free(rcv_msg_type);
g_free(rcv_msg_id);
+ g_free(rcv_msg_type);
MSG_MGR_END();
}
MSG_MGR_BEGIN();
int ret = 0;
+ char *sent_msg_type = NULL;
char *sent_msg_id = NULL;
- ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_ID, &sent_msg_id);
- if (ret != APP_CONTROL_ERROR_NONE || sent_msg_id == NULL)
+ ret = app_control_get_extra_data(app_control, EVENT_KEY_OUT_MSG_ID, &sent_msg_id);
+ if (ret != APP_CONTROL_ERROR_NONE || sent_msg_id == NULL) {
+ MSG_MGR_ERR("app_control_get_extra_data failed");
return;
+ }
- MSG_MGR_INFO("sent_msg_id(%s)", sent_msg_id);
+ ret = app_control_get_extra_data(app_control, EVENT_KEY_OUT_MSG_TYPE, &sent_msg_type);
+ if (ret != APP_CONTROL_ERROR_NONE || sent_msg_type == NULL) {
+ MSG_MGR_ERR("app_control_get_extra_data failed");
+ g_free(sent_msg_id);
+ return;
+ }
+
+ MSG_MGR_INFO("sent_msg_type(%s) sent_msg_id(%s)", sent_msg_type, sent_msg_id);
int msg_err = MSG_SUCCESS;
msg_message_id_t msg_id = atoi(sent_msg_id);
msg_close_msg_handle(&msg_handle);
g_free(sent_msg_id);
+ g_free(sent_msg_type);
MSG_MGR_END();
}
{
MSG_MGR_INFO("service_app_control called");
- //check "launch on event"
int ret = 0;
- const char *incoming_event_uri = "event://tizen.system.event.incoming_msg";
- const char *outgoing_event_uri = "event://tizen.system.event.outgoing_msg";
char *operation = NULL;
- char *uri = NULL;
+ char *cmd = NULL;
ret = app_control_get_operation(app_control, &operation);
if (ret == APP_CONTROL_ERROR_NONE && operation) {
- if (g_strcmp0(operation, APP_CONTROL_OPERATION_LAUNCH_ON_EVENT) == 0) {
- /* launch by system event */
- ret = app_control_get_uri(app_control, &uri);
- if (ret == APP_CONTROL_ERROR_NONE && uri) {
- if (g_strcmp0(uri, incoming_event_uri) == 0) {
- _incoming_msg_func(app_control);
- } else if (g_strcmp0(uri, outgoing_event_uri) == 0) {
- _outgoing_msg_func(app_control);
- }
- g_free(uri);
- }
- } else if (g_strcmp0(operation, APP_CONTROL_OPERATION_DEFAULT) == 0) {
- /* launch by default */
- char *cmd;
+ MSG_MGR_DEBUG("operation [%s]", operation);
+
+ if (g_strcmp0(operation, APP_CONTROL_OPERATION_DEFAULT) == 0) {
ret = app_control_get_extra_data(app_control, "cmd", &cmd);
if (ret == APP_CONTROL_ERROR_NONE && cmd) {
- if (g_strcmp0(cmd, "refresh") == 0)
+ MSG_MGR_DEBUG("cmd [%s]", cmd);
+
+ if (g_strcmp0(cmd, "incoming_msg") == 0) {
+ _incoming_msg_func(app_control);
+ } else if (g_strcmp0(cmd, "outgoing_msg") == 0) {
+ _outgoing_msg_func(app_control);
+ } else if (g_strcmp0(cmd, "refresh") == 0) {
_refresh_noti_func(app_control);
+ }
g_free(cmd);
}
}
-
g_free(operation);
}
return;
}
-static void
-service_app_lang_changed(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LANGUAGE_CHANGED*/
-}
-
-static void
-service_app_region_changed(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_REGION_FORMAT_CHANGED*/
-}
-
-static void
-service_app_low_battery(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LOW_BATTERY*/
-}
-
-static void
-service_app_low_memory(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LOW_MEMORY*/
-}
-
int main(int argc, char* argv[])
{
- char ad[50] = {0,};
- service_app_lifecycle_callback_s event_callback;
- app_event_handler_h handlers[5] = {NULL, };
+ service_app_lifecycle_callback_s event_callback = {0,};
event_callback.create = service_app_create;
event_callback.terminate = service_app_terminate;
event_callback.app_control = service_app_control;
- service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad);
- service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad);
- service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad);
- service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad);
-
- return service_app_main(argc, argv, &event_callback, ad);
+ return service_app_main(argc, argv, &event_callback, NULL);
}
<service-application appid="org.tizen.msg-manager" auto-restart="false" exec="msg-manager" multiple="false" nodisplay="true" on-boot="false" taskmanage="false" type="capp">
<label>msg-manager</label>
<icon>msg-manager.png</icon>
- <app-control>
- <operation name="http://tizen.org/appcontrol/operation/launch_on_event"/>
- <uri name="event://tizen.system.event.incoming_msg"/>
- </app-control>
</service-application>
<privileges>
<privilege>http://tizen.org/privilege/message.read</privilege>
BuildRequires: pkgconfig(badge)
BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-appfw-package-manager)
BuildRequires: pkgconfig(capi-content-media-content)
BuildRequires: pkgconfig(capi-media-image-util)
BuildRequires: pkgconfig(capi-media-metadata-extractor)
BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(lbs-dbus)
BuildRequires: pkgconfig(libcurl)
+BuildRequires: pkgconfig(libsystemd-login)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(libwbxml2)
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(sms_plugin_pkgs REQUIRED glib-2.0 tapi libxml-2.0 libwbxml2 dlog vconf gio-2.0)
+pkg_check_modules(sms_plugin_pkgs REQUIRED glib-2.0 tapi libxml-2.0 libwbxml2 dlog vconf gio-2.0 bundle eventsystem aul)
FOREACH(flag ${sms_plugin_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
#include <errno.h>
#include <time.h>
+#include <aul.h>
+#include <bundle.h>
+#include <eventsystem.h>
+
#include "MsgDebug.h"
#include "MsgUtilFile.h"
#include "MsgUtilFunction.h"
MSG_DEBUG("Add phone log");
MsgAddPhoneLog(&(sentInfo.reqInfo.msgInfo));
sentInfo.reqInfo.msgInfo.folderId = MSG_SENTBOX_ID;
+ /* Send system event */
+ bundle *b = NULL;
+ b = bundle_create();
+ if (b) {
+ if (sentInfo.reqInfo.msgInfo.msgType.mainType == MSG_SMS_TYPE)
+ bundle_add_str(b, EVT_KEY_OUT_MSG_TYPE, EVT_VAL_SMS);
+ else
+ bundle_add_str(b, EVT_KEY_OUT_MSG_TYPE, EVT_VAL_MMS);
+
+ char msgId[MSG_EVENT_MSG_ID_LEN] = {0, };
+ snprintf(msgId, sizeof(msgId), "%u", sentInfo.reqInfo.msgInfo.msgId);
+ bundle_add_str(b, EVT_KEY_OUT_MSG_ID, msgId);
+ eventsystem_send_system_event(SYS_EVENT_OUTGOING_MSG, b);
+ bundle_add_str(b, "cmd", "outgoing_msg");
+ int ret = aul_launch_app_for_uid("org.tizen.msg-manager", b, msg_get_login_user());
+ if (ret <= 0) {
+ MSG_DEBUG("aul_launch_app_for_uid() is failed : %d", ret);
+ }
+ bundle_free(b);
+ }
} else {
sentInfo.reqInfo.msgInfo.bRead = false;
}
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(sms_plugin_pkgs REQUIRED glib-2.0 tapi libxml-2.0 libwbxml2 dlog vconf gio-2.0 capi-telephony)
+pkg_check_modules(sms_plugin_pkgs REQUIRED glib-2.0 tapi libxml-2.0 libwbxml2 dlog vconf gio-2.0 capi-telephony bundle eventsystem aul)
FOREACH(flag ${sms_plugin_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
#include <stdlib.h>
#include <errno.h>
+#include <aul.h>
+#include <bundle.h>
+#include <eventsystem.h>
+
#include "MsgDebug.h"
#include "MsgUtilFile.h"
#include "MsgUtilFunction.h"
MsgAddPhoneLog(&(sentInfo.reqInfo.msgInfo));
#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
sentInfo.reqInfo.msgInfo.folderId = MSG_SENTBOX_ID; /* It should be set after adding phone log. */
+ /* Send system event */
+ bundle *b = NULL;
+ b = bundle_create();
+ if (b) {
+ if (sentInfo.reqInfo.msgInfo.msgType.mainType == MSG_SMS_TYPE)
+ bundle_add_str(b, EVT_KEY_OUT_MSG_TYPE, EVT_VAL_SMS);
+ else
+ bundle_add_str(b, EVT_KEY_OUT_MSG_TYPE, EVT_VAL_MMS);
+
+ char msgId[MSG_EVENT_MSG_ID_LEN] = {0, };
+ snprintf(msgId, sizeof(msgId), "%u", sentInfo.reqInfo.msgInfo.msgId);
+ bundle_add_str(b, EVT_KEY_OUT_MSG_ID, msgId);
+ eventsystem_send_system_event(SYS_EVENT_OUTGOING_MSG, b);
+ bundle_add_str(b, "cmd", "outgoing_msg");
+ int ret = aul_launch_app_for_uid("org.tizen.msg-manager", b, msg_get_login_user());
+ if (ret <= 0) {
+ MSG_DEBUG("aul_launch_app_for_uid() is failed : %d", ret);
+ }
+ bundle_free(b);
+ }
} else {
sentInfo.reqInfo.msgInfo.bRead = false;
}
INCLUDE(FindPkgConfig)
IF(_MSG_WEARABLE_PROFILE)
-SET(PKG_MODULES glib-2.0 vconf dlog libxml-2.0 storage json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util capi-content-media-content aul sqlite3 capi-media-metadata-extractor icu-uc)
+SET(PKG_MODULES glib-2.0 vconf dlog libxml-2.0 storage json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util capi-content-media-content aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login)
ELSE()
-SET(PKG_MODULES glib-2.0 vconf contacts-service2 dlog libxml-2.0 storage json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util capi-content-media-content aul sqlite3 capi-media-metadata-extractor icu-uc)
+SET(PKG_MODULES glib-2.0 vconf contacts-service2 dlog libxml-2.0 storage json-glib-1.0 capi-system-info capi-media-thumbnail-util capi-media-image-util capi-content-media-content aul sqlite3 capi-media-metadata-extractor icu-uc libsystemd-login)
ENDIF()
pkg_check_modules(utils_pkgs REQUIRED ${PKG_MODULES})
*/
#include <gio/gio.h>
+#include <systemd/sd-login.h>
#include "MsgDebug.h"
#include "MsgContact.h"
return res;
}
+
+static int __find_login_user(uid_t *uid)
+{
+ uid_t *uids = NULL;
+ char *state = NULL;
+
+ int uids_len = sd_get_uids(&uids);
+ if (uids_len <= 0)
+ return -1;
+
+ for (int i = 0; i < uids_len; i++) {
+ if (sd_uid_get_state(uids[i], &state) < 0) {
+ free(uids);
+ return -1;
+ } else {
+ if (g_strcmp0(state, "online") == 0) {
+ *uid = uids[i];
+ free(uids);
+ free(state);
+ return 0;
+ }
+ }
+
+ free(state);
+ }
+
+ free(uids);
+ return -1;
+}
+
+
+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 MsgDbusInit()
{
MSG_DEBUG();