summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-08-31 16:03:32 -0700
committerLance Stout <lancestout@gmail.com>2011-08-31 16:03:32 -0700
commitb68785e19ebdbf6d3eb638a0fa2b612e9b404868 (patch)
treeebce2b0ed33a7219cf903571aeaaeb782b605b6b /sleekxmpp
parenta1bbb719e17645959899f862475a1dd28a34ed55 (diff)
downloadslixmpp-b68785e19ebdbf6d3eb638a0fa2b612e9b404868.tar.gz
slixmpp-b68785e19ebdbf6d3eb638a0fa2b612e9b404868.tar.bz2
slixmpp-b68785e19ebdbf6d3eb638a0fa2b612e9b404868.tar.xz
slixmpp-b68785e19ebdbf6d3eb638a0fa2b612e9b404868.zip
Retract stanzas are behaving oddly when using stanza values.
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/plugins/xep_0060/pubsub.py9
-rw-r--r--sleekxmpp/plugins/xep_0060/stanza/pubsub.py8
2 files changed, 9 insertions, 8 deletions
diff --git a/sleekxmpp/plugins/xep_0060/pubsub.py b/sleekxmpp/plugins/xep_0060/pubsub.py
index fadcf652..e1f20254 100644
--- a/sleekxmpp/plugins/xep_0060/pubsub.py
+++ b/sleekxmpp/plugins/xep_0060/pubsub.py
@@ -305,11 +305,10 @@ class xep_0060(base_plugin):
item['id'] = id
item['payload'] = payload
iq['pubsub']['publish'].append(item)
- if options is not None:
- iq['pubsub']['publish_options'] = options
+ iq['pubsub']['publish_options'] = options
return iq.send(block=block, callback=callback, timeout=timeout)
- def retract(self, jid, node, item, ifrom=None, block=True,
+ def retract(self, jid, node, item_id, ifrom=None, block=True,
callback=None, timeout=None):
"""
Delete a single item from a node.
@@ -317,9 +316,7 @@ class xep_0060(base_plugin):
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set')
iq['pubsub']['retract']['node'] = node
- item = stanza.pubsub.Item()
- item['id'] = item
- iq['pubsub']['retract'].append(item)
+ iq['pubsub']['retract']['item']['id'] = item_id
return iq.send(block=block, callback=callback, timeout=timeout)
def purge(self, jid, node, ifrom=None, block=True, callback=None,
diff --git a/sleekxmpp/plugins/xep_0060/stanza/pubsub.py b/sleekxmpp/plugins/xep_0060/stanza/pubsub.py
index 6a9a3df9..c370aeb9 100644
--- a/sleekxmpp/plugins/xep_0060/stanza/pubsub.py
+++ b/sleekxmpp/plugins/xep_0060/stanza/pubsub.py
@@ -151,7 +151,7 @@ class Publish(Items):
registerStanzaPlugin(Pubsub, Publish)
-class Retract(Items):
+class Retract(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub'
name = 'retract'
plugin_attrib = name
@@ -160,6 +160,7 @@ class Retract(Items):
plugin_tag_map = {}
registerStanzaPlugin(Pubsub, Retract)
+registerStanzaPlugin(Retract, Item)
class Unsubscribe(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub'
@@ -253,12 +254,14 @@ class PublishOptions(ElementBase):
def get_publish_options(self):
config = self.xml.find('{jabber:x:data}x')
+ if config is None:
+ return None
form = xep_0004.Form(xml=config)
return form
def set_publish_options(self, value):
if value is None:
- del self['publish_options']
+ self.del_publish_options()
else:
self.xml.append(value.getXML())
return self
@@ -267,6 +270,7 @@ class PublishOptions(ElementBase):
config = self.xml.find('{jabber:x:data}x')
if config is not None:
self.xml.remove(config)
+ self.parent().xml.remove(self.xml)
registerStanzaPlugin(Pubsub, PublishOptions)