patch b2ed84c15eb61138a3ed6f39254b54a2e9536345 Author: E. Bosch Date: Wed Feb 17 02:53:21 CET 2021 * irc: Improve the parsing Recognize commands case insensitive: the RFCs are not very concise about this and I don't know about clients sending commands in lower case but just in case and it won't hurt Line terminator: according RFCs should be \r\n but some clients only send \n, I was confused about this but the parser must be robust and now any combination of \r and \n is recognized diff -rN -u old-irgramd/irc.py new-irgramd/irc.py --- old-irgramd/irc.py 2024-11-23 02:17:06.708021598 +0100 +++ new-irgramd/irc.py 2024-11-23 02:17:06.708021598 +0100 @@ -23,7 +23,7 @@ # IRC Regular Expressions -PREFIX = r'(:[^ ]+ +|)' +PREFIX = r'(?ai)(:[^ ]+ +|)' IRC_JOIN_RX = re.compile(PREFIX + r'JOIN( +:| +|\n)(?P[^\n]+|)') IRC_NAMES_RX = re.compile(PREFIX + r'NAMES( +:| +|\n)(?P[^\n]+|)') IRC_NICK_RX = re.compile(PREFIX + r'NICK( +:| +|\n)(?P[^\n]+|)') @@ -62,7 +62,7 @@ user.del_from_channels(self) del user break - message = message.decode() + message = message.decode().replace('\r','\n') self.logger.debug(message) for pattern, handler, register_required in self.irc_handlers: