From 4b4d02b62037dce4524443c55be2ae95247127fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 3 Aug 2018 15:09:15 +0200 Subject: [PATCH] buffer: Add the event id to the tags for our own messages. --- matrix/buffer.py | 20 +++++++++++--------- matrix/server.py | 1 + 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/matrix/buffer.py b/matrix/buffer.py index 1cb211d..7430c25 100644 --- a/matrix/buffer.py +++ b/matrix/buffer.py @@ -647,14 +647,14 @@ class WeechatChannelBuffer(object): self.topic_author = nick self.topic_date = date - def self_message(self, nick, message, date): + def self_message(self, nick, message, date, tags=None): user = self._get_user(nick) - tags = self._message_tags(user, "self_message") + tags = self._message_tags(user, "self_message") + (tags or []) self._print_message(user, message, date, tags) - def self_action(self, nick, message, date): + def self_action(self, nick, message, date, tags=None): user = self._get_user(nick) - tags = self._message_tags(user, "self_message") + tags = self._message_tags(user, "self_message") + (tags or []) tags.append(SCRIPT_NAME + "_action") self._print_action(user, message, date, tags) @@ -994,20 +994,22 @@ class RoomBuffer(object): # type: (OwnMessage) -> None nick = self.find_nick(self.room.own_user_id) data = message.formatted_message.to_weechat() - - # TODO event_id tag is missing + tags = self.get_event_tags(message) date = message.age - self.weechat_buffer.self_message(nick, data, date) + + self.weechat_buffer.self_message(nick, data, date, tags) def self_action(self, message): # type: (OwnMessage) -> None nick = self.find_nick(self.room.own_user_id) date = message.age - # TODO event_id tag is missing + tags = self.get_event_tags(message) + self.weechat_buffer.self_action( nick, message.formatted_message.to_weechat(), - date + date, + tags ) def old_redacted(self, event): diff --git a/matrix/server.py b/matrix/server.py index b294e1f..916d6ad 100644 --- a/matrix/server.py +++ b/matrix/server.py @@ -472,6 +472,7 @@ class MatrixServer: def handle_own_messages(self, response): message = self.own_message_queue.pop(response.uuid) room_buffer = self.room_buffers[message.room_id] + message = message._replace(event_id=response.event_id) if isinstance(message, OwnAction): room_buffer.self_action(message)