diff options
author | mathieui <mathieui@mathieui.net> | 2016-10-02 15:05:58 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2016-10-02 15:05:58 +0200 |
commit | 8aec9f9dacc38a432cabfc904ba046a38e37e4bf (patch) | |
tree | b7af579f3d211fb45e987bff5fcdc858188434a5 /plugins/tell.py | |
parent | 8f9e14dcb67f494d80f3b28d30df17a187999722 (diff) | |
download | poezio-8aec9f9dacc38a432cabfc904ba046a38e37e4bf.tar.gz poezio-8aec9f9dacc38a432cabfc904ba046a38e37e4bf.tar.bz2 poezio-8aec9f9dacc38a432cabfc904ba046a38e37e4bf.tar.xz poezio-8aec9f9dacc38a432cabfc904ba046a38e37e4bf.zip |
Fix #3229 (add a command to list /tell messages)
Diffstat (limited to 'plugins/tell.py')
-rw-r--r-- | plugins/tell.py | 21 |
1 files changed, 21 insertions, 0 deletions
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 <nick> <message>""" |