diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2016-08-18 14:56:02 +0100 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2016-08-18 14:56:02 +0100 |
commit | 434bbf2cb5b31f5a8430a06f53549248f7306cfd (patch) | |
tree | 7ef3c6156c6867f85e42de458ff94407911ddad5 /synapse/config | |
parent | Merge remote-tracking branch 'origin/develop' into paul/thirdpartylookup (diff) | |
download | synapse-434bbf2cb5b31f5a8430a06f53549248f7306cfd.tar.xz |
Filter 3PU lookups by only ASes that declare knowledge of that protocol
Diffstat (limited to 'synapse/config')
-rw-r--r-- | synapse/config/appservice.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/config/appservice.py b/synapse/config/appservice.py index eade803909..3184d2084c 100644 --- a/synapse/config/appservice.py +++ b/synapse/config/appservice.py @@ -122,6 +122,15 @@ def _load_appservice(hostname, as_info, config_filename): raise ValueError( "Missing/bad type 'exclusive' key in %s", regex_obj ) + # protocols check + protocols = as_info.get("protocols") + if protocols: + # Because strings are lists in python + if isinstance(protocols, str) or not isinstance(protocols, list): + raise KeyError("Optional 'protocols' must be a list if present.") + for p in protocols: + if not isinstance(p, str): + raise KeyError("Bad value for 'protocols' item") return ApplicationService( token=as_info["as_token"], url=as_info["url"], @@ -129,4 +138,5 @@ def _load_appservice(hostname, as_info, config_filename): hs_token=as_info["hs_token"], sender=user_id, id=as_info["id"], + protocols=protocols, ) |