def who(self, _, line): """Process a WHO response, updating the corresponding user object.""" if len(line.params) < 8: # Some bizarre RFC breaking server _logger.warning("Malformed WHO from server") return channel = line.params[1] username = line.params[2] host = line.params[3] server = line.params[4] nick = line.params[5] flags = who_flag_parse(line.params[6]) other = line.params[7] # TODO: find something to do with this stuff # pylint: disable=unused-variable hopcount, _, other = other.partition(' ') user = self.get_user(nick) if not user: return isupport = self.base.isupport if isupport.get("RFC2812"): # IRCNet, for some stupid braindead reason, sends SID here. Why? I # don't know. They mentioned it might break clients in the commit # log. I really have no idea why it exists, why it's useful to # anyone, or anything like that. But honestly, WHO sucks enough... sid, _, gecos = other.partition(' ') else: sid = None gecos = other if channel != '*': # Convert symbols to modes prefix = prefix_parse(isupport.get("PREFIX")).prefix_to_mode mode = set() for char in flags.modes: char = prefix.get(char) if char is not None: mode.add(char) user.channels[channel] = mode away = flags.away operator = flags.operator # NB - these two members aren't guaranteed to exist (yet?) user.sid = sid user.server = server user.username = username user.host = host user.gecos = gecos user.away = away user.operator = operator
def whox(self, event): if len(event.line.params) != 12: # Not from us! return whoxid = event.line.params[1] channel = event.line.params[2] username = event.line.params[3] ip = event.line.params[4] host = event.line.params[5] server = event.line.params[6] nick = event.line.params[7] flags = who_flag_parse(event.line.params[8]) # idle = event.line.params[9] account = event.line.params[10] gecos = event.line.params[11] user = self.get_user(nick) if not user: return if whoxid not in self.whox_send: # Not sent by us, weird! return if channel != '*': # Convert symbols to modes isupport = self.get_extension("ISupport") prefix = prefix_parse(isupport.get("PREFIX")).prefix_to_mode mode = set() for char in flags.modes: char = prefix.get(char) if char is not None: mode.add(char) user.channels[channel] = mode away = flags.away operator = flags.operator if account == '0': # Not logged in account = '' if ip == '255.255.255.255': # Cloaked ip = None user.username = username user.host = host user.server = server user.gecos = gecos user.away = away user.operator = operator user.account = account user.ip = ip
def whox(self, _, line): """Process a WHOX response, updating the corresponding user object.""" if len(line.params) != 12: # Not from us! return # Verify the server supports WHOX for real because Bahamut has its own # Eldritch abomination we don't support (RWHO... you don't wanna know) isupport = self.base.isupport if not isupport.get("WHOX"): return whoxid = line.params[1] channel = line.params[2] username = line.params[3] ip_ = line.params[4] host = line.params[5] server = line.params[6] nick = line.params[7] flags = who_flag_parse(line.params[8]) idle = line.params[9] account = line.params[10] gecos = line.params[11] user = self.get_user(nick) if not user: return if whoxid not in self.whox_send: # Not sent by us, weird! return if channel != '*': # Convert symbols to modes prefix = prefix_parse(isupport.get("PREFIX")).prefix_to_mode mode = set() for char in flags.modes: char = prefix.get(char) if char is not None: mode.add(char) user.channels[channel] = mode away = flags.away operator = flags.operator if account == '0': # Not logged in account = '' if ip_ == '255.255.255.255': # Cloaked ip_ = None user.server = server user.idle = idle user.username = username user.host = host user.server = server user.gecos = gecos user.away = away user.operator = operator user.account = account user.ip = ip_
def who(self, event): if len(event.line.params) < 8: # Some bizarre RFC breaking server logger.warn("Malformed WHO from server") return channel = event.line.params[1] username = event.line.params[2] host = event.line.params[3] server = event.line.params[4] nick = event.line.params[5] flags = who_flag_parse(event.line.params[6]) other = event.line.params[7] hopcount, _, other = other.partition(' ') user = self.get_user(nick) if not user: return isupport = self.get_extension("ISupport") if isupport.get("RFC2812"): # IRCNet, for some stupid braindead reason, sends SID here. Why? I # don't know. They mentioned it might break clients in the commit # log. I really have no idea why it exists, why it's useful to # anyone, or anything like that. But honestly, WHO sucks enough... sid, _, realname = other.partition(' ') else: sid = None realname = other if channel != '*': # Convert symbols to modes prefix = prefix_parse(isupport.get("PREFIX")).prefix_to_mode mode = set() for char in flags.modes: char = prefix.get(char) if char is not None: mode.add(char) user.channels[channel] = mode away = flags.away operator = flags.operator if account == '0': # Not logged in account = '' if ip == '255.255.255.255': # Cloaked ip = None user.username = username user.host = host user.gecos = gecos user.away = away user.operator = operator user.account = account user.ip = ip