From a2a32ed32f3843a92f7cbe2a039ff5615c946add Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 23 Sep 2017 21:54:02 -0700 Subject: [PATCH] clientbot: wrap outgoing modes to prevent cutoff --- protocols/clientbot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/protocols/clientbot.py b/protocols/clientbot.py index 220b84d..e5eb627 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -242,8 +242,10 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): log.debug('(%s) mode: filtered modes for %s: %s', self.name, channel, extmodes) if extmodes: - self.send('MODE %s %s' % (channel, self.join_modes(extmodes))) - # Don't update the state here: the IRCd sill respond with a MODE reply if successful. + bufsize = self.S2S_BUFSIZE - len(':%s MODE %s ' % (self.get_hostmask(self.pseudoclient.uid), channel)) + for msg in self.wrap_modes(extmodes, bufsize, max_modes_per_msg=int(self._caps.get('MODES', 0))): + self.send('MODE %s %s' % (channel, msg)) + # Don't update the state here: the IRCd sill respond with a MODE reply if successful. def nick(self, source, newnick): """STUB: Sends NICK changes."""