diff options
author | Kegsay <kegsay@gmail.com> | 2016-08-30 17:56:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-30 17:56:05 +0100 |
commit | 998666be6404865d50bf3a2dc5aa322b1a12f198 (patch) | |
tree | 58b6eb93014cf90dbb30c781aa804ee048e5f72e /synapse/appservice | |
parent | Merge pull request #1055 from matrix-org/erikj/occaisonally_persist (diff) | |
parent | flake8 (diff) | |
download | synapse-998666be6404865d50bf3a2dc5aa322b1a12f198.tar.xz |
Merge pull request #1056 from matrix-org/kegan/appservice-url-is-optional
Allow application services to have an optional 'url'
Diffstat (limited to 'synapse/appservice')
-rw-r--r-- | synapse/appservice/api.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py index 775417eb21..cc4af23962 100644 --- a/synapse/appservice/api.py +++ b/synapse/appservice/api.py @@ -67,6 +67,8 @@ class ApplicationServiceApi(SimpleHttpClient): @defer.inlineCallbacks def query_user(self, service, user_id): + if service.url is None: + defer.returnValue(False) uri = service.url + ("/users/%s" % urllib.quote(user_id)) response = None try: @@ -86,6 +88,8 @@ class ApplicationServiceApi(SimpleHttpClient): @defer.inlineCallbacks def query_alias(self, service, alias): + if service.url is None: + defer.returnValue(False) uri = service.url + ("/rooms/%s" % urllib.quote(alias)) response = None try: @@ -113,6 +117,8 @@ class ApplicationServiceApi(SimpleHttpClient): raise ValueError( "Unrecognised 'kind' argument %r to query_3pe()", kind ) + if service.url is None: + defer.returnValue([]) uri = "%s%s/thirdparty/%s/%s" % ( service.url, @@ -145,6 +151,9 @@ class ApplicationServiceApi(SimpleHttpClient): defer.returnValue([]) def get_3pe_protocol(self, service, protocol): + if service.url is None: + defer.returnValue({}) + @defer.inlineCallbacks def _get(): uri = "%s%s/thirdparty/protocol/%s" % ( @@ -166,6 +175,9 @@ class ApplicationServiceApi(SimpleHttpClient): @defer.inlineCallbacks def push_bulk(self, service, events, txn_id=None): + if service.url is None: + defer.returnValue(True) + events = self._serialize(events) if txn_id is None: |