mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-09 20:42:12 -04:00
Merge branch 'develop' of github.com:matrix-org/synapse into client_server_url_rename
This commit is contained in:
commit
47c3a089c5
55 changed files with 2633 additions and 606 deletions
|
@ -51,6 +51,7 @@ class SynapseEvent(JsonEncodedObject):
|
|||
"depth",
|
||||
"destinations",
|
||||
"origin",
|
||||
"outlier",
|
||||
]
|
||||
|
||||
required_keys = [
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue