diff options
author | Lance Stout <lancestout@gmail.com> | 2010-05-23 01:30:49 +0800 |
---|---|---|
committer | Nathan Fritz <fritzy@netflint.net> | 2010-05-25 07:28:48 +0800 |
commit | 5ca4ede5ac1ddbc56e97010a2f39ed6ada37817e (patch) | |
tree | 880d936c01e049056086eca85a9f92ee575601ed /sleekxmpp | |
parent | 35f4ef3452015d7f9ef1e300bc104793de12f1e8 (diff) | |
download | slixmpp-5ca4ede5ac1ddbc56e97010a2f39ed6ada37817e.tar.gz slixmpp-5ca4ede5ac1ddbc56e97010a2f39ed6ada37817e.tar.bz2 slixmpp-5ca4ede5ac1ddbc56e97010a2f39ed6ada37817e.tar.xz slixmpp-5ca4ede5ac1ddbc56e97010a2f39ed6ada37817e.zip |
Added a flag to registerPlugin to control calling the plugin's post_init method.
Diffstat (limited to 'sleekxmpp')
-rw-r--r-- | sleekxmpp/basexmpp.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index 83431bd7..292a2088 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -86,7 +86,7 @@ class basexmpp(object): self.username = jid.split('@', 1)[0] self.server = jid.split('@',1)[-1].split('/', 1)[0] - def registerPlugin(self, plugin, pconfig = {}): + def registerPlugin(self, plugin, pconfig = {}, run_post=True): """Register a plugin not in plugins.__init__.__all__ but in the plugins directory.""" # discover relative "path" to the plugins module from the main app, and import it. @@ -100,6 +100,8 @@ class basexmpp(object): if hasattr(self.plugin[plugin], 'xep'): xep = "(XEP-%s) " % self.plugin[plugin].xep logging.debug("Loaded Plugin %s%s" % (xep, self.plugin[plugin].description)) + if run_post: + self.plugin[plugin].post_init() def register_plugins(self): """Initiates all plugins in the plugins/__init__.__all__""" @@ -109,7 +111,7 @@ class basexmpp(object): plugin_list = plugins.__all__ for plugin in plugin_list: if plugin in plugins.__all__: - self.registerPlugin(plugin, self.plugin_config.get(plugin, {})) + self.registerPlugin(plugin, self.plugin_config.get(plugin, {}), False) else: raise NameError("No plugin by the name of %s listed in plugins.__all__." % plugin) # run post_init() for cross-plugin interaction |