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

corecommands: fix unloading plugins that define hooks

This fixes a regression from 5e92aefcd4.
This commit is contained in:
James Lu 2017-09-23 13:39:13 -07:00
parent 42d62fe28a
commit 2535aa145f

View File

@ -161,9 +161,10 @@ def unload(irc, source, args):
for hookpair in hookpairs: for hookpair in hookpairs:
hookfunc = hookpair[1] hookfunc = hookpair[1]
if hookfunc.__module__ == modulename: if hookfunc.__module__ == modulename:
world.hooks[hookname].remove(hookfunc) log.debug('Trying to remove hook func %s (%s) from plugin %s', hookfunc, hookname, modulename)
world.hooks[hookname].remove(hookpair)
# If the hookfuncs list is empty, remove it. # If the hookfuncs list is empty, remove it.
if not hookfuncs: if not hookpairs:
del world.hooks[hookname] del world.hooks[hookname]
# Call the die() function in the plugin, if present. # Call the die() function in the plugin, if present.