irc: add USERHOST command
patch ea8cab114202439713c9d3d5040a91bb376f1d8f
Author: E. Bosch <presidev@AT@gmail.com>
Date: Wed Nov 17 21:49:05 CET 2021
* irc: add USERHOST command
hunk ./irc.py 40
+IRC_USERHOST_RX = re.compile(PREFIX + r'USERHOST( +|\n)(?P<nick1>[^ ]+( +|\n)|)(?P<nick2>[^ ]+( +|\n)|)(?P<nick3>[^ ]+( +|\n)|)(?P<nick4>[^ ]+( +|\n)|)(?P<nick5>[^\n]+|)')
hunk ./irc.py 120
+ (IRC_USERHOST_RX, self.handle_irc_userhost, True, 1),
hunk ./irc.py 173
+ 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,))
+
hunk ./irc_replies.py 10
+ 'RPL_USERHOST': ('302', ':{}'),