summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-01-29 17:04:31 +0000
committerDavid Baker <dave@matrix.org>2015-01-29 17:05:00 +0000
commite0d2c6889bf31cf5f48e77334fed23352d19a75d (patch)
tree93214b01d1d3af0691849e77f9a47d25a19be3af /synapse
parentCode style fixes. (diff)
downloadsynapse-e0d2c6889bf31cf5f48e77334fed23352d19a75d.tar.xz
Allow kind to be set to null to delete a pusher.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/client/v1/pusher.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/pusher.py b/synapse/rest/client/v1/pusher.py
index 72d5e9e476..353a4a6589 100644
--- a/synapse/rest/client/v1/pusher.py
+++ b/synapse/rest/client/v1/pusher.py
@@ -31,6 +31,16 @@ class PusherRestServlet(ClientV1RestServlet):
 
         content = _parse_json(request)
 
+        pusher_pool = self.hs.get_pusherpool()
+
+        if ('pushkey' in content and 'app_id' in content
+                    and 'kind' in content and
+                    content['kind'] is None):
+            yield pusher_pool.remove_pusher(
+                content['app_id'], content['pushkey']
+            )
+            defer.returnValue((200, {}))
+
         reqd = ['instance_handle', 'kind', 'app_id', 'app_display_name',
                 'device_display_name', 'pushkey', 'lang', 'data']
         missing = []
@@ -41,7 +51,6 @@ class PusherRestServlet(ClientV1RestServlet):
             raise SynapseError(400, "Missing parameters: "+','.join(missing),
                                errcode=Codes.MISSING_PARAM)
 
-        pusher_pool = self.hs.get_pusherpool()
         try:
             yield pusher_pool.add_pusher(
                 user_name=user.to_string(),