From d571926fd5589e5ddccee30cbf3442dc2b0d79b8 Mon Sep 17 00:00:00 2001 From: urlbot Date: Wed, 29 Oct 2014 13:25:09 +0100 Subject: [PATCH] chat_write: don't print strange chars; get_reply_data: strip \n --- plugins.py | 2 +- urlbot.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins.py b/plugins.py index 27d67ce..e97a084 100644 --- a/plugins.py +++ b/plugins.py @@ -25,7 +25,7 @@ def get_reply_data(data, field=0): else: if field > len(f): return None - return f[field] + return f[field].strip('\n') def register_event(t, callback, args): joblist.append((t, callback, args)) diff --git a/urlbot.py b/urlbot.py index b4328db..9f80fd1 100755 --- a/urlbot.py +++ b/urlbot.py @@ -83,6 +83,11 @@ def extract_title(url): def chat_write(message, prefix='/say '): set_conf('request_counter', conf('request_counter') + 1) + for m in message: + if 0x20 > ord(m): + logger('warn', 'strange char 0x%02x in chat_write(message), skipping' % ord(m)) + return False + if debug_enabled(): print(message) else: