From bc1ad45918d48699955acebf133fd06e4d316309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?poljar=20=28Damir=20Jeli=C4=87=29?= Date: Fri, 6 Jul 2018 18:28:41 +0200 Subject: [PATCH] buffer: Fix handling of unknown message types. --- matrix/buffer.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/matrix/buffer.py b/matrix/buffer.py index aafdfc4..c2ed1cd 100644 --- a/matrix/buffer.py +++ b/matrix/buffer.py @@ -885,6 +885,7 @@ class RoomBuffer(object): date, self.get_event_tags(event) ) + elif isinstance(event, RoomMessageMedia): nick = self.find_nick(event.sender) date = server_ts_to_weechat(event.timestamp) @@ -906,7 +907,15 @@ class RoomBuffer(object): nick = self.find_nick(event.sender) date = server_ts_to_weechat(event.timestamp) data = ("Unknown message of type {t}, body: {body}").format( - t=self.message_type, body=self.message) + t=event.message_type, + body=event.message + ) + self.weechat_buffer.message( + nick, + data, + date, + self.get_event_tags(event) + ) elif isinstance(event, RoomRedactionEvent): self._redact_line(event) @@ -926,6 +935,9 @@ class RoomBuffer(object): elif isinstance(event, RoomPowerLevels): self._handle_power_level(event) + else: + W.prnt("", "Unhandled event of type {}.".format(type(event))) + def self_message(self, message): nick = self.find_nick(self.room.own_user_id) data = (message.formatted_message.to_weechat()