3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-02-26 02:10:39 +01:00

relay: don't error if the WHOIS target isn't a relay user... oops

This commit is contained in:
James Lu 2015-07-23 00:10:54 -07:00
parent 88c85c8475
commit 44e07b0c2f
2 changed files with 11 additions and 7 deletions

View File

@ -82,8 +82,10 @@ def handle_whois(irc, source, command, args):
# Iterate over plugin-created WHOIS handlers. They return a tuple # Iterate over plugin-created WHOIS handlers. They return a tuple
# or list with two arguments: the numeric, and the text to send. # or list with two arguments: the numeric, and the text to send.
for func in utils.whois_handlers: for func in utils.whois_handlers:
num, text = func(irc, target) res = func(irc, target)
f(irc, server, num, source, text) if res:
num, text = res
f(irc, server, num, source, text)
except Exception as e: except Exception as e:
# Again, we wouldn't want this to crash our service, in case # Again, we wouldn't want this to crash our service, in case
# something goes wrong! # something goes wrong!

View File

@ -17,11 +17,13 @@ relayusers = defaultdict(dict)
def relayWhoisHandlers(irc, target): def relayWhoisHandlers(irc, target):
user = irc.users[target] user = irc.users[target]
network, remoteuid = getLocalUser(irc, target) orig = getLocalUser(irc, target)
remotenick = utils.networkobjects[network].users[remoteuid].nick if orig:
return [320, "%s :is a remote user connected via PyLink Relay. Home " network, remoteuid = orig
"network: %s; Home nick: %s" % (user.nick, network, remotenick = utils.networkobjects[network].users[remoteuid].nick
remotenick)] 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) utils.whois_handlers.append(relayWhoisHandlers)
def normalizeNick(irc, netname, nick, separator=None): def normalizeNick(irc, netname, nick, separator=None):