irclib: Make NestedCommandsIrcProxy._replyOverhead count in bytes instead of chars

It was, once again, a bug to count characters, because they
might contain multi-byte characters, and truncation happens
after the 512th byte.
This commit is contained in:
Valentin Lorentz 2021-03-13 15:05:15 +01:00
parent 8a3efe4379
commit de29218bdb

View File

@ -956,9 +956,9 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
Ignores tag bytes, as they are accounted for separatly."""
overhead = (
len(':')
+ len(self.irc.prefix)
+ len(self.irc.prefix.encode())
+ len(' PRIVMSG ')
+ len(target)
+ len(target.encode())
+ len(' :')
+ len('\r\n')
)