From 1dd463782061a7c3ddace24ffce9dc9b0d01aac7 Mon Sep 17 00:00:00 2001 From: urlbot Date: Tue, 2 Dec 2014 16:25:10 +0100 Subject: [PATCH] fix chat_write() --- urlbot.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/urlbot.py b/urlbot.py index 24b4706..7508398 100755 --- a/urlbot.py +++ b/urlbot.py @@ -112,18 +112,9 @@ def chat_write(message): if debug_enabled(): print(message) else: - # FIXME: somehow, unicode chars can end up inside a message, - # which seems to make both unicode() and ''.encode('utf8') fail. - try: - msg = str(message) - msg = msg.encode('utf8') - except UnicodeDecodeError as e: - logger('warn', 'encoding msg failed: ' + str(e)) - msg = message - xmpp.send_message( mto=conf('room'), - mbody=msg, + mbody=message, mtype='groupchat' ) @@ -276,8 +267,7 @@ class bot(ClientXMPP): ) def muc_message(self, msg): - print(msg['mucnick']) - print(msg['body']) + print('%10s: %s' % (msg['mucnick'], msg['body'])) # don't talk to yourself if msg['mucnick'] == self.nick: