feat: Add support for /input set_unread(_current_buffer)
This hooks into the weechat commands `/input set_unread` and `/input
set_unread_current_buffer` and implements them. For set_unread we
iterate over all the channels and mark them as read. For
set_unread_current_buffer we mark the current buffer as read.
Fixes
@@ -3175,6 +3175,23 @@ def label_command_cb(data, current_buffer, args):
w.buffer_set(channel.channel_buffer, "short_name", new_name)
+def set_unread_cb(data, current_buffer, command):
+ data = decode_from_utf8(data)
+ command = decode_from_utf8(command)
+ for channel in EVENTROUTER.weechat_controller.buffers.values():
+ channel.mark_read()
+ return w.WEECHAT_RC_OK
+
+
+@slack_buffer_or_ignore
+def set_unread_current_buffer_cb(data, current_buffer, command):
+ data = decode_from_utf8(data)
+ command = decode_from_utf8(command)
+ channel = EVENTROUTER.weechat_controller.buffers.get(current_buffer)
+ channel.mark_read()
+ return w.WEECHAT_RC_OK
+
+
def command_p(data, current_buffer, args):
args = args.split(' ', 1)[1]
w.prnt("", "{}".format(eval(args)))
@@ -3276,6 +3293,8 @@ def setup_hooks():
w.hook_command_run('/msg', 'msg_command_cb', '')
w.hook_command_run('/label', 'label_command_cb', '')
w.hook_command_run("/input complete_next", "complete_next_cb", "")
+ w.hook_command_run("/input set_unread", "set_unread_cb", "")
+ w.hook_command_run("/input set_unread_current_buffer", "set_unread_current_buffer_cb", "")
w.hook_command_run('/away', 'away_command_cb', '')
w.hook_completion("nicks", "complete @-nicks for slack", "nick_completion_cb", "")
