mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
relay: don't error if the WHOIS target isn't a relay user... oops
This commit is contained in:
parent
88c85c8475
commit
44e07b0c2f
@ -82,8 +82,10 @@ def handle_whois(irc, source, command, args):
|
||||
# Iterate over plugin-created WHOIS handlers. They return a tuple
|
||||
# or list with two arguments: the numeric, and the text to send.
|
||||
for func in utils.whois_handlers:
|
||||
num, text = func(irc, target)
|
||||
f(irc, server, num, source, text)
|
||||
res = func(irc, target)
|
||||
if res:
|
||||
num, text = res
|
||||
f(irc, server, num, source, text)
|
||||
except Exception as e:
|
||||
# Again, we wouldn't want this to crash our service, in case
|
||||
# something goes wrong!
|
||||
|
@ -17,11 +17,13 @@ relayusers = defaultdict(dict)
|
||||
|
||||
def relayWhoisHandlers(irc, target):
|
||||
user = irc.users[target]
|
||||
network, remoteuid = getLocalUser(irc, target)
|
||||
remotenick = utils.networkobjects[network].users[remoteuid].nick
|
||||
return [320, "%s :is a remote user connected via PyLink Relay. Home "
|
||||
"network: %s; Home nick: %s" % (user.nick, network,
|
||||
remotenick)]
|
||||
orig = getLocalUser(irc, target)
|
||||
if orig:
|
||||
network, remoteuid = orig
|
||||
remotenick = utils.networkobjects[network].users[remoteuid].nick
|
||||
return [320, "%s :is a remote user connected via PyLink Relay. Home "
|
||||
"network: %s; Home nick: %s" % (user.nick, network,
|
||||
remotenick)]
|
||||
utils.whois_handlers.append(relayWhoisHandlers)
|
||||
|
||||
def normalizeNick(irc, netname, nick, separator=None):
|
||||
|
Loading…
Reference in New Issue
Block a user