From d9a01629cd7dfcd39ee171afcad6dd1604d9d078 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 27 Dec 2015 19:58:14 +0000 Subject: [PATCH] Fix bytes count in message splitting. --- src/callbacks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/callbacks.py b/src/callbacks.py index e198b54a6..4a109f3bf 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -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