From ef8a7a647f6e895c89cefba0e2f83fb20fdb80c5 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 13 May 2012 18:39:57 +0200 Subject: Use add_tab_command in the quote plugin --- plugins/quote.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/quote.py b/plugins/quote.py index 788d4027..50c390f2 100644 --- a/plugins/quote.py +++ b/plugins/quote.py @@ -1,7 +1,7 @@ -from plugin import BasePlugin, PluginConfig +from plugin import BasePlugin from xhtml import clean_text import common - +import tabs import re timestamp_re = re.compile(r'^(\d\d\d\d-\d\d-\d\d )?\d\d:\d\d:\d\d$') @@ -12,7 +12,9 @@ log = logging.getLogger(__name__) class Plugin(BasePlugin): def init(self): - self.add_command('quote', self.command_quote, "Usage: /quote \nQuote: takes the message received at and insert it in the input, to quote it.", self.completion_quote) + self.add_tab_command(tabs.MucTab, 'quote', self.command_quote, "Usage: /quote \nQuote: takes the message received at and insert it in the input, to quote it.", self.completion_quote) + self.add_tab_command(tabs.ConversationTab, 'quote', self.command_quote, "Usage: /quote \nQuote: takes the message received at and insert it in the input, to quote it.", self.completion_quote) + self.add_tab_command(tabs.PrivateTab, 'quote', self.command_quote, "Usage: /quote \nQuote: takes the message received at and insert it in the input, to quote it.", self.completion_quote) def command_quote(self, args): args = common.shell_split(args) -- cgit v1.2.3 From d949a379a3aa353b6f1f7c48e92ac8cefaca60fc Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 13 May 2012 18:45:40 +0200 Subject: Use add_tab_command in the link plugin --- plugins/link.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/link.py b/plugins/link.py index 2fcf9ddd..29ded32f 100644 --- a/plugins/link.py +++ b/plugins/link.py @@ -3,15 +3,18 @@ import re -from plugin import BasePlugin, PluginConfig +from plugin import BasePlugin from xhtml import clean_text import common +import tabs url_pattern = re.compile(r'\b(http[s]?://(?:\S+))\b', re.I|re.U) class Plugin(BasePlugin): def init(self): - self.add_command('link', self.command_link, "Usage: /link\nLink: opens the last link from the conversation into a browser.") + self.add_tab_command(tabs.MucTab, 'link', self.command_link, "Usage: /link\nLink: opens the last link from the conversation into a browser.") + self.add_tab_command(tabs.PrivateTab, 'link', self.command_link, "Usage: /link\nLink: opens the last link from the conversation into a browser.") + self.add_tab_command(tabs.ConversationTab, 'link', self.command_link, "Usage: /link\nLink: opens the last link from the conversation into a browser.") def find_link(self, nb): messages = self.core.get_conversation_messages() -- cgit v1.2.3 From 5bdbca688c6d57eef41de9d344d94305bb421536 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 13 May 2012 18:46:07 +0200 Subject: Use add_tab_command in the OTR plugin --- plugins/otr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/otr.py b/plugins/otr.py index b674c0fd..971b0059 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -16,7 +16,7 @@ class Plugin(BasePlugin): self.add_event_handler('conversation_say_after', self.on_conversation_say) self.add_event_handler('conversation_msg', self.on_conversation_msg) - self.add_command('otr', self.command_otr, "Usage: /otr \notr: Start or stop OTR for the current conversation", self.otr_completion) + self.add_tab_command(ConversationTab, 'otr', self.command_otr, "Usage: /otr \notr: Start or stop OTR for the current conversation", self.otr_completion) ConversationTab.add_information_element('otr', self.display_encryption_status) def cleanup(self): -- cgit v1.2.3 From dc8b39709ffa2746c6c8ae2c03fad4818a08ba4b Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 19 May 2012 21:56:13 +0200 Subject: Make the alias plugin behave like documented. --- plugins/alias.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/alias.py b/plugins/alias.py index d6a46b6f..5a35d1c6 100644 --- a/plugins/alias.py +++ b/plugins/alias.py @@ -1,3 +1,9 @@ +""" +Alias plugin. + +Allows the creation and the removal of personal aliases. +""" + from plugin import BasePlugin import common from common import parse_command_args_to_alias as parse @@ -9,14 +15,16 @@ class Plugin(BasePlugin): self.commands = {} def command_alias(self, line): + """ + /alias [args] + """ arg = common.shell_split(line) if len(arg) < 2: self.core.information('Alias: Not enough parameters', 'Error') return alias = arg[0] - tmp_args = common.shell_split(arg[1]) - command = tmp_args.pop(0) - tmp_args = arg[1][len(command)+1:] + command = arg[1] + tmp_args = arg[2] if len(arg) > 2 else '' if alias in self.core.commands or alias in self.commands: self.core.information('Alias: command already exists', 'Error') @@ -26,6 +34,9 @@ class Plugin(BasePlugin): self.core.information('Alias /%s successfuly created' % alias, 'Info') def command_unalias(self, alias): + """ + /unalias + """ if alias in self.commands: del self.commands[alias] self.del_command(alias) -- cgit v1.2.3