summary refs log tree commit diff
path: root/synapse/handlers/appservice.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/handlers/appservice.py')
-rw-r--r--synapse/handlers/appservice.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py
index 84341b0d20..52e897d8d9 100644
--- a/synapse/handlers/appservice.py
+++ b/synapse/handlers/appservice.py
@@ -147,6 +147,21 @@ class ApplicationServicesHandler(object):
                 defer.returnValue(result)
 
     @defer.inlineCallbacks
+    def query_3pu(self, protocol, fields):
+        services = yield self._get_services_for_3pn(protocol)
+
+        # TODO(paul): scattergather
+        results = []
+        for service in services:
+            result = yield self.appservice_api.query_3pu(
+                service, protocol, fields
+            )
+            if result:
+                results.extend(result)
+
+        defer.returnValue(results)
+
+    @defer.inlineCallbacks
     def _get_services_for_event(self, event):
         """Retrieve a list of application services interested in this event.
 
@@ -175,6 +190,12 @@ class ApplicationServicesHandler(object):
         defer.returnValue(interested_list)
 
     @defer.inlineCallbacks
+    def _get_services_for_3pn(self, protocol):
+        # TODO(paul): Filter by protocol
+        services = yield self.store.get_app_services()
+        defer.returnValue(services)
+
+    @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