def who(self, sock, source, mask): if mask.startswith("#"): if mask not in self.channels: return self.fire(reply(sock, ERR_NOSUCHCHANNEL(mask))) channel = self.channels[mask] for user in channel.users: self.fire(reply(sock, RPL_WHOREPLY(user, mask, self.host))) self.fire(reply(sock, RPL_ENDOFWHO(mask))) else: if mask not in self.nicks: return self.fire(reply(sock, ERR_NOSUCHNICK(mask))) user = self.nicks[mask] self.fire(reply(sock, RPL_WHOREPLY(user, mask, self.host))) self.fire(reply(sock, RPL_ENDOFWHO(mask)))