3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +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. except KeyError: # Unknown network.
irc.reply('Error: No such network "%s" (case sensitive).' % netname) irc.reply('Error: No such network "%s" (case sensitive).' % netname)
return 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() network.disconnect()
if network.serverdata["autoconnect"] < 1: # Remove networks if autoconnect is disabled. # Remove the dead network object.
del world.networkobjects[netname] del world.networkobjects[netname]
@utils.add_cmd @utils.add_cmd
def connect(irc, source, args): def connect(irc, source, args):