mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-24 03:04:05 +01:00
control/utils: unload the PyLink service bot on shutdown
This commit is contained in:
parent
a4dbd8d09f
commit
0d563eaa57
@ -25,6 +25,9 @@ def _shutdown(irc=None):
|
|||||||
except: # But don't allow it to crash the server.
|
except: # But don't allow it to crash the server.
|
||||||
log.exception('coremods.control: Error occurred in die() of plugin %s, skipping...', name)
|
log.exception('coremods.control: Error occurred in die() of plugin %s, skipping...', name)
|
||||||
|
|
||||||
|
# Remove our main PyLink bot as well.
|
||||||
|
utils.unregisterService('pylink')
|
||||||
|
|
||||||
for ircobj in world.networkobjects.copy().values():
|
for ircobj in world.networkobjects.copy().values():
|
||||||
# Disconnect all our networks.
|
# Disconnect all our networks.
|
||||||
remove_network(ircobj)
|
remove_network(ircobj)
|
||||||
|
8
utils.py
8
utils.py
@ -383,6 +383,12 @@ def unregisterService(name):
|
|||||||
name = name.lower()
|
name = name.lower()
|
||||||
sbot = world.services[name]
|
sbot = world.services[name]
|
||||||
for ircnet, uid in sbot.uids.items():
|
for ircnet, uid in sbot.uids.items():
|
||||||
world.networkobjects[ircnet].proto.quit(uid, "Service unloaded.")
|
ircobj = world.networkobjects[ircnet]
|
||||||
|
# Special case for the main PyLink client. If we're unregistering that,
|
||||||
|
# clear the irc.pseudoclient entry.
|
||||||
|
if name == 'pylink':
|
||||||
|
ircobj.pseudoclient = None
|
||||||
|
|
||||||
|
ircobj.proto.quit(uid, "Service unloaded.")
|
||||||
|
|
||||||
del world.services[name]
|
del world.services[name]
|
||||||
|
Loading…
Reference in New Issue
Block a user