summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0060/stanza/pubsub.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2013-02-14 01:24:09 -0800
committerLance Stout <lancestout@gmail.com>2013-02-14 01:24:09 -0800
commitd8c96623022835dece47e499245369aa68927300 (patch)
treefe1f2604f5b90e345a74144e3fc63f782dd728e3 /sleekxmpp/plugins/xep_0060/stanza/pubsub.py
parentec5e819b16e5326638551b80464c0c3714b3dc3c (diff)
downloadslixmpp-d8c96623022835dece47e499245369aa68927300.tar.gz
slixmpp-d8c96623022835dece47e499245369aa68927300.tar.bz2
slixmpp-d8c96623022835dece47e499245369aa68927300.tar.xz
slixmpp-d8c96623022835dece47e499245369aa68927300.zip
Resolve most Python3.3 related issues.
Tests now run successfully. Occasionally get single error related to duplicated payload data in pubsub items when copying stanza values.
Diffstat (limited to 'sleekxmpp/plugins/xep_0060/stanza/pubsub.py')
-rw-r--r--sleekxmpp/plugins/xep_0060/stanza/pubsub.py40
1 files changed, 6 insertions, 34 deletions
diff --git a/sleekxmpp/plugins/xep_0060/stanza/pubsub.py b/sleekxmpp/plugins/xep_0060/stanza/pubsub.py
index b2fe3010..c1907a13 100644
--- a/sleekxmpp/plugins/xep_0060/stanza/pubsub.py
+++ b/sleekxmpp/plugins/xep_0060/stanza/pubsub.py
@@ -74,7 +74,12 @@ class Item(ElementBase):
def set_payload(self, value):
del self['payload']
- self.append(value)
+ if isinstance(value, ElementBase):
+ if value.tag_name() in self.plugin_tag_map:
+ self.init_plugin(value.plugin_attrib, existing_xml=value.xml)
+ self.xml.append(value.xml)
+ else:
+ self.xml.append(value)
def get_payload(self):
childs = list(self.xml)
@@ -243,39 +248,6 @@ class PublishOptions(ElementBase):
self.parent().xml.remove(self.xml)
-class PubsubState(ElementBase):
- """This is an experimental pubsub extension."""
- namespace = 'http://jabber.org/protocol/psstate'
- name = 'state'
- plugin_attrib = 'psstate'
- interfaces = set(('node', 'item', 'payload'))
-
- def set_payload(self, value):
- self.xml.append(value)
-
- def get_payload(self):
- childs = list(self.xml)
- if len(childs) > 0:
- return childs[0]
-
- def del_payload(self):
- for child in self.xml:
- self.xml.remove(child)
-
-
-class PubsubStateEvent(ElementBase):
- """This is an experimental pubsub extension."""
- namespace = 'http://jabber.org/protocol/psstate#event'
- name = 'event'
- plugin_attrib = 'psstate_event'
- intefaces = set(tuple())
-
-
-register_stanza_plugin(Iq, PubsubState)
-register_stanza_plugin(Message, PubsubStateEvent)
-register_stanza_plugin(PubsubStateEvent, PubsubState)
-
-
register_stanza_plugin(Iq, Pubsub)
register_stanza_plugin(Pubsub, Affiliations)
register_stanza_plugin(Pubsub, Configure)