3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-02-17 14:01:03 +01:00

networks: don't allow disconnecting servers marked virtual-server

This commit is contained in:
James Lu 2019-06-23 17:43:12 -07:00
parent c5b94cdf21
commit 957697d275

View File

@ -27,10 +27,14 @@ def disconnect(irc, source, args):
except KeyError: # Unknown network.
irc.error('No such network "%s" (case sensitive).' % netname)
return
irc.reply("Done. If you want to reconnect this network, use the 'rehash' command.")
log.info('Disconnecting network %r per %s', netname, irc.get_hostmask(source))
if network.has_cap('virtual-server'):
irc.error('"%s" is a virtual server and cannot be directly disconnected.' % netname)
return
log.info('Disconnecting network %r per %s', netname, irc.get_hostmask(source))
control.remove_network(network)
irc.reply("Done. If you want to reconnect this network, use the 'rehash' command.")
@utils.add_cmd
def autoconnect(irc, source, args):