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
1 changed files with 2 additions and 2 deletions

View File

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