chat_write: don't print strange chars; get_reply_data: strip \n

This commit is contained in:
urlbot
2014-10-29 13:25:09 +01:00
parent e85cc3a148
commit d571926fd5
2 changed files with 6 additions and 1 deletions

View File

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

View File

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