boobot: Better newline handling

This commit is contained in:
Laurent Bachelier 2013-05-05 20:53:21 +02:00
commit 8825072829

View file

@ -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