mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Extracted loadPlugin{Module,Class} behavior into separate functions that can be exported to all modules.
This commit is contained in:
parent
a765308cbd
commit
a16bb77cba
@ -247,20 +247,14 @@ class OwnerCommands(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
"""
|
"""
|
||||||
name = privmsgs.getArgs(args)
|
name = privmsgs.getArgs(args)
|
||||||
callbacks = irc.removeCallback(name)
|
callbacks = irc.removeCallback(name)
|
||||||
|
|
||||||
if callbacks:
|
if callbacks:
|
||||||
try:
|
try:
|
||||||
moduleInfo = imp.find_module(name, conf.pluginDirs)
|
module = loadPluginModule(name)
|
||||||
module = imp.load_module(name, *moduleInfo)
|
|
||||||
linecache.checkcache()
|
|
||||||
for callback in callbacks:
|
for callback in callbacks:
|
||||||
callback.die()
|
callback.die()
|
||||||
del callback
|
del callback
|
||||||
gc.collect()
|
gc.collect()
|
||||||
callback = module.Class()
|
callback = loadPluginClass(irc, module)
|
||||||
irc.addCallback(callback)
|
|
||||||
if hasattr(callback, 'configure'):
|
|
||||||
callback.configure(irc)
|
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
for callback in callbacks:
|
for callback in callbacks:
|
||||||
|
Loading…
Reference in New Issue
Block a user