diff options
author | Lance Stout <lancestout@gmail.com> | 2011-06-30 15:40:22 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-06-30 15:40:22 -0700 |
commit | 754ac5092a3a37819a71f6565a1e54b3f2547940 (patch) | |
tree | 8eac47a45f53e7f5bca0ffe312409dbb71924e42 /sleekxmpp/basexmpp.py | |
parent | 9ed972ffeba8f5071d5cae8497322764207fec04 (diff) | |
download | slixmpp-754ac5092a3a37819a71f6565a1e54b3f2547940.tar.gz slixmpp-754ac5092a3a37819a71f6565a1e54b3f2547940.tar.bz2 slixmpp-754ac5092a3a37819a71f6565a1e54b3f2547940.tar.xz slixmpp-754ac5092a3a37819a71f6565a1e54b3f2547940.zip |
Reorganize features into plugins.
Diffstat (limited to 'sleekxmpp/basexmpp.py')
-rw-r--r-- | sleekxmpp/basexmpp.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index 8e5c762a..43ad420f 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -165,9 +165,14 @@ class BaseXMPP(XMLStream): try: # Import the given module that contains the plugin. if not module: - module = sleekxmpp.plugins - module = __import__("%s.%s" % (module.__name__, plugin), - globals(), locals(), [plugin]) + try: + module = sleekxmpp.plugins + module = __import__("%s.%s" % (module.__name__, plugin), + globals(), locals(), [plugin]) + except ImportError: + module = sleekxmpp.features + module = __import__("%s.%s" % (module.__name__, plugin), + globals(), locals(), [plugin]) if isinstance(module, str): # We probably want to load a module from outside # the sleekxmpp package, so leave out the globals(). @@ -176,12 +181,14 @@ class BaseXMPP(XMLStream): # Load the plugin class from the module. self.plugin[plugin] = getattr(module, plugin)(self, pconfig) - # Let XEP implementing plugins have some extra logging info. - xep = '' - if hasattr(self.plugin[plugin], 'xep'): - xep = "(XEP-%s) " % self.plugin[plugin].xep + # Let XEP/RFC implementing plugins have some extra logging info. + spec = '(CUSTOM) ' + if self.plugin[plugin].xep: + spec = "(XEP-%s) " % self.plugin[plugin].xep + elif self.plugin[plugin].rfc: + spec = "(RFC-%s) " % self.plugin[plugin].rfc - desc = (xep, self.plugin[plugin].description) + desc = (spec, self.plugin[plugin].description) log.debug("Loaded Plugin %s%s" % desc) except: log.exception("Unable to load plugin: %s", plugin) |