summaryrefslogtreecommitdiffstats
path: root/plugins/push-notification.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-11-01 10:04:39 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-11-02 12:15:53 -0500
commit853f449892419436cee697f0e647679f3c79ba80 (patch)
tree1fa5a12c1e45b1f0570938f6ddc22f7f478f9300 /plugins/push-notification.c
parentdf5339bf895f5f1f21520aab3f0496b21bb89864 (diff)
downloadofono-853f449892419436cee697f0e647679f3c79ba80.tar.bz2
push-notification: Implement unregister agent
Diffstat (limited to 'plugins/push-notification.c')
-rw-r--r--plugins/push-notification.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/plugins/push-notification.c b/plugins/push-notification.c
index e324c0cb..025bb752 100644
--- a/plugins/push-notification.c
+++ b/plugins/push-notification.c
@@ -88,7 +88,24 @@ static DBusMessage *push_notification_register_agent(DBusConnection *conn,
static DBusMessage *push_notification_unregister_agent(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- return __ofono_error_not_implemented(msg);
+ struct push_notification *pn = 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 (pn->agent == NULL)
+ return __ofono_error_failed(msg);
+
+ if (sms_agent_matches(pn->agent, agent_bus, agent_path) == FALSE)
+ return __ofono_error_failed(msg);
+
+ sms_agent_free(pn->agent);
+
+ return dbus_message_new_method_return(msg);
}
static GDBusMethodTable push_notification_methods[] = {