diff options
author | Mark Haines <mjark@negativecurvature.net> | 2015-05-12 15:20:32 +0100 |
---|---|---|
committer | Mark Haines <mjark@negativecurvature.net> | 2015-05-12 15:20:32 +0100 |
commit | 1fce36b11130eb0356c29a36d7f8fac1e0efce48 (patch) | |
tree | 249b8fc1067a0905ef17194279f2b0fc0940563a /synapse/handlers/message.py | |
parent | Merge pull request #148 from matrix-org/bugs/SYN-377 (diff) | |
parent | Err, delete the right stuff (diff) | |
download | synapse-1fce36b11130eb0356c29a36d7f8fac1e0efce48.tar.xz |
Merge pull request #149 from matrix-org/erikj/backfill
Backfill support
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 22e19af17f..1809a44a99 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -21,7 +21,7 @@ from synapse.streams.config import PaginationConfig from synapse.events.utils import serialize_event from synapse.events.validator import EventValidator from synapse.util.logcontext import PreserveLoggingContext -from synapse.types import UserID +from synapse.types import UserID, RoomStreamToken from ._base import BaseHandler @@ -89,9 +89,19 @@ class MessageHandler(BaseHandler): if not pagin_config.from_token: pagin_config.from_token = ( - yield self.hs.get_event_sources().get_current_token() + yield self.hs.get_event_sources().get_current_token( + direction='b' + ) ) + room_token = RoomStreamToken.parse(pagin_config.from_token.room_key) + if room_token.topological is None: + raise SynapseError(400, "Invalid token") + + yield self.hs.get_handlers().federation_handler.maybe_backfill( + room_id, room_token.topological + ) + user = UserID.from_string(user_id) events, next_key = yield data_source.get_pagination_rows( |