diff options
Diffstat (limited to 'plugins/simple_notify.py')
-rw-r--r-- | plugins/simple_notify.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/plugins/simple_notify.py b/plugins/simple_notify.py index 60482101..cfb65e9b 100644 --- a/plugins/simple_notify.py +++ b/plugins/simple_notify.py @@ -94,7 +94,8 @@ from poezio import common class Plugin(BasePlugin): def init(self): self.api.add_event_handler('private_msg', self.on_private_msg) - self.api.add_event_handler('conversation_msg', self.on_conversation_msg) + self.api.add_event_handler('conversation_msg', + self.on_conversation_msg) if self.config.get('muc_too', False): self.api.add_event_handler('muc_msg', self.on_muc_msg) self.api.add_event_handler('highlight', self.on_highlight) @@ -138,13 +139,26 @@ class Plugin(BasePlugin): return command_str = self.config.get('command', '').strip() if not command_str: - self.api.information('No notification command was provided in the configuration file', 'Warning') + self.api.information( + 'No notification command was provided in the configuration file', + 'Warning') return - command = [arg % {'body': body.replace('\n', ' '), 'from': fro} for arg in shlex.split(command_str)] + command = [ + arg % { + 'body': body.replace('\n', ' '), + 'from': fro + } for arg in shlex.split(command_str) + ] self.core.exec_command(command) after_command_str = self.config.get('after_command', '').strip() if not after_command_str: return - after_command = [arg % {'body': body.replace('\n', ' '), 'from': fro} for arg in shlex.split(after_command_str)] - delayed_event = DelayedEvent(self.config.get('delay', 1), self.core.exec_command, after_command) + after_command = [ + arg % { + 'body': body.replace('\n', ' '), + 'from': fro + } for arg in shlex.split(after_command_str) + ] + delayed_event = DelayedEvent( + self.config.get('delay', 1), self.core.exec_command, after_command) self.api.add_timed_event(delayed_event) |