summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-10 17:06:28 +0100
committermathieui <mathieui@mathieui.net>2011-11-10 17:06:28 +0100
commitbd2d1caa0ab8f83500633d011b8c01b4213484fc (patch)
tree2b25c824e7e04b2bbc9ff8241bd7a9be22c2b067 /src
parenteaced10c1667d0ddf8cf41aebf060a6c2be7173b (diff)
downloadpoezio-bd2d1caa0ab8f83500633d011b8c01b4213484fc.tar.gz
poezio-bd2d1caa0ab8f83500633d011b8c01b4213484fc.tar.bz2
poezio-bd2d1caa0ab8f83500633d011b8c01b4213484fc.tar.xz
poezio-bd2d1caa0ab8f83500633d011b8c01b4213484fc.zip
Autoload plugins in session_start instead of core.__init__
Diffstat (limited to 'src')
-rw-r--r--src/core.py3
-rw-r--r--src/plugin_manager.py10
2 files changed, 7 insertions, 6 deletions
diff --git a/src/core.py b/src/core.py
index 986d1222..3ecf76f2 100644
--- a/src/core.py
+++ b/src/core.py
@@ -177,8 +177,6 @@ class Core(object):
self.connected_events = {}
- self.autoload_plugins()
-
def autoload_plugins(self):
plugins = config.get('plugins_autoload', '')
for plugin in plugins.split():
@@ -456,6 +454,7 @@ class Core(object):
Called when we are connected and authenticated
"""
self.connection_time = time.time()
+ self.autoload_plugins()
self.information(_("Authentication success."))
self.information(_("Your JID is %s") % self.xmpp.boundjid.full)
if not self.xmpp.anon:
diff --git a/src/plugin_manager.py b/src/plugin_manager.py
index 36887084..fe4d2b7e 100644
--- a/src/plugin_manager.py
+++ b/src/plugin_manager.py
@@ -37,7 +37,7 @@ class PluginManager(object):
self.event_handlers = {} # module name -> list of event_name/handler pairs loaded for the module
self.tab_commands = {} #module name -> dict of tab types; tab type -> commands loaded by the module
- def load(self, name):
+ def load(self, name, notify=True):
if name in self.plugins:
self.unload(name)
@@ -64,9 +64,10 @@ class PluginManager(object):
self.tab_commands[name] = {}
self.event_handlers[name] = []
self.plugins[name] = module.Plugin(self, self.core, plugins_conf_dir)
- self.core.information('Plugin %s loaded' % name, 'Info')
+ if notify:
+ self.core.information('Plugin %s loaded' % name, 'Info')
- def unload(self, name):
+ def unload(self, name, notify=True):
if name in self.plugins:
try:
for command in self.commands[name].keys():
@@ -83,7 +84,8 @@ class PluginManager(object):
del self.commands[name]
del self.tab_commands[name]
del self.event_handlers[name]
- self.core.information('Plugin %s unloaded' % name, 'Info')
+ if notify:
+ self.core.information('Plugin %s unloaded' % name, 'Info')
except Exception as e:
import traceback
self.core.information(_("Could not unload plugin (may not be safe to try again): ") + traceback.format_exc())