From f1995d060b9e0e72c8b2534dd19c09d2091dc84c Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 12 Feb 2014 23:29:21 +0100 Subject: Add a fun spaces.py plugin --- plugins/spaces.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/spaces.py diff --git a/plugins/spaces.py b/plugins/spaces.py new file mode 100644 index 00000000..9189d18a --- /dev/null +++ b/plugins/spaces.py @@ -0,0 +1,22 @@ +""" +Insert a space between each character, in messages that you send. + +Installation +------------ + +You only have to load the plugin: + +.. code-block:: none + /load spaces + +""" +from plugin import BasePlugin + +class Plugin(BasePlugin): + def init(self): + self.api.add_event_handler('muc_say', self.add_spaces) + self.api.add_event_handler('conversation_say', self.add_spaces) + self.api.add_event_handler('private_say', self.add_spaces) + + def add_spaces(self, msg, tab): + msg['body'] = " ".join(x for x in msg['body']) -- cgit v1.2.3