Commit 599d6f10 authored by Slava Monich's avatar Slava Monich

[mms-engine] Added org.nemomobile.MmsEngine.exit D-Bus method. JB#50406

Allows sufficiently privileged client to stop the service in case if
mms-engine needs to be restarted under a different user account.
parent e1c516cf
......@@ -57,6 +57,7 @@ typedef struct mms_app_dbus_policy {
#define MMS_ENGINE_DBUS_METHOD_SET_LOG_TYPE "setLogType"
#define MMS_ENGINE_DBUS_METHOD_GET_VERSION "getVersion"
#define MMS_ENGINE_DBUS_METHOD_MIGRATE_SETTINGS "migrateSettings"
#define MMS_ENGINE_DBUS_METHOD_EXIT "exit"
static const DA_ACTION mms_engine_dbus_actions[] = {
#define INIT_DA_ACTION(id) \
......@@ -74,7 +75,8 @@ static const MMSAppDBusPolicy mms_engine_default_dbus_policy = {
MMS_ENGINE_DBUS_METHOD_SEND_MESSAGE"()|"
MMS_ENGINE_DBUS_METHOD_SET_LOG_LEVEL"()|"
MMS_ENGINE_DBUS_METHOD_SET_LOG_TYPE"()|"
MMS_ENGINE_DBUS_METHOD_MIGRATE_SETTINGS"()))|"
MMS_ENGINE_DBUS_METHOD_MIGRATE_SETTINGS"()|"
MMS_ENGINE_DBUS_METHOD_EXIT"()))|"
"((!(user("RADIO_USER")&group("RADIO_GROUP")))&("
MMS_ENGINE_DBUS_METHOD_PUSH"()|"
MMS_ENGINE_DBUS_METHOD_PUSH_NOTIFY "()))=deny",
......
......@@ -547,6 +547,23 @@ mms_engine_handle_migrate_settings(
return TRUE;
}
/* org.nemomobile.MmsEngine.exit */
static
gboolean
mms_engine_handle_exit(
OrgNemomobileMmsEngine* proxy,
GDBusMethodInvocation* call,
MMSEngine* engine)
{
/* mms_engine_dbus_access_allowed completes the call if access is denied */
if (mms_engine_dbus_access_allowed(engine, call, MMS_ENGINE_ACTION_EXIT)) {
GDEBUG("Exit requested over D-Bus");
mms_engine_stop(engine);
org_nemomobile_mms_engine_complete_exit(proxy, call);
}
return TRUE;
}
MMSEngine*
mms_engine_new(
const MMSConfig* config,
......@@ -636,6 +653,9 @@ mms_engine_new(
mms->proxy_signal_id[MMS_ENGINE_METHOD_MIGRATE_SETTINGS] =
g_signal_connect(mms->proxy, "handle-migrate-settings",
G_CALLBACK(mms_engine_handle_migrate_settings), mms);
mms->proxy_signal_id[MMS_ENGINE_METHOD_EXIT] =
g_signal_connect(mms->proxy, "handle-exit",
G_CALLBACK(mms_engine_handle_exit), mms);
return mms;
}
......
......@@ -49,7 +49,8 @@
m(SET_LOG_LEVEL) \
m(SET_LOG_TYPE) \
m(GET_VERSION) \
m(MIGRATE_SETTINGS)
m(MIGRATE_SETTINGS) \
m(EXIT)
typedef enum mms_engine_action {
/* Action ids must be non-zero, shift those by one */
......
......@@ -211,5 +211,8 @@
<arg type="s" name="imsi" direction="in"/>
</method>
<!-- Since 1.0.70 -->
<method name="exit"/>
</interface>
</node>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment