diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-08-13 15:53:44 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-08-13 15:53:44 +0100 |
commit | 38c7e923312047b2c26c6ca3f15a9813159088e7 (patch) | |
tree | 819149e28fe875a9e8ee1fe22a86f4d64cdd4355 /synapse | |
parent | Merge branch 'master' of github.com:matrix-org/synapse (diff) | |
parent | more quickstart fixes (diff) | |
download | synapse-38c7e923312047b2c26c6ca3f15a9813159088e7.tar.xz |
Merge branch 'master' of github.com:matrix-org/synapse
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/api/constants.py | 8 | ||||
-rw-r--r-- | synapse/app/homeserver.py | 5 | ||||
-rw-r--r-- | synapse/federation/transport.py | 33 |
3 files changed, 24 insertions, 22 deletions
diff --git a/synapse/api/constants.py b/synapse/api/constants.py index 29687c3482..1ff1af76ec 100644 --- a/synapse/api/constants.py +++ b/synapse/api/constants.py @@ -37,7 +37,7 @@ class Feedback(object): class PresenceState(object): """Represents the presence state of a user.""" - OFFLINE = 0 - BUSY = 1 - ONLINE = 2 - FREE_FOR_CHAT = 3 + OFFLINE = u"offline" + UNAVAILABLE = u"unavailable" + ONLINE = u"online" + FREE_FOR_CHAT = u"free_for_chat" diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index bbc37dd026..f89b4652e3 100644 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -88,9 +88,8 @@ def setup_logging(verbosity=0, filename=None, config_path=None): '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(message)s' ) - if not verbosity or verbosity == 0: - level = logging.INFO - elif verbosity == 1: + level = logging.INFO + if verbosity: level = logging.DEBUG # FIXME: we need a logging.WARN for a -q quiet option diff --git a/synapse/federation/transport.py b/synapse/federation/transport.py index 09a5e5901a..ff3fc34419 100644 --- a/synapse/federation/transport.py +++ b/synapse/federation/transport.py @@ -33,6 +33,9 @@ import re logger = logging.getLogger(__name__) +PREFIX = "/matrix/federation/v1" + + class TransportLayer(object): """This is a basic implementation of the transport layer that translates transactions and other requests to/from HTTP. @@ -84,9 +87,9 @@ class TransportLayer(object): logger.debug("get_context_state dest=%s, context=%s", destination, context) - path = "/state/%s/" % context + subpath = "/state/%s/" % context - return self._do_request_for_transaction(destination, path) + return self._do_request_for_transaction(destination, subpath) @log_function def get_pdu(self, destination, pdu_origin, pdu_id): @@ -104,9 +107,9 @@ class TransportLayer(object): logger.debug("get_pdu dest=%s, pdu_origin=%s, pdu_id=%s", destination, pdu_origin, pdu_id) - path = "/pdu/%s/%s/" % (pdu_origin, pdu_id) + subpath = "/pdu/%s/%s/" % (pdu_origin, pdu_id) - return self._do_request_for_transaction(destination, path) + return self._do_request_for_transaction(destination, subpath) @log_function def paginate(self, dest, context, pdu_tuples, limit): @@ -130,14 +133,14 @@ class TransportLayer(object): if not pdu_tuples: return - path = "/paginate/%s/" % context + subpath = "/paginate/%s/" % context args = {"v": ["%s,%s" % (i, o) for i, o in pdu_tuples]} args["limit"] = limit return self._do_request_for_transaction( dest, - path, + subpath, args=args, ) @@ -166,7 +169,7 @@ class TransportLayer(object): code, response = yield self.client.put_json( transaction.destination, - path="/send/%s/" % transaction.transaction_id, + path=PREFIX + "/send/%s/" % transaction.transaction_id, data=data ) @@ -189,7 +192,7 @@ class TransportLayer(object): # This is when someone is trying to send us a bunch of data. self.server.register_path( "PUT", - re.compile("^/send/([^/]*)/$"), + re.compile("^" + PREFIX + "/send/([^/]*)/$"), self._on_send_request ) @@ -207,7 +210,7 @@ class TransportLayer(object): # This is for when someone asks us for everything since version X self.server.register_path( "GET", - re.compile("^/pull/$"), + re.compile("^" + PREFIX + "/pull/$"), lambda request: handler.on_pull_request( request.args["origin"][0], request.args["v"] @@ -218,7 +221,7 @@ class TransportLayer(object): # data_id pair. self.server.register_path( "GET", - re.compile("^/pdu/([^/]*)/([^/]*)/$"), + re.compile("^" + PREFIX + "/pdu/([^/]*)/([^/]*)/$"), lambda request, pdu_origin, pdu_id: handler.on_pdu_request( pdu_origin, pdu_id ) @@ -227,7 +230,7 @@ class TransportLayer(object): # This is when someone asks for all data for a given context. self.server.register_path( "GET", - re.compile("^/state/([^/]*)/$"), + re.compile("^" + PREFIX + "/state/([^/]*)/$"), lambda request, context: handler.on_context_state_request( context ) @@ -235,7 +238,7 @@ class TransportLayer(object): self.server.register_path( "GET", - re.compile("^/paginate/([^/]*)/$"), + re.compile("^" + PREFIX + "/paginate/([^/]*)/$"), lambda request, context: self._on_paginate_request( context, request.args["v"], request.args["limit"] @@ -244,7 +247,7 @@ class TransportLayer(object): self.server.register_path( "GET", - re.compile("^/context/([^/]*)/$"), + re.compile("^" + PREFIX + "/context/([^/]*)/$"), lambda request, context: handler.on_context_pdus_request(context) ) @@ -300,7 +303,7 @@ class TransportLayer(object): @defer.inlineCallbacks @log_function - def _do_request_for_transaction(self, destination, path, args={}): + def _do_request_for_transaction(self, destination, subpath, args={}): """ Args: destination (str) @@ -313,7 +316,7 @@ class TransportLayer(object): data = yield self.client.get_json( destination, - path=path, + path=PREFIX + subpath, args=args, ) |