summary refs log tree commit diff
path: root/synapse/appservice/api.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-08-26 14:35:31 +0100
committerMark Haines <mark.haines@matrix.org>2016-08-26 14:35:31 +0100
commit4bbef62124f0fb249e314e94a1b9c15204c8daa9 (patch)
treecc2e7458da160915f7224c0487f185e2433eaadb /synapse/appservice/api.py
parentMore 0_0 in tests (diff)
parentMerge pull request #1048 from matrix-org/erikj/fix_mail_name (diff)
downloadsynapse-4bbef62124f0fb249e314e94a1b9c15204c8daa9.tar.xz
Merge remote-tracking branch 'origin/develop' into markjh/direct_to_device
Diffstat (limited to 'synapse/appservice/api.py')
-rw-r--r--synapse/appservice/api.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py
index d28a9dff0a..775417eb21 100644
--- a/synapse/appservice/api.py
+++ b/synapse/appservice/api.py
@@ -14,11 +14,11 @@
 # limitations under the License.
 from twisted.internet import defer
 
+from synapse.api.constants import ThirdPartyEntityKind
 from synapse.api.errors import CodeMessageException
 from synapse.http.client import SimpleHttpClient
 from synapse.events.utils import serialize_event
 from synapse.util.caches.response_cache import ResponseCache
-from synapse.types import ThirdPartyEntityKind
 
 import logging
 import urllib
@@ -29,6 +29,9 @@ logger = logging.getLogger(__name__)
 HOUR_IN_MS = 60 * 60 * 1000
 
 
+APP_SERVICE_PREFIX = "/_matrix/app/unstable"
+
+
 def _is_valid_3pe_result(r, field):
     if not isinstance(r, dict):
         return False
@@ -103,16 +106,20 @@ class ApplicationServiceApi(SimpleHttpClient):
     @defer.inlineCallbacks
     def query_3pe(self, service, kind, protocol, fields):
         if kind == ThirdPartyEntityKind.USER:
-            uri = "%s/thirdparty/user/%s" % (service.url, urllib.quote(protocol))
             required_field = "userid"
         elif kind == ThirdPartyEntityKind.LOCATION:
-            uri = "%s/thirdparty/location/%s" % (service.url, urllib.quote(protocol))
             required_field = "alias"
         else:
             raise ValueError(
                 "Unrecognised 'kind' argument %r to query_3pe()", kind
             )
 
+        uri = "%s%s/thirdparty/%s/%s" % (
+            service.url,
+            APP_SERVICE_PREFIX,
+            kind,
+            urllib.quote(protocol)
+        )
         try:
             response = yield self.get_json(uri, fields)
             if not isinstance(response, list):
@@ -140,7 +147,11 @@ class ApplicationServiceApi(SimpleHttpClient):
     def get_3pe_protocol(self, service, protocol):
         @defer.inlineCallbacks
         def _get():
-            uri = "%s/thirdparty/protocol/%s" % (service.url, urllib.quote(protocol))
+            uri = "%s%s/thirdparty/protocol/%s" % (
+                service.url,
+                APP_SERVICE_PREFIX,
+                urllib.quote(protocol)
+            )
             try:
                 defer.returnValue((yield self.get_json(uri, {})))
             except Exception as ex: