3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

core: make message cutoff optional, and disable for inspircd

Closes #490.
This commit is contained in:
James Lu 2017-07-16 18:46:56 -07:00
parent d1b321310e
commit c7c29f35e5
2 changed files with 7 additions and 1 deletions

View File

@ -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)

View File

@ -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)