summaryrefslogtreecommitdiff
path: root/sleekxmpp/basexmpp.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-08-12 16:47:58 -0700
committerLance Stout <lancestout@gmail.com>2011-08-12 16:47:58 -0700
commit484efff156e344fc3ca1a7377539132b702c0c78 (patch)
treefa051515b9dc15eb3a5ab1a8e8b9c2e25b920d17 /sleekxmpp/basexmpp.py
parent89cffd43f48cfc835b70e137776eb8c2e73a0b67 (diff)
parent8f1d0e7a79b662e5f2849cea6e73716cc887e226 (diff)
downloadslixmpp-484efff156e344fc3ca1a7377539132b702c0c78.tar.gz
slixmpp-484efff156e344fc3ca1a7377539132b702c0c78.tar.bz2
slixmpp-484efff156e344fc3ca1a7377539132b702c0c78.tar.xz
slixmpp-484efff156e344fc3ca1a7377539132b702c0c78.zip
Merge branch 'develop' into roster
Conflicts: setup.py sleekxmpp/clientxmpp.py
Diffstat (limited to 'sleekxmpp/basexmpp.py')
-rw-r--r--sleekxmpp/basexmpp.py49
1 files changed, 42 insertions, 7 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index c2267535..ecc30aa4 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -163,12 +163,41 @@ class BaseXMPP(XMLStream):
register_stanza_plugin(Message, Nick)
register_stanza_plugin(Message, HTMLIM)
- def process(self, *args, **kwargs):
+ def start_stream_handler(self, xml):
"""
- Ensure that plugin inter-dependencies are handled before starting
- event processing.
+ Save the stream ID once the streams have been established.
+
+ Overrides XMLStream.start_stream_handler.
+ Arguments:
+ xml -- The incoming stream's root element.
+ """
+ self.stream_id = xml.get('id', '')
+
+ def process(self, *args, **kwargs):
+ """
Overrides XMLStream.process.
+
+ Initialize the XML streams and begin processing events.
+
+ The number of threads used for processing stream events is determined
+ by HANDLER_THREADS.
+
+ Arguments:
+ block -- If block=False then event dispatcher will run
+ in a separate thread, allowing for the stream to be
+ used in the background for another application.
+ Otherwise, process(block=True) blocks the current thread.
+ Defaults to False.
+
+ **threaded is deprecated and included for API compatibility**
+ threaded -- If threaded=True then event dispatcher will run
+ in a separate thread, allowing for the stream to be
+ used in the background for another application.
+ Defaults to True.
+
+ Event handlers and the send queue will be threaded
+ regardless of these parameters.
"""
for name in self.plugin:
if not self.plugin[name].post_inited:
@@ -192,17 +221,23 @@ class BaseXMPP(XMLStream):
if not module:
try:
module = sleekxmpp.plugins
- module = __import__(str("%s.%s" % (module.__name__, plugin)),
- globals(), locals(), [str(plugin)])
+ module = __import__(
+ str("%s.%s" % (module.__name__, plugin)),
+ globals(), locals(), [str(plugin)])
except ImportError:
module = sleekxmpp.features
- module = __import__(str("%s.%s" % (module.__name__, plugin)),
- globals(), locals(), [str(plugin)])
+ module = __import__(
+ str("%s.%s" % (module.__name__, plugin)),
+ globals(), locals(), [str(plugin)])
if isinstance(module, str):
# We probably want to load a module from outside
# the sleekxmpp package, so leave out the globals().
module = __import__(module, fromlist=[plugin])
+ # Use the global plugin config cache, if applicable
+ if not pconfig:
+ pconfig = self.plugin_config.get(plugin, {})
+
# Load the plugin class from the module.
self.plugin[plugin] = getattr(module, plugin)(self, pconfig)