From d32d92c26945dae3f34dda6dd81be6699f47da32 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 10 Jan 2012 16:32:29 +0100 Subject: And add the missing files. --- plugins/simple_notify.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 plugins/simple_notify.py (limited to 'plugins') diff --git a/plugins/simple_notify.py b/plugins/simple_notify.py new file mode 100644 index 00000000..32861d87 --- /dev/null +++ b/plugins/simple_notify.py @@ -0,0 +1,34 @@ +# A plugin that adds the /link command, letting you open links that are pasted +# in the conversation, without having to click them. + +import os +import re + +from plugin import BasePlugin, PluginConfig +from xhtml import clean_text, get_body_from_message_stanza +import common + +url_pattern = re.compile(r'\b(http[s]?://(?:\S+))\b', re.I|re.U) + +class Plugin(BasePlugin): + def init(self): + self.add_event_handler('private_msg', self.on_private_msg) + self.add_event_handler('conversation_msg', self.on_conversation_msg) + + def on_private_msg(self, message, tab): + fro = message['from'] + self.do_notify(message, fro) + + def on_conversation_msg(self, message, tab): + fro = message['from'].bare + self.do_notify(message, fro) + + def do_notify(self, message, fro): + body = clean_text(get_body_from_message_stanza(message)) + if not body: + return + command = self.config.get('command', '').strip() + if not command: + self.core.information('No notification command was provided in the configuration file', 'Warning') + return + self.core.exec_command(command % {'body':body, 'from':fro}) -- cgit v1.2.3 From 88f7e690bda7e53e41b9cfaac2027c76fc774727 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 11 Jan 2012 18:13:32 +0100 Subject: Fix the alias plugin --- plugins/alias.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/alias.py b/plugins/alias.py index 2517e2b9..d6a46b6f 100644 --- a/plugins/alias.py +++ b/plugins/alias.py @@ -21,7 +21,7 @@ class Plugin(BasePlugin): if alias in self.core.commands or alias in self.commands: self.core.information('Alias: command already exists', 'Error') return - self.commands[alias] = lambda args: self.get_command(command)(parse(common.shell_split(args), tmp_args)) + self.commands[alias] = lambda arg: self.get_command(command)(parse(arg, tmp_args)) self.add_command(alias, self.commands[alias], 'This command is an alias for /%s %s' %( command, tmp_args)) self.core.information('Alias /%s successfuly created' % alias, 'Info') -- cgit v1.2.3 From 2dc7af10fbb3edd54bbdc3b0d65c6728078fa4b7 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 29 Jan 2012 03:34:01 +0100 Subject: Do not traceback when /gpg outside a ConversationTab --- plugins/gpg/__init__.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/gpg/__init__.py b/plugins/gpg/__init__.py index 01ca6ab2..620a4589 100644 --- a/plugins/gpg/__init__.py +++ b/plugins/gpg/__init__.py @@ -176,6 +176,8 @@ class Plugin(BasePlugin): else: if isinstance(self.core.current_tab(), ConversationTab): jid = JID(self.core.current_tab().get_name()) + else: + return command = args[0] if command == 'force' or command == 'enable': # we can force encryption only with contact having an associated -- cgit v1.2.3 From e47c8d3c197264c1749ca300c09165e54a1acb5c Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 7 Feb 2012 01:12:21 +0100 Subject: Add a /amsg plugin --- plugins/amsg.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 plugins/amsg.py (limited to 'plugins') diff --git a/plugins/amsg.py b/plugins/amsg.py new file mode 100644 index 00000000..697f793f --- /dev/null +++ b/plugins/amsg.py @@ -0,0 +1,13 @@ +# A simple broadcast plugin + +from plugin import BasePlugin +from tabs import MucTab + +class Plugin(BasePlugin): + def init(self): + self.add_command('amsg', self.command_amsg, "Usage: /amsg \nAmsg: Broadcast the message to all the joined rooms.") + + def command_amsg(self, args): + for room in self.core.tabs: + if isinstance(room, MucTab) and room.joined: + room.command_say(args) -- cgit v1.2.3 From 42c8deb9e19bde492c3f17d8f07f5b277eee4d04 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 9 Feb 2012 11:08:14 +0100 Subject: Remove some debugging prints --- plugins/gpg/__init__.py | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins') diff --git a/plugins/gpg/__init__.py b/plugins/gpg/__init__.py index 620a4589..00d896cd 100644 --- a/plugins/gpg/__init__.py +++ b/plugins/gpg/__init__.py @@ -158,7 +158,6 @@ class Plugin(BasePlugin): if jid.full not in self.contacts.keys(): return '' status = self.contacts[jid.full] - self.core.information('%s' % (status,)) if status in ('valid', 'invalid', 'signed'): return ' GPG Key: %s (%s)' % (status, 'encrypted' if status == 'valid' else 'NOT encrypted',) else: -- cgit v1.2.3 From b489b68e209d578c92e84d21940ceed2fb75ee65 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 14 Feb 2012 02:43:00 +0100 Subject: Fixes #2326 --- plugins/ping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/ping.py b/plugins/ping.py index 349b7f52..51198d39 100644 --- a/plugins/ping.py +++ b/plugins/ping.py @@ -18,7 +18,7 @@ class Plugin(BasePlugin): return jid = JID(arg) try: - delay = self.core.xmpp.plugin['xep_0199'].send_ping(jid=jid) + delay = self.core.xmpp.plugin['xep_0199'].send_ping(jid=jid, block=False) except: delay = None if delay is not None: -- cgit v1.2.3