3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

handlers: handle WHOIS requests to unknown nicks instead of warning

"/whois pylink.server badnick" is allowed everywhere except InspIRCd.
This commit is contained in:
James Lu 2016-07-11 15:58:18 -07:00
parent 8e29e16144
commit 6a1349847f

View File

@ -9,12 +9,15 @@ def handle_whois(irc, source, command, args):
"""Handle WHOIS queries, for IRCds that send them across servers (charybdis, UnrealIRCd; NOT InspIRCd)."""
target = args['target']
user = irc.users.get(target)
if user is None:
log.warning('(%s) Got a WHOIS request for %r from %r, but the target '
'doesn\'t exist in irc.users!', irc.name, target, source)
return
f = irc.proto.numeric
server = irc.sid
if user is None: # User doesn't exist
# <- :42X 401 7PYAAAAAB GL- :No such nick/channel
nick = target
f(server, 401, source, "%s :No such nick/channel" % nick)
else:
nick = user.nick
sourceisOper = ('o', None) in irc.users[source].modes
sourceisBot = (irc.umodes.get('bot'), None) in irc.users[source].modes