diff options
author | Lance Stout <lancestout@gmail.com> | 2012-03-10 12:48:35 -0800 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-03-10 12:48:35 -0800 |
commit | 91155444c0f66ed3172ff8fc669a5eebe514e9cc (patch) | |
tree | 0444b5ba230a9aceb28fd5977b45ac63218c60d4 /sleekxmpp | |
parent | 7f71ac7e0a43ca7a7b4347fe8f1bab0cb76e9741 (diff) | |
download | slixmpp-91155444c0f66ed3172ff8fc669a5eebe514e9cc.tar.gz slixmpp-91155444c0f66ed3172ff8fc669a5eebe514e9cc.tar.bz2 slixmpp-91155444c0f66ed3172ff8fc669a5eebe514e9cc.tar.xz slixmpp-91155444c0f66ed3172ff8fc669a5eebe514e9cc.zip |
Resolve plugin dependency chains with XEP-0115.
The post_init() system can only reliably handle a single layer
of dependencies between plugins, but PEP plugins with XEP-0115
exceed that limit and plugins can be post_init'ed out of order. To
resolve this, we will special case XEP-0115 to be post_init'ed
first until the new plugin system with dependency tracking is
stable.
Diffstat (limited to 'sleekxmpp')
-rw-r--r-- | sleekxmpp/basexmpp.py | 14 | ||||
-rw-r--r-- | sleekxmpp/plugins/__init__.py | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index dcb90582..f655783a 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -185,6 +185,16 @@ class BaseXMPP(XMLStream): - The send queue processor - The scheduler """ + + # The current post_init() process can only resolve a single + # layer of inter-plugin dependencies. However, XEP-0115 and + # plugins which depend on it exceeds this limit and can cause + # failures if plugins are post_inited out of order, so we must + # manually process XEP-0115 first. + if 'xep_0115' in self.plugin: + if not self.plugin['xep_0115'].post_inited: + self.plugin['xep_0115'].post_init() + for name in self.plugin: if not self.plugin[name].post_inited: self.plugin[name].post_init() @@ -257,10 +267,6 @@ class BaseXMPP(XMLStream): else: raise NameError("Plugin %s not in plugins.__all__." % plugin) - # Resolve plugin inter-dependencies. - for plugin in self.plugin: - self.plugin[plugin].post_init() - def __getitem__(self, key): """Return a plugin given its name, if it has been registered.""" if key in self.plugin: diff --git a/sleekxmpp/plugins/__init__.py b/sleekxmpp/plugins/__init__.py index 0b2fa119..8c5d38f0 100644 --- a/sleekxmpp/plugins/__init__.py +++ b/sleekxmpp/plugins/__init__.py @@ -27,7 +27,9 @@ __all__ = [ 'xep_0086', # Legacy Error Codes 'xep_0092', # Software Version 'xep_0115', # Entity Capabilities + 'xep_0118', # User Tune 'xep_0128', # Extended Service Discovery + 'xep_0163', # Personal Eventing Protocol 'xep_0199', # Ping 'xep_0202', # Entity Time 'xep_0203', # Delayed Delivery |