rooms: Add canonical alias event handling.
This commit is contained in:
parent
e5b08f653a
commit
dc25487127
1 changed files with 18 additions and 0 deletions
|
@ -175,6 +175,8 @@ class RoomInfo():
|
|||
other_events.append(RoomRedactionEvent.from_dict(event))
|
||||
elif event["type"] == "m.room.name":
|
||||
other_events.append(RoomNameEvent.from_dict(event))
|
||||
elif event["type"] == "m.room.canonical_alias":
|
||||
other_events.append(RoomAliasEvent.from_dict(event))
|
||||
elif event["type"] == "m.room.encryption":
|
||||
other_events.append(RoomEncryptionEvent.from_dict(event))
|
||||
except (ValueError, TypeError, KeyError) as error:
|
||||
|
@ -730,6 +732,22 @@ class RoomNameEvent(RoomEvent):
|
|||
W.buffer_set(buff, "localvar_set_channel", self.name)
|
||||
|
||||
|
||||
class RoomAliasEvent(RoomNameEvent):
|
||||
|
||||
def __init__(self, event_id, sender, timestamp, name):
|
||||
RoomNameEvent.__init__(self, event_id, sender, timestamp, name)
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, event_dict):
|
||||
event_id = sanitize_id(event_dict["event_id"])
|
||||
sender = sanitize_id(event_dict["sender"])
|
||||
timestamp = sanitize_ts(event_dict["origin_server_ts"])
|
||||
|
||||
name = sanitize_id(event_dict["content"]["alias"])
|
||||
|
||||
return cls(event_id, sender, timestamp, name)
|
||||
|
||||
|
||||
class RoomEncryptionEvent(RoomEvent):
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in a new issue