3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-11 12:42:34 +01:00

networks: throw a proper error in 'remote' if the remote network isn't connected

This commit is contained in:
James Lu 2017-09-05 18:55:19 -07:00
parent 8420587318
commit 7188081511

View File

@ -89,7 +89,7 @@ def remote(irc, source, args):
try:
remoteirc = world.networkobjects[netname]
except KeyError: # Unknown network.
irc.error('No such network "%s" (case sensitive).' % netname)
irc.error('No such network %r (case sensitive).' % netname)
REMOTE_IN_USE.clear()
return
@ -97,6 +97,10 @@ def remote(irc, source, args):
irc.error('Unknown service %r.' % args.service)
REMOTE_IN_USE.clear()
return
elif not remoteirc.connected.is_set():
irc.error('Network %r is not connected.' % netname)
REMOTE_IN_USE.clear()
return
# Force remoteirc.called_in to something private in order to prevent
# accidental information leakage from replies.