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

networks: unconditionally remove disconnected IRC objects

This commit is contained in:
James Lu 2016-07-01 19:54:19 -07:00
parent eb7aae9634
commit da4da91ef9

View File

@ -20,13 +20,16 @@ def disconnect(irc, source, args):
except KeyError: # Unknown network.
irc.reply('Error: No such network "%s" (case sensitive).' % netname)
return
irc.reply("Done.")
irc.reply("Done. If you want to reconnect this network, use the 'rehash' command.")
# Abort the connection! Simple as that.
# Cancel autoconnect.
network.serverdata["autoconnect"] = -1
# Abort the connection.
network.disconnect()
if network.serverdata["autoconnect"] < 1: # Remove networks if autoconnect is disabled.
del world.networkobjects[netname]
# Remove the dead network object.
del world.networkobjects[netname]
@utils.add_cmd
def connect(irc, source, args):