Add a rstrip plugin.
This commit is contained in:
parent
ffb8bbe63f
commit
4aa6e8eeba
1 changed files with 13 additions and 0 deletions
13
plugins/rstrip.py
Normal file
13
plugins/rstrip.py
Normal file
|
@ -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'))
|
Loading…
Reference in a new issue