summaryrefslogtreecommitdiffstats
path: root/plugins/smart-messaging.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-11-02 14:34:18 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-11-02 14:58:21 -0500
commit49eee4006a7da28da10d112ee6e0ca961e87de5d (patch)
tree64757405f565f61809f9f11dccade67a73d4f795 /plugins/smart-messaging.c
parentd56e72ee1d3174dd95a10aaea04e8c9b67078565 (diff)
downloadofono-49eee4006a7da28da10d112ee6e0ca961e87de5d.tar.bz2
smart-messaging: Implement unregister agent
Diffstat (limited to 'plugins/smart-messaging.c')
-rw-r--r--plugins/smart-messaging.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/plugins/smart-messaging.c b/plugins/smart-messaging.c
index bf9034b9..535e2fd4 100644
--- a/plugins/smart-messaging.c
+++ b/plugins/smart-messaging.c
@@ -87,7 +87,24 @@ static DBusMessage *smart_messaging_register_agent(DBusConnection *conn,
static DBusMessage *smart_messaging_unregister_agent(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- return __ofono_error_not_implemented(msg);
+ struct smart_messaging *sm = data;
+ const char *agent_path;
+ const char *agent_bus = dbus_message_get_sender(msg);
+
+ if (dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_OBJECT_PATH, &agent_path,
+ DBUS_TYPE_INVALID) == FALSE)
+ return __ofono_error_invalid_args(msg);
+
+ if (sm->agent == NULL)
+ return __ofono_error_failed(msg);
+
+ if (sms_agent_matches(sm->agent, agent_bus, agent_path) == FALSE)
+ return __ofono_error_failed(msg);
+
+ sms_agent_free(sm->agent);
+
+ return dbus_message_new_method_return(msg);
}
static DBusMessage *smart_messaging_send_vcard(DBusConnection *conn,