summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2014-12-18 14:49:22 +0000
committerDavid Baker <dave@matrix.org>2014-12-18 14:49:22 +0000
commit9728c305a34a1f9546d2ce0ef4c54352dc55a16d (patch)
treec5d384c9ec68bfd14939095488d6eca7fde539a3 /synapse/rest
parentUpdate to app_id / app_instance_id (partially) and mangle to be PEP8 compliant. (diff)
downloadsynapse-9728c305a34a1f9546d2ce0ef4c54352dc55a16d.tar.xz
after a few rethinks, a working implementation of pushers.
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/pusher.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/synapse/rest/pusher.py b/synapse/rest/pusher.py
index a39341cd8b..5b371318d0 100644
--- a/synapse/rest/pusher.py
+++ b/synapse/rest/pusher.py
@@ -23,16 +23,16 @@ import json
 
 
 class PusherRestServlet(RestServlet):
-    PATTERN = client_path_pattern("/pushers/(?P<pushkey>[\w]*)$")
+    PATTERN = client_path_pattern("/pushers/set$")
 
     @defer.inlineCallbacks
-    def on_PUT(self, request, pushkey):
+    def on_POST(self, request):
         user = yield self.auth.get_user_by_req(request)
 
         content = _parse_json(request)
 
-        reqd = ['kind', 'app_id', 'app_instance_id', 'app_display_name',
-                'device_display_name', 'data']
+        reqd = ['kind', 'app_id', 'app_display_name',
+                'device_display_name', 'pushkey', 'data']
         missing = []
         for i in reqd:
             if i not in content:
@@ -43,14 +43,13 @@ class PusherRestServlet(RestServlet):
 
         pusher_pool = self.hs.get_pusherpool()
         try:
-            pusher_pool.add_pusher(
+            yield pusher_pool.add_pusher(
                 user_name=user.to_string(),
                 kind=content['kind'],
                 app_id=content['app_id'],
-                app_instance_id=content['app_instance_id'],
                 app_display_name=content['app_display_name'],
                 device_display_name=content['device_display_name'],
-                pushkey=pushkey,
+                pushkey=content['pushkey'],
                 data=content['data']
             )
         except PusherConfigException as pce: