0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 03:23:47 +01:00

Support generic events.

This commit is contained in:
Erik Johnston 2014-08-15 16:06:08 +01:00
parent cd2967d271
commit 19946509a4
2 changed files with 8 additions and 5 deletions

View file

@ -15,7 +15,7 @@
from synapse.api.events.room import (
RoomTopicEvent, MessageEvent, RoomMemberEvent, FeedbackEvent,
InviteJoinEvent, RoomConfigEvent, RoomNameEvent,
InviteJoinEvent, RoomConfigEvent, RoomNameEvent, GenericEvent,
)
from synapse.util.stringutils import random_string
@ -43,10 +43,9 @@ class EventFactory(object):
if "event_id" not in kwargs:
kwargs["event_id"] = random_string(10)
try:
if etype in self._event_list:
handler = self._event_list[etype]
except KeyError: # unknown event type
# TODO allow custom event types.
raise NotImplementedError("Unknown etype=%s" % etype)
else:
handler = GenericEvent
return handler(**kwargs)

View file

@ -16,6 +16,10 @@
from . import SynapseEvent
class GenericEvent(SynapseEvent):
def get_content_template(self):
return {}
class RoomTopicEvent(SynapseEvent):
TYPE = "m.room.topic"