From 3c688335af10db87ee59955b25fd97425151cb01 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 1 Apr 2014 23:04:10 +0200 Subject: Fix #2453 (malformed stanzas with stupid plugins) remove xhtml prior to performing stuff --- plugins/capslock.py | 3 ++- plugins/revstr.py | 3 ++- plugins/shuffle.py | 3 ++- plugins/spaces.py | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/capslock.py b/plugins/capslock.py index 1b9aafb7..87200ade 100644 --- a/plugins/capslock.py +++ b/plugins/capslock.py @@ -2,6 +2,7 @@ Once loaded, everything you will send will be IN CAPITAL LETTERS. """ from plugin import BasePlugin +import xhtml class Plugin(BasePlugin): def init(self): @@ -10,4 +11,4 @@ class Plugin(BasePlugin): self.api.add_event_handler('private_say', self.caps) def caps(self, msg, tab): - msg['body'] = msg['body'].upper() + msg['body'] = xhtml.clean_text(msg['body']).upper() diff --git a/plugins/revstr.py b/plugins/revstr.py index 4ca154b7..53838257 100644 --- a/plugins/revstr.py +++ b/plugins/revstr.py @@ -3,6 +3,7 @@ Reverse everything you say (``Je proteste énergiquement`` will become ``tnemeuqigrené etsetorp eJ``) """ from plugin import BasePlugin +import xhtml class Plugin(BasePlugin): def init(self): @@ -11,4 +12,4 @@ class Plugin(BasePlugin): self.api.add_event_handler('private_say', self.revstr) def revstr(self, msg, tab): - msg['body'] = msg['body'][::-1] + msg['body'] = xhtml.clean_text(msg['body'])[::-1] diff --git a/plugins/shuffle.py b/plugins/shuffle.py index e4fc81c8..3a961bae 100644 --- a/plugins/shuffle.py +++ b/plugins/shuffle.py @@ -4,12 +4,13 @@ Shuffle the words in every message you send in a :ref:`muctab` """ from plugin import BasePlugin from random import shuffle +import xhtml class Plugin(BasePlugin): def init(self): self.api.add_event_handler('muc_say', self.shuffle) def shuffle(self, msg, tab): - split = msg['body'].split() + split = xhtml.clean_text(msg['body']).split() shuffle(split) msg['body'] = ' '.join(split) diff --git a/plugins/spaces.py b/plugins/spaces.py index 7885ede6..dc6197ee 100644 --- a/plugins/spaces.py +++ b/plugins/spaces.py @@ -3,6 +3,7 @@ Insert a space between each character, in messages that you send, making them horrible to read. """ from plugin import BasePlugin +import xhtml class Plugin(BasePlugin): def init(self): @@ -11,4 +12,4 @@ class Plugin(BasePlugin): 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']) + msg['body'] = " ".join(x for x in xhtml.clean_text(msg['body'])) -- cgit v1.2.3