diff --git a/classes.py b/classes.py index e39189a..8bdebd4 100644 --- a/classes.py +++ b/classes.py @@ -1355,7 +1355,10 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils): # Safeguard against newlines in input!! Otherwise, each line gets # treated as a separate command, which is particularly nasty. data = data.replace('\n', ' ') - encoded_data = data.encode(self.encoding, 'replace')[:self.S2S_BUFSIZE] + b"\r\n" + encoded_data = data.encode(self.encoding, 'replace') + if self.S2S_BUFSIZE > 0: # Apply message cutoff as needed + encoded_data = encoded_data[:self.S2S_BUFSIZE] + encoded_data += b"\r\n" log.debug("(%s) -> %s", self.name, data) diff --git a/protocols/inspircd.py b/protocols/inspircd.py index dee673b..c69f1b1 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -11,6 +11,9 @@ from pylinkirc.log import log from pylinkirc.protocols.ts6_common import * class InspIRCdProtocol(TS6BaseProtocol): + + S2S_BUFSIZE = 0 # InspIRCd allows infinitely long S2S messages, so set bufsize to infinite + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)