diff options
author | Kegan Dougal <kegan@matrix.org> | 2015-01-27 15:50:28 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2015-01-27 15:50:28 +0000 |
commit | 51449e06654c4af7a645124dc64e1f0cc1678b24 (patch) | |
tree | 3141bc69fba6f1e6088f9f5b496845e2aa6c9637 /synapse/rest | |
parent | Parse /register and /unregister request JSON. (diff) | |
download | synapse-51449e06654c4af7a645124dc64e1f0cc1678b24.tar.xz |
Add appservice handler and store. Glue together rest > handler > store.
Diffstat (limited to 'synapse/rest')
-rw-r--r-- | synapse/rest/appservice/v1/base.py | 3 | ||||
-rw-r--r-- | synapse/rest/appservice/v1/register.py | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/synapse/rest/appservice/v1/base.py b/synapse/rest/appservice/v1/base.py index 46c9a444c0..65d5bcf9be 100644 --- a/synapse/rest/appservice/v1/base.py +++ b/synapse/rest/appservice/v1/base.py @@ -44,4 +44,5 @@ class AppServiceRestServlet(RestServlet): """ def __init__(self, hs): - self.hs = hs \ No newline at end of file + self.hs = hs + self.handler = hs.get_handlers().appservice_handler diff --git a/synapse/rest/appservice/v1/register.py b/synapse/rest/appservice/v1/register.py index 779447ac6a..142f09a638 100644 --- a/synapse/rest/appservice/v1/register.py +++ b/synapse/rest/appservice/v1/register.py @@ -14,6 +14,7 @@ # limitations under the License. """This module contains REST servlets to do with registration: /register""" +from twisted.internet import defer from base import AppServiceRestServlet, as_path_pattern from synapse.api.errors import CodeMessageException, SynapseError @@ -30,6 +31,7 @@ class RegisterRestServlet(AppServiceRestServlet): PATTERN = as_path_pattern("/register$") + @defer.inlineCallbacks def on_POST(self, request): params = _parse_json(request) @@ -56,9 +58,11 @@ class RegisterRestServlet(AppServiceRestServlet): self._parse_namespace(namespaces, params["namespaces"], "rooms") self._parse_namespace(namespaces, params["namespaces"], "aliases") - # TODO: pass to the appservice handler + hs_token = yield self.handler.register(as_url, as_token, namespaces) - raise CodeMessageException(500, "Not implemented.") + defer.returnValue({ + "hs_token": hs_token + }) def _parse_namespace(self, target_ns, origin_ns, ns): if ns not in target_ns or ns not in origin_ns: |