summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2016-08-20 00:16:18 +0100
committerMatthew Hodgson <matthew@matrix.org>2016-08-20 00:16:18 +0100
commit6e80c03d45c3d09a7e7457f58beff69f14034964 (patch)
tree06d05072f93e410dbccba1437d7fd5a545c10b86 /synapse/handlers
parentExplicit join (diff)
parentMerge pull request #1032 from matrix-org/matthew/workerdoc (diff)
downloadsynapse-6e80c03d45c3d09a7e7457f58beff69f14034964.tar.xz
Merge branch 'develop' into dbkr/notifications_api
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/appservice.py24
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