patch ba3e7dc07a05acfd34ca1f04ce176d0e1e48a03f Author: E. Bosch Date: Tue Nov 24 23:25:57 CET 2020 * irc: Improve the regular expresions for command parsing diff -rN -u old-irgramd/irc.py new-irgramd/irc.py --- old-irgramd/irc.py 2024-11-23 10:15:24.686868895 +0100 +++ new-irgramd/irc.py 2024-11-23 10:15:24.690868889 +0100 @@ -13,12 +13,13 @@ # IRC Regular Expressions -IRC_NICK_RX = re.compile(r'NICK :(?P[^\n\r]+)') -IRC_PASS_RX = re.compile(r'PASS :(?P[^\s]+) (?P[^\n\r]+)') -IRC_PING_RX = re.compile(r'PING (?P[^\n\r]+)') -IRC_PRIVMSG_RX = re.compile(r'PRIVMSG (?P[^\s]+) :(?P[^\n\r]+)') -IRC_USER_RX = re.compile(r'USER (?P[^\s]+) [^\s]+ [^\s]+ :(?P[^\n\r]+)') -IRC_JOIN_RX = re.compile(r'JOIN (?P[^\s]+)') +PREFIX = r'(:[^ ]+ +|)' +IRC_NICK_RX = re.compile(PREFIX + r'NICK +(:|)(?P[^\n\r]+)') +IRC_PASS_RX = re.compile(PREFIX + r'PASS +(:|)(?P[^\n\r]+)') +IRC_PING_RX = re.compile(PREFIX + r'PING +(:|)(?P[^\n\r]+)') +IRC_PRIVMSG_RX = re.compile(PREFIX + r'PRIVMSG +(?P[^ ]+) +(:|):(?P[^\n\r]+)') +IRC_USER_RX = re.compile(PREFIX + r'USER +(?P[^ ]+) +[^ ]+ +[^ ]+ +(:|)(?P[^\n\r]+)') +IRC_JOIN_RX = re.compile(PREFIX + r'JOIN +(?P[^ ]+)') # IRC Handler