summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-06-19 23:04:18 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-06-19 23:04:18 +0100
commit4aa6e8eeba2dbdf567cc9abfa4a7421d7e5ce3ed (patch)
tree5ba95a6f82c5e31fd2ee0d1cac26af5e763557c7 /plugins
parentffb8bbe63f9f367ee91b0b50f46d9539a504c48b (diff)
downloadpoezio-4aa6e8eeba2dbdf567cc9abfa4a7421d7e5ce3ed.tar.gz
poezio-4aa6e8eeba2dbdf567cc9abfa4a7421d7e5ce3ed.tar.bz2
poezio-4aa6e8eeba2dbdf567cc9abfa4a7421d7e5ce3ed.tar.xz
poezio-4aa6e8eeba2dbdf567cc9abfa4a7421d7e5ce3ed.zip
Add a rstrip plugin.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/rstrip.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/rstrip.py b/plugins/rstrip.py
new file mode 100644
index 00000000..3661cf2a
--- /dev/null
+++ b/plugins/rstrip.py
@@ -0,0 +1,13 @@
+"""
+Once loaded, every line of your messages will be stripped of their trailing spaces.
+"""
+from poezio.plugin import BasePlugin
+
+class Plugin(BasePlugin):
+ def init(self):
+ self.api.add_event_handler('muc_say', self.rstrip)
+ self.api.add_event_handler('conversation_say', self.rstrip)
+ self.api.add_event_handler('private_say', self.rstrip)
+
+ def rstrip(self, msg, tab):
+ msg['body'] = '\n'.join(line.rstrip() for line in msg['body'].split('\n'))