Fix bytes count in message splitting.

This commit is contained in:
Valentin Lorentz 2015-12-27 19:58:14 +00:00
parent 876af3dfd5
commit d9a01629cd

View File

@ -906,7 +906,9 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
log.warning('Truncating to %s bytes from %s bytes.',
maximumLength, len(s))
s = s[:maximumLength]
if len(s) < allowedLength or \
s_too_long = len(s.encode()) < allowedLength \
if minisix.PY3 else len(s) < allowedLength
if s_too_long or \
not conf.get(conf.supybot.reply.mores, target):
# In case we're truncating, we add 20 to allowedLength,
# because our allowedLength is shortened for the