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

plugins: use irc.disconnect() to disconnect networks (#152)

This commit is contained in:
James Lu 2016-01-09 20:03:42 -08:00
parent f70ca54ae4
commit 989f1f4f64
3 changed files with 5 additions and 4 deletions

View File

@ -177,7 +177,7 @@ def shutdown(irc, source, args):
for ircobj in world.networkobjects.values():
# Disable auto-connect first by setting the time to negative.
ircobj.serverdata['autoconnect'] = -1
ircobj.disconnect(callhook=False)
ircobj.disconnect()
def load(irc, source, args):
"""<plugin name>.

View File

@ -28,8 +28,9 @@ def disconnect(irc, source, args):
irc.reply('Error: No such network "%s" (case sensitive).' % netname)
return
irc.reply("Done.")
# Abort the connection! Simple as that.
network.aborted.set()
network.disconnect()
@utils.add_cmd
def connect(irc, source, args):

View File

@ -204,7 +204,7 @@ def getRemoteSid(irc, remoteirc):
except ValueError: # Network not initialized yet.
log.exception('(%s) Failed to spawn server for %r:',
irc.name, remoteirc.name)
irc.aborted.set()
irc.disconnect()
return
else:
irc.servers[sid].remote = remoteirc.name
@ -981,7 +981,7 @@ def handle_kill(irc, numeric, command, args):
else:
log.error('(%s) Too many kills received for target %s, aborting!',
irc.name, userdata.nick)
irc.aborted.set()
irc.disconnect()
killcache[irc.name] += 1
# Target user was local.