diff options
author | Paul Evans <leonerd@leonerd.org.uk> | 2016-08-18 20:52:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-18 20:52:50 +0100 |
commit | 5674ea3e6c51b26c828fc8a78bc82832d72c50d4 (patch) | |
tree | 26f0e424dbe3ec3a1ecb5074ed32b8e55c9abbaa /synapse/handlers | |
parent | Merge pull request #1027 from matrix-org/erikj/appservice_stream (diff) | |
parent | Move validation logic for AS 3PE query response into ApplicationServiceApi cl... (diff) | |
download | synapse-5674ea3e6c51b26c828fc8a78bc82832d72c50d4.tar.xz |
Merge pull request #1026 from matrix-org/paul/thirdpartylookup
3rd party entity lookup
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/appservice.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py index 6556dd1ae8..dd285452cd 100644 --- a/synapse/handlers/appservice.py +++ b/synapse/handlers/appservice.py @@ -160,6 +160,22 @@ class ApplicationServicesHandler(object): defer.returnValue(result) @defer.inlineCallbacks + def query_3pe(self, kind, protocol, fields): + services = yield self._get_services_for_3pn(protocol) + + results = yield defer.DeferredList([ + self.appservice_api.query_3pe(service, kind, protocol, fields) + for service in services + ], consumeErrors=True) + + ret = [] + for (success, result) in results: + if success: + ret.extend(result) + + defer.returnValue(ret) + + @defer.inlineCallbacks def _get_services_for_event(self, event): """Retrieve a list of application services interested in this event. @@ -188,6 +204,14 @@ class ApplicationServicesHandler(object): defer.returnValue(interested_list) @defer.inlineCallbacks + def _get_services_for_3pn(self, protocol): + services = yield self.store.get_app_services() + interested_list = [ + s for s in services if s.is_interested_in_protocol(protocol) + ] + defer.returnValue(interested_list) + + @defer.inlineCallbacks def _is_unknown_user(self, user_id): 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 |