From 8aec9f9dacc38a432cabfc904ba046a38e37e4bf Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 2 Oct 2016 15:05:58 +0200 Subject: Fix #3229 (add a command to list /tell messages) --- plugins/tell.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plugins/tell.py b/plugins/tell.py index ba638e82..57837517 100644 --- a/plugins/tell.py +++ b/plugins/tell.py @@ -18,6 +18,11 @@ This plugin defines two new commands for MUC tabs: :term:`/tell` and :term:`/unt Cancel all scheduled messages to *nick*. + /list_tell + **Usage:** ``/list_tell`` + + List all queued messages for the current chatroom. + """ from poezio.plugin import BasePlugin from poezio.core.structs import Completion @@ -35,6 +40,9 @@ class Plugin(BasePlugin): help='Remove the planned messages from /tell.', short='Cancel a /tell message', completion=self.completion_untell) + self.api.add_tab_command(tabs.MucTab, 'list_tell', self.command_list_tell, + usage='', + help='List currently queued messages') self.api.add_event_handler('muc_join', self.on_join) # {tab -> {nick -> [messages]} self.tabs = {} @@ -49,6 +57,19 @@ class Plugin(BasePlugin): tab.command_say("%s: %s" % (nick, i)) del self.tabs[tab][nick] + @command_args_parser.ignored + def command_list_tell(self): + tab = self.api.current_tab() + if not self.tabs.get(tab): + self.api.information('No message queued.', 'Info') + return + build = ['Messages queued for %s:' % tab.name] + for nick, messages in self.tabs[tab].items(): + build.append(' for %s:' % nick) + for message in messages: + build.append(' - %s' % message) + self.api.information('\n'.join(build), 'Info') + @command_args_parser.quoted(2) def command_tell(self, args): """/tell """ -- cgit v1.2.3