mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Support generic events.
This commit is contained in:
parent
cd2967d271
commit
19946509a4
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
from synapse.api.events.room import (
|
from synapse.api.events.room import (
|
||||||
RoomTopicEvent, MessageEvent, RoomMemberEvent, FeedbackEvent,
|
RoomTopicEvent, MessageEvent, RoomMemberEvent, FeedbackEvent,
|
||||||
InviteJoinEvent, RoomConfigEvent, RoomNameEvent,
|
InviteJoinEvent, RoomConfigEvent, RoomNameEvent, GenericEvent,
|
||||||
)
|
)
|
||||||
|
|
||||||
from synapse.util.stringutils import random_string
|
from synapse.util.stringutils import random_string
|
||||||
@ -43,10 +43,9 @@ class EventFactory(object):
|
|||||||
if "event_id" not in kwargs:
|
if "event_id" not in kwargs:
|
||||||
kwargs["event_id"] = random_string(10)
|
kwargs["event_id"] = random_string(10)
|
||||||
|
|
||||||
try:
|
if etype in self._event_list:
|
||||||
handler = self._event_list[etype]
|
handler = self._event_list[etype]
|
||||||
except KeyError: # unknown event type
|
else:
|
||||||
# TODO allow custom event types.
|
handler = GenericEvent
|
||||||
raise NotImplementedError("Unknown etype=%s" % etype)
|
|
||||||
|
|
||||||
return handler(**kwargs)
|
return handler(**kwargs)
|
||||||
|
@ -16,6 +16,10 @@
|
|||||||
from . import SynapseEvent
|
from . import SynapseEvent
|
||||||
|
|
||||||
|
|
||||||
|
class GenericEvent(SynapseEvent):
|
||||||
|
def get_content_template(self):
|
||||||
|
return {}
|
||||||
|
|
||||||
class RoomTopicEvent(SynapseEvent):
|
class RoomTopicEvent(SynapseEvent):
|
||||||
TYPE = "m.room.topic"
|
TYPE = "m.room.topic"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user