Browse Source

fix encode crash on irc notice

master
undeath 7 years ago
parent
commit
9ce9ee5fec
  1. 13
      jmdaemon/jmdaemon/irc.py

13
jmdaemon/jmdaemon/irc.py

@ -19,11 +19,20 @@ log = get_log()
def wlog(*x):
"""Simplifier to add lists to the debug log
"""
def conv(s):
# note: this only works because of the future package
if isinstance(s, str):
return s
elif isinstance(s, bytes):
return s.decode('utf-8', errors='ignore')
else:
return str(s)
if x[0] == "WARNING":
msg = " ".join([str(a) for a in x[1:]])
msg = " ".join([conv(a) for a in x[1:]])
log.warn(msg)
else:
msg = " ".join([str(a) for a in x])
msg = " ".join([conv(a) for a in x])
log.debug(msg)
def get_irc_text(line):

Loading…
Cancel
Save