From e4dccc8d8f41de1a6fec165962a3fd678265ec88 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 14 Nov 2011 20:05:13 +0100 Subject: Fix priority for command completion (tab command > core command) --- src/tabs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tabs.py b/src/tabs.py index fd9755f6..9dc24092 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -152,10 +152,10 @@ class Tab(object): if len(txt.split()) > 1 or\ (txt.endswith(' ') and not the_input.last_completion): command_name = txt.split()[0][1:] - if command_name in self.core.commands: - command = self.core.commands[command_name] - elif command_name in self.commands: + if command_name in self.commands: command = self.commands[command_name] + elif command_name in self.core.commands: + command = self.core.commands[command_name] else: # Unknown command, cannot complete return False if command[2] is None: -- cgit v1.2.3 From e4634b9095bd9628396407b3c9fa3a77b3acbe00 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 14 Nov 2011 20:05:41 +0100 Subject: Completion for /version --- src/tabs.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tabs.py b/src/tabs.py index 9dc24092..430ee7f8 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -494,12 +494,20 @@ class MucTab(ChatTab): self.commands['cycle'] = (self.command_cycle, _('Usage: /cycle [message]\nCycle: Leave the current room and rejoin it immediately.'), None) self.commands['info'] = (self.command_info, _('Usage: /info \nInfo: Display some information about the user in the MUC: its/his/her role, affiliation, status and status message.'), self.completion_ignore) self.commands['configure'] = (self.command_configure, _('Usage: /configure\nConfigure: Configure the current room, through a form.'), None) - self.commands['version'] = (self.command_version, _('Usage: /version \nVersion: Get the software version of the given JID or nick in room (usually its XMPP client and Operating System).'), None) + self.commands['version'] = (self.command_version, _('Usage: /version \nVersion: Get the software version of the given JID or nick in room (usually its XMPP client and Operating System).'), self.completion_version) self.commands['names'] = (self.command_names, _('Usage: /names\nNames: Get the list of the users in the room, and the list of the people assuming the different roles.'), None) self.resize() self.update_commands() self.update_keys() + def completion_version(self, the_input): + """Completion for /version""" + userlist = [user.nick for user in self.users] + userlist.remove(self.own_nick) + contact_list = [contact.bare_jid for contact in roster.get_contacts()] + userlist.extend(contact_list) + return the_input.auto_completion(userlist, '') + def completion_nick(self, the_input): """Completion for /nick""" nicks = [os.environ.get('USER'), config.get('default_nick', ''), self.core.get_bookmark_nickname(self.get_name())] -- cgit v1.2.3 From 6e35dcf612727f24abe6ab8f719874a138aef4a0 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 14 Nov 2011 20:45:59 +0100 Subject: Fix PluginConfig.set --- src/plugin.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugin.py b/src/plugin.py index 137f704f..7d1aeb4b 100644 --- a/src/plugin.py +++ b/src/plugin.py @@ -16,6 +16,11 @@ class PluginConfig(config.Config): section = self.module_name return config.Config.get(self, option, default, section) + def set(self, option, default, section=None): + if not section: + section = self.module_name + return config.Config.set(self, option, default, section) + def read(self): """Read the config file""" RawConfigParser.read(self, self.file_name) -- cgit v1.2.3 From 07d7189ab6eb7795ddfa4864ed2d00c34c64486c Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 14 Nov 2011 20:46:19 +0100 Subject: Useful improvements for the reminder plugin --- plugins/reminder.py | 49 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/plugins/reminder.py b/plugins/reminder.py index eb63efde..8426dcfe 100644 --- a/plugins/reminder.py +++ b/plugins/reminder.py @@ -6,12 +6,25 @@ import timed_events class Plugin(BasePlugin): def init(self): - self.add_command('remind', self.command_remind, "Usage: /reminder