Allow message and presence stanzas to be embedded as substanzas.

This commit is contained in:
Lance Stout 2012-06-19 16:20:54 -07:00
parent 7858d969d8
commit 433ee08687

View file

@ -277,7 +277,7 @@ class ElementBase(object):
:param xml: Initialize the stanza object with an existing XML object. :param xml: Initialize the stanza object with an existing XML object.
:param parent: Optionally specify a parent stanza object will will :param parent: Optionally specify a parent stanza object will
contain this substanza. contain this substanza.
""" """
@ -1424,6 +1424,8 @@ class StanzaBase(ElementBase):
:param sfrom: Optional string or :class:`sleekxmpp.xmlstream.JID` :param sfrom: Optional string or :class:`sleekxmpp.xmlstream.JID`
object of the sender's JID. object of the sender's JID.
:param string sid: Optional ID value for the stanza. :param string sid: Optional ID value for the stanza.
:param parent: Optionally specify a parent stanza object will
contain this substanza.
""" """
#: The default XMPP client namespace #: The default XMPP client namespace
@ -1438,11 +1440,11 @@ class StanzaBase(ElementBase):
types = set(('get', 'set', 'error', None, 'unavailable', 'normal', 'chat')) types = set(('get', 'set', 'error', None, 'unavailable', 'normal', 'chat'))
def __init__(self, stream=None, xml=None, stype=None, def __init__(self, stream=None, xml=None, stype=None,
sto=None, sfrom=None, sid=None): sto=None, sfrom=None, sid=None, parent=None):
self.stream = stream self.stream = stream
if stream is not None: if stream is not None:
self.namespace = stream.default_ns self.namespace = stream.default_ns
ElementBase.__init__(self, xml) ElementBase.__init__(self, xml, parent)
if stype is not None: if stype is not None:
self['type'] = stype self['type'] = stype
if sto is not None: if sto is not None: