summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-12-11 17:04:58 -0800
committerLance Stout <lancestout@gmail.com>2011-12-11 17:04:58 -0800
commit62e6d6fb4c68c8db7ef0e0234674e1f24ce7857b (patch)
tree450dc8b21739b7e512d8e43a43c90b776a521835 /sleekxmpp
parent16c72e8efda387299b81c8bcde6fe4838ac65680 (diff)
downloadslixmpp-62e6d6fb4c68c8db7ef0e0234674e1f24ce7857b.tar.gz
slixmpp-62e6d6fb4c68c8db7ef0e0234674e1f24ce7857b.tar.bz2
slixmpp-62e6d6fb4c68c8db7ef0e0234674e1f24ce7857b.tar.xz
slixmpp-62e6d6fb4c68c8db7ef0e0234674e1f24ce7857b.zip
Fix iterable substanzas when added as normal plugin.
If an iterable plugin was an enabled, it wasn't added to the iterables list.
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/xmlstream/stanzabase.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index 6f27c361..389fe20c 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -290,12 +290,11 @@ class ElementBase(object):
# Initialize values using provided XML
for child in self.xml.getchildren():
if child.tag in self.plugin_tag_map:
- plugin = self.plugin_tag_map[child.tag]
- self.plugins[plugin.plugin_attrib] = plugin(child, self)
- for sub in self.plugin_iterables:
- if child.tag == "{%s}%s" % (sub.namespace, sub.name):
- self.iterables.append(sub(child, self))
- break
+ plugin_class = self.plugin_tag_map[child.tag]
+ plugin = plugin_class(child, self)
+ self.plugins[plugin.plugin_attrib] = plugin
+ if plugin_class in self.plugin_iterables:
+ self.iterables.append(plugin)
def setup(self, xml=None):
"""Initialize the stanza's XML contents.
@@ -346,7 +345,10 @@ class ElementBase(object):
"""
if attrib not in self.plugins:
plugin_class = self.plugin_attrib_map[attrib]
- self.plugins[attrib] = plugin_class(parent=self)
+ plugin = plugin_class(parent=self)
+ self.plugins[attrib] = plugin
+ if plugin_class in self.plugin_iterables:
+ self.iterables.append(plugin)
return self
def _get_stanza_values(self):