summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/alias.py17
-rw-r--r--plugins/link.py7
-rw-r--r--plugins/otr.py2
-rw-r--r--plugins/quote.py8
4 files changed, 25 insertions, 9 deletions
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 <alias> <command> [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 <existing alias>
+ """
if alias in self.commands:
del self.commands[alias]
self.del_command(alias)
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()
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 <start|end>\notr: Start or stop OTR for the current conversation", self.otr_completion)
+ self.add_tab_command(ConversationTab, 'otr', self.command_otr, "Usage: /otr <start|end>\notr: Start or stop OTR for the current conversation", self.otr_completion)
ConversationTab.add_information_element('otr', self.display_encryption_status)
def cleanup(self):
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 <timestamp>\nQuote: takes the message received at <timestamp> and insert it in the input, to quote it.", self.completion_quote)
+ self.add_tab_command(tabs.MucTab, 'quote', self.command_quote, "Usage: /quote <timestamp>\nQuote: takes the message received at <timestamp> and insert it in the input, to quote it.", self.completion_quote)
+ self.add_tab_command(tabs.ConversationTab, 'quote', self.command_quote, "Usage: /quote <timestamp>\nQuote: takes the message received at <timestamp> and insert it in the input, to quote it.", self.completion_quote)
+ self.add_tab_command(tabs.PrivateTab, 'quote', self.command_quote, "Usage: /quote <timestamp>\nQuote: takes the message received at <timestamp> and insert it in the input, to quote it.", self.completion_quote)
def command_quote(self, args):
args = common.shell_split(args)