From b7027e53474c208d7b772794fd34b30092bc4df1 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 6 Nov 2011 23:46:35 +0100 Subject: Super-useful figlet plugin --- plugins/figlet.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugins/figlet.py (limited to 'plugins/figlet.py') diff --git a/plugins/figlet.py b/plugins/figlet.py new file mode 100644 index 00000000..ccff687a --- /dev/null +++ b/plugins/figlet.py @@ -0,0 +1,11 @@ +from plugin import BasePlugin +import subprocess + +class Plugin(BasePlugin): + def init(self): + self.add_poezio_event_handler('muc_say', self.figletize) + + def figletize(self, msg): + process = subprocess.Popen(['figlet', msg['body']], stdout=subprocess.PIPE) + result = process.communicate()[0].decode('utf-8') + msg['body'] = result -- cgit v1.2.3 From 934006e2e90f70009a6ff354ee4f4541cc5b47fc Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 7 Nov 2011 23:37:16 +0100 Subject: Activate figlet plugin in private and conversation tabs --- plugins/figlet.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins/figlet.py') diff --git a/plugins/figlet.py b/plugins/figlet.py index ccff687a..cf885352 100644 --- a/plugins/figlet.py +++ b/plugins/figlet.py @@ -4,6 +4,8 @@ import subprocess class Plugin(BasePlugin): def init(self): self.add_poezio_event_handler('muc_say', self.figletize) + self.add_poezio_event_handler('conversation_say', self.figletize) + self.add_poezio_event_handler('private_say', self.figletize) def figletize(self, msg): process = subprocess.Popen(['figlet', msg['body']], stdout=subprocess.PIPE) -- cgit v1.2.3