diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-06-28 21:25:24 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:53 +0100 |
commit | f522a1340e6d72f2e7090772379ff25aeb590bcf (patch) | |
tree | 1a7343cc224554351d7c15271db17242c624637e /slack/slack_conversation.py | |
parent | d4a671d622cf558602debfee8396303986f92ac7 (diff) | |
download | wee-slack-f522a1340e6d72f2e7090772379ff25aeb590bcf.tar.gz |
Reset conversation state on buffer close
Diffstat (limited to 'slack/slack_conversation.py')
-rw-r--r-- | slack/slack_conversation.py | 11 |
1 files changed, 10 insertions, 1 deletions
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 |