mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Owner: fix 'unload' writing duplicate entries to supybot.plugins
Fetch the existing plugin callback to determine the plugin's name in the right case. Closes #1295.
This commit is contained in:
parent
2ba7bc5c16
commit
ec2cf4af37
@ -499,16 +499,21 @@ class Owner(callbacks.Plugin):
|
||||
return
|
||||
# Let's do this so even if the plugin isn't currently loaded, it doesn't
|
||||
# stay attempting to load.
|
||||
conf.registerPlugin(name, False)
|
||||
callbacks = irc.removeCallback(name)
|
||||
if callbacks:
|
||||
for callback in callbacks:
|
||||
callback.die()
|
||||
del callback
|
||||
gc.collect()
|
||||
irc.replySuccess()
|
||||
else:
|
||||
irc.error('There was no plugin %s.' % name)
|
||||
old_callback = irc.getCallback(name)
|
||||
if old_callback:
|
||||
# Normalize the plugin case to prevent duplicate registration
|
||||
# entries, https://github.com/ProgVal/Limnoria/issues/1295
|
||||
name = old_callback.name()
|
||||
conf.registerPlugin(name, False)
|
||||
callbacks = irc.removeCallback(name)
|
||||
if callbacks:
|
||||
for callback in callbacks:
|
||||
callback.die()
|
||||
del callback
|
||||
gc.collect()
|
||||
irc.replySuccess()
|
||||
return
|
||||
irc.error('There was no plugin %s.' % name)
|
||||
unload = wrap(unload, ['something'])
|
||||
|
||||
def defaultcapability(self, irc, msg, args, action, capability):
|
||||
|
Loading…
Reference in New Issue
Block a user