irc: Add LIST command
patch d4fcf2fabedea7d242e06b126876f63646faf1e7
Author: E. Bosch <presidev@AT@gmail.com>
Date: Wed Nov 24 00:27:12 CET 2021
* irc: Add LIST command
hunk ./irc.py 29
+IRC_LIST_RX = re.compile(PREFIX + r'LIST( +:| +|\n)(?P<channels>[^\n ]+|)')
hunk ./irc.py 110
+ (IRC_LIST_RX, self.handle_irc_list, True, 0),
hunk ./irc.py 228
+ async def handle_irc_list(self, user, channels):
+ self.logger.debug('Handling LIST: %s', channels)
+ entity_cache = [None]
+
+ if channels:
+ chans = channels.split(',')
+ else:
+ chans = self.irc_channels.keys()
+
+ await self.reply_code(user, 'RPL_LISTSTART')
+ for channel in chans:
+ chan = channel.lower()
+ if chan in self.irc_channels.keys():
+ real_chan = self.get_realcaps_name(chan)
+ users_count = len(self.irc_channels[chan])
+ topic = await self.tg.get_channel_topic(chan, entity_cache)
+ await self.reply_code(user, 'RPL_LIST', (real_chan, users_count, topic))
+ await self.reply_code(user, 'RPL_LISTEND')
+
hunk ./irc_replies.py 18
+ 'RPL_LISTSTART': ('321', 'Channel :Users Name'),
+ 'RPL_LIST': ('322', '{} {} :{}'),
+ 'RPL_LISTEND': ('323', ':End of /LIST'),