From f522a1340e6d72f2e7090772379ff25aeb590bcf Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Wed, 28 Jun 2023 21:25:24 +0200 Subject: Reset conversation state on buffer close --- slack/slack_conversation.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'slack/slack_conversation.py') diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py index e72e293..3b58e72 100644 --- a/slack/slack_conversation.py +++ b/slack/slack_conversation.py @@ -132,7 +132,11 @@ class SlackConversation: short_name = self.name_prefix("short_name") + name self.buffer_pointer = weechat.buffer_new( - full_name, get_callback_name(self._buffer_input_cb), "", "", "" + full_name, + get_callback_name(self._buffer_input_cb), + "", + get_callback_name(self._buffer_close_cb), + "", ) weechat.buffer_set(self.buffer_pointer, "short_name", short_name) weechat.buffer_set( @@ -177,3 +181,8 @@ class SlackConversation: def _buffer_input_cb(self, data: str, buffer: str, input_data: str) -> int: weechat.prnt(buffer, "Text: %s" % input_data) return weechat.WEECHAT_RC_OK + + def _buffer_close_cb(self, data: str, buffer: str) -> int: + self.buffer_pointer = "" + self.history_filled = False + return weechat.WEECHAT_RC_OK -- cgit