diff options
author | Mark Haines <mark.haines@matrix.org> | 2016-05-31 13:53:48 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2016-05-31 13:53:48 +0100 |
commit | c626fc576a87f401c594cbb070d5b0000e45b4e1 (patch) | |
tree | e72ab5618420cd31c55493ed56f3e781c6eb1078 /synapse/handlers/appservice.py | |
parent | Merge pull request #802 from matrix-org/dbkr/split_room_list_handler (diff) | |
download | synapse-c626fc576a87f401c594cbb070d5b0000e45b4e1.tar.xz |
Move the AS handler out of the Handlers object.
Access it directly from the homeserver itself. It already wasn't inheriting from BaseHandler storing it on the Handlers object was already somewhat dubious.
Diffstat (limited to 'synapse/handlers/appservice.py')
-rw-r--r-- | synapse/handlers/appservice.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py index 75fc74c797..051ccdb380 100644 --- a/synapse/handlers/appservice.py +++ b/synapse/handlers/appservice.py @@ -17,7 +17,6 @@ from twisted.internet import defer from synapse.api.constants import EventTypes from synapse.appservice import ApplicationService -from synapse.types import UserID import logging @@ -35,16 +34,13 @@ def log_failure(failure): ) -# NB: Purposefully not inheriting BaseHandler since that contains way too much -# setup code which this handler does not need or use. This makes testing a lot -# easier. class ApplicationServicesHandler(object): - def __init__(self, hs, appservice_api, appservice_scheduler): + def __init__(self, hs): self.store = hs.get_datastore() - self.hs = hs - self.appservice_api = appservice_api - self.scheduler = appservice_scheduler + self.is_mine_id = hs.is_mine_id + self.appservice_api = hs.get_application_service_api() + self.scheduler = hs.get_application_service_scheduler() self.started_scheduler = False @defer.inlineCallbacks @@ -169,8 +165,7 @@ class ApplicationServicesHandler(object): @defer.inlineCallbacks def _is_unknown_user(self, user_id): - user = UserID.from_string(user_id) - if not self.hs.is_mine(user): + if not self.is_mine_id(user_id): # we don't know if they are unknown or not since it isn't one of our # users. We can't poke ASes. defer.returnValue(False) |