summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2012-07-03 01:59:25 +0200
committerFlorent Le Coz <louiz@louiz.org>2012-07-03 01:59:25 +0200
commit4bc215806b62f687faec9f5176d717f071cc6c9f (patch)
tree38310b270e4ec1792562948560878962f678e456 /plugins
parent737c6aae437530a0bd09852a01aabc583cc721bc (diff)
downloadpoezio-4bc215806b62f687faec9f5176d717f071cc6c9f.tar.gz
poezio-4bc215806b62f687faec9f5176d717f071cc6c9f.tar.bz2
poezio-4bc215806b62f687faec9f5176d717f071cc6c9f.tar.xz
poezio-4bc215806b62f687faec9f5176d717f071cc6c9f.zip
Improve the simple_notify plugin and the daemon to execute a command to clean the notification and to execute the remote commands through sh -c, letting us use pipes and redirections. Also adds the highlight event for plugin, and make the simple_notify plugin use it as well.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/simple_notify.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/simple_notify.py b/plugins/simple_notify.py
index 61045130..bc31c961 100644
--- a/plugins/simple_notify.py
+++ b/plugins/simple_notify.py
@@ -1,15 +1,21 @@
from plugin import BasePlugin
from xhtml import clean_text, get_body_from_message_stanza
+from timed_events import DelayedEvent
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)
+ self.add_event_handler('highlight', self.on_highlight)
def on_private_msg(self, message, tab):
fro = message['from']
self.do_notify(message, fro)
+ def on_highlight(self, message, tab):
+ fro = message['from'].resource
+ self.do_notify(message, fro)
+
def on_conversation_msg(self, message, tab):
fro = message['from'].bare
self.do_notify(message, fro)
@@ -23,3 +29,8 @@ class Plugin(BasePlugin):
self.core.information('No notification command was provided in the configuration file', 'Warning')
return
self.core.exec_command(command % {'body':body, 'from':fro})
+ after_command = self.config.get('after_command', '').strip()
+ if not after_command:
+ return
+ delayed_event = DelayedEvent(self.config.get('delay', 1), self.core.exec_command, after_command % {'body':body, 'from':fro})
+ self.core.add_timed_event(delayed_event)