From 882507282925d8529920e244c9567cbc464f1d91 Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Sun, 5 May 2013 20:53:21 +0200 Subject: [PATCH] boobot: Better newline handling --- contrib/boobot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/boobot.py b/contrib/boobot.py index 0325c52b..a198390a 100755 --- a/contrib/boobot.py +++ b/contrib/boobot.py @@ -104,7 +104,8 @@ class BoobotBrowser(StandardBrowser): encoding = EncodingFinder('windows-1252').encoding(r).lower().replace('iso-8859-1', 'windows-1252') h = self.get_document(r, parser='lxml', encoding=encoding) for title in h.xpath('//head/title'): - title = to_unicode(title.text_content()) + title = to_unicode(title.text_content()).strip() + title = ' '.join(title.splitlines()) return content_type, hsize, title def human_size(self, size): @@ -194,7 +195,8 @@ class Boobot(SingleServerIRCBot): self.joined[channel].set() def send_message(self, msg, channel=None): - self.connection.privmsg(channel or self.mainchannel, msg) + for m in msg.splitlines(): + self.connection.privmsg(channel or self.mainchannel, m) def on_pubmsg(self, c, event): # irclib 5.0 compatibility