From cdaad47b136da1e04e0b84be3be621bf8117e9ed Mon Sep 17 00:00:00 2001 From: nemunaire Date: Wed, 24 Sep 2014 10:53:16 +0200 Subject: [PATCH] Ensure multiline message after line_treat are collapsed to one line --- modules/mediawiki.py | 1 + response.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/mediawiki.py b/modules/mediawiki.py index 8f6494b..47e282c 100644 --- a/modules/mediawiki.py +++ b/modules/mediawiki.py @@ -80,6 +80,7 @@ def cmd_mediawiki(msg): raise IRCException("indicate a domain and a term to search") return Response(get_page(msg.cmds[1], " ".join(msg.cmds[2:])), + line_treat=lambda line: irc_format(parse_wikitext(msg.cmds[1], line)), channel=msg.receivers) diff --git a/response.py b/response.py index 5990b16..fb83bf9 100644 --- a/response.py +++ b/response.py @@ -130,7 +130,7 @@ class Response: return self.treat_ctcp(self.nomore) if self.line_treat is not None and self.elt == 0: - self.messages[0] = self.line_treat(self.messages[0]) + self.messages[0] = self.line_treat(self.messages[0]).replace("\n", " ").strip() msg = "" if self.channel is not None and self.nick is not None: