patch ea8cab114202439713c9d3d5040a91bb376f1d8f Author: E. Bosch Date: Wed Nov 17 21:49:05 CET 2021 * irc: add USERHOST command diff -rN -u old-irgramd/irc.py new-irgramd/irc.py --- old-irgramd/irc.py 2024-10-23 04:31:39.783438000 +0200 +++ new-irgramd/irc.py 2024-10-23 04:31:39.783438000 +0200 @@ -37,6 +37,7 @@ IRC_QUIT_RX = re.compile(PREFIX + r'QUIT( +:| +|\n)(?P[^\n]+|)') IRC_TOPIC_RX = re.compile(PREFIX + r'TOPIC( +:| +|\n)(?P[^\n ]+|)') IRC_USER_RX = re.compile(PREFIX + r'USER( +|\n)(?P[^ ]+) +[^ ]+ +[^ ]+( +:| +|\n)(?P[^\n]+|)') +IRC_USERHOST_RX = re.compile(PREFIX + r'USERHOST( +|\n)(?P[^ ]+( +|\n)|)(?P[^ ]+( +|\n)|)(?P[^ ]+( +|\n)|)(?P[^ ]+( +|\n)|)(?P[^\n]+|)') IRC_VERSION_RX = re.compile(PREFIX + r'VERSION( +:| +|\n)(?P[^\n ]+|)') IRC_WHO_RX = re.compile(PREFIX + r'WHO( +:| +|\n)(?P[^\n ]+|)') IRC_WHOIS_RX = re.compile(PREFIX + r'WHOIS( +:| +|\n)(?P[^\n ]+|)') @@ -116,6 +117,7 @@ (IRC_QUIT_RX, self.handle_irc_quit, False, 0), (IRC_TOPIC_RX, self.handle_irc_topic, True, ALL_PARAMS), (IRC_USER_RX, self.handle_irc_user, False, ALL_PARAMS), + (IRC_USERHOST_RX, self.handle_irc_userhost, True, 1), (IRC_VERSION_RX, self.handle_irc_version, True, 0), (IRC_WHO_RX, self.handle_irc_who, True, ALL_PARAMS), (IRC_WHOIS_RX, self.handle_irc_whois, True, ALL_PARAMS), @@ -168,6 +170,23 @@ else: await self.reply_code(user, 'ERR_PASSWDMISMATCH') + async def handle_irc_userhost(self, user, **nicks): + niv = nicks.values() + self.logger.debug('Handling USERHOST: %s', str(tuple(niv))) + + reply = '' + sep = '' + away = '+' + for ni in niv: + n = ni.lower() + if n in self.users.keys(): + usr = self.users[n] + oper = '*' if usr.oper else '' + reply += '{}{}{}={}{}@{}'.format(sep, usr.irc_nick, oper, away, usr.irc_username, usr.address) + if not sep: sep = ' ' + if reply: + await self.reply_code(user, 'RPL_USERHOST', (reply,)) + async def handle_irc_user(self, user, username, realname): self.logger.debug('Handling USER: %s, %s', username, realname) diff -rN -u old-irgramd/irc_replies.py new-irgramd/irc_replies.py --- old-irgramd/irc_replies.py 2024-10-23 04:31:39.783438000 +0200 +++ new-irgramd/irc_replies.py 2024-10-23 04:31:39.783438000 +0200 @@ -7,6 +7,7 @@ 'RPL_MYINFO': ('004', '{} irgramd-{} oS nt'), 'RPL_ISUPPORT': ('005', 'CASEMAPPING=ascii CHANLIMIT=#&+: CHANTYPES=&#+ CHANMODES=,,,nt CHANNELLEN={} NICKLEN={} SAFELIST :are supported by this server'), 'RPL_UMODEIS': ('221', ':{}'), + 'RPL_USERHOST': ('302', ':{}'), 'RPL_WHOISUSER': ('311', '{} {} {} * :{}'), 'RPL_WHOISSERVER': ('312', '{} {} :irgramd gateway'), 'RPL_WHOISOPERATOR': ('313', '{} :is an irgramd operator'),