diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-08-26 09:26:33 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-08-26 09:26:33 +0100 |
commit | 47c3a089c5c3016197964f16f611f72bc4aadde6 (patch) | |
tree | f0a4d1a660e4ae2a58077ad1c250353781445cff /synapse/api | |
parent | Removed member list servlet: now using generic state paths. (diff) | |
parent | Order 'get_recent_events_for_room' correctly. (diff) | |
download | synapse-47c3a089c5c3016197964f16f611f72bc4aadde6.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into client_server_url_rename
Diffstat (limited to '')
-rw-r--r-- | synapse/api/events/__init__.py | 1 | ||||
-rw-r--r-- | synapse/api/events/factory.py | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/synapse/api/events/__init__.py b/synapse/api/events/__init__.py index 921fd08832..aa04dbece7 100644 --- a/synapse/api/events/__init__.py +++ b/synapse/api/events/__init__.py @@ -51,6 +51,7 @@ class SynapseEvent(JsonEncodedObject): "depth", "destinations", "origin", + "outlier", ] required_keys = [ diff --git a/synapse/api/events/factory.py b/synapse/api/events/factory.py index b61dac7acd..c2cdcddf41 100644 --- a/synapse/api/events/factory.py +++ b/synapse/api/events/factory.py @@ -33,16 +33,21 @@ class EventFactory(object): RoomConfigEvent ] - def __init__(self): + def __init__(self, hs): self._event_list = {} # dict of TYPE to event class for event_class in EventFactory._event_classes: self._event_list[event_class.TYPE] = event_class + self.clock = hs.get_clock() + def create_event(self, etype=None, **kwargs): kwargs["type"] = etype if "event_id" not in kwargs: kwargs["event_id"] = random_string(10) + if "ts" not in kwargs: + kwargs["ts"] = int(self.clock.time_msec()) + if etype in self._event_list: handler = self._event_list[etype] else: |