if self.parent.cfg.getboolean('erebus', 'nofakelag'): return self.fastmsg(target, msg)
cmd = self._formatmsg(target, msg)
- if len(cmd) > self.conn.recvq:
+ # The max length is much shorter than recvq (510) because of the length the server adds on about the source (us).
+ # If you know your hostmask, you can of course figure the exact length, but it's very difficult to reliably know your hostmask.
+ maxlen = (
+ self.conn.recvq
+ - 63 # max hostname len
+ - 11 # max ident len
+ - 3 # the symbols in :nick!user@host
+ - len(self.nick)
+ )
+ if len(cmd) > maxlen:
if not truncate:
return False
else:
- cmd = cmd[:self.conn.recvq]
+ cmd = cmd[:maxlen]
if self.conn.exceeded or self.conn.bytessent+len(cmd) >= self.conn.recvq:
append_callback(cmd)
self.state = 0 # 0=disconnected, 1=registering, 2=connected
self.bytessent = 0
- self.recvq = 400
+ self.recvq = 510
self.exceeded = False
self._nowrite = False