summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-08-31 23:48:22 -0700
committerLance Stout <lancestout@gmail.com>2011-08-31 23:48:22 -0700
commit76bc0a2ba679828d17871c43bfe076b077c9b600 (patch)
tree87bb181172e726267f7cc20a611473f9fe622fde /sleekxmpp
parentd2dc4824ee80cf73575c875dda9a54de4724d4b9 (diff)
downloadslixmpp-76bc0a2ba679828d17871c43bfe076b077c9b600.tar.gz
slixmpp-76bc0a2ba679828d17871c43bfe076b077c9b600.tar.bz2
slixmpp-76bc0a2ba679828d17871c43bfe076b077c9b600.tar.xz
slixmpp-76bc0a2ba679828d17871c43bfe076b077c9b600.zip
XEP-0060 v1.13 dictates publishing/retracting one item at a time.
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/plugins/xep_0060/pubsub.py24
-rw-r--r--sleekxmpp/plugins/xep_0060/stanza/pubsub.py3
2 files changed, 10 insertions, 17 deletions
diff --git a/sleekxmpp/plugins/xep_0060/pubsub.py b/sleekxmpp/plugins/xep_0060/pubsub.py
index e1f20254..627ad37a 100644
--- a/sleekxmpp/plugins/xep_0060/pubsub.py
+++ b/sleekxmpp/plugins/xep_0060/pubsub.py
@@ -282,9 +282,8 @@ class xep_0060(base_plugin):
iq['pubsub_owner']['configure']['form'].values = config.values
return iq.send(block=block, callback=callback, timeout=timeout)
- def publish(self, jid, node, item_id=None, payload=None, items=None,
- options=None, ifrom=None, block=True, callback=None,
- timeout=None):
+ def publish(self, jid, node, id=None, payload=None, options=None,
+ ifrom=None, block=True, callback=None, timeout=None):
"""
Add or edit items in a node.
@@ -294,21 +293,14 @@ class xep_0060(base_plugin):
"""
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set')
iq['pubsub']['publish']['node'] = node
-
- if items is None:
- items = []
- if item_id is not None:
- items.insert(0, (item_id, payload))
- for id, payload in items:
- item = stanza.pubsub.Item()
- if id is not None:
- item['id'] = id
- item['payload'] = payload
- iq['pubsub']['publish'].append(item)
+ if id is not None:
+ iq['pubsub']['publish']['item']['id'] = id
+ if payload is not None:
+ iq['pubsub']['publish']['item']['payload'] = payload
iq['pubsub']['publish_options'] = options
return iq.send(block=block, callback=callback, timeout=timeout)
- def retract(self, jid, node, item_id, ifrom=None, block=True,
+ def retract(self, jid, node, id, ifrom=None, block=True,
callback=None, timeout=None):
"""
Delete a single item from a node.
@@ -316,7 +308,7 @@ class xep_0060(base_plugin):
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set')
iq['pubsub']['retract']['node'] = node
- iq['pubsub']['retract']['item']['id'] = item_id
+ iq['pubsub']['retract']['item']['id'] = 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 c370aeb9..9f3fbe22 100644
--- a/sleekxmpp/plugins/xep_0060/stanza/pubsub.py
+++ b/sleekxmpp/plugins/xep_0060/stanza/pubsub.py
@@ -140,7 +140,7 @@ registerStanzaPlugin(Pubsub, Create)
#
#registerStanzaPlugin(Pubsub, Default)
-class Publish(Items):
+class Publish(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub'
name = 'publish'
plugin_attrib = name
@@ -150,6 +150,7 @@ class Publish(Items):
subitem = (Item,)
registerStanzaPlugin(Pubsub, Publish)
+registerStanzaPlugin(Publish, Item)
class Retract(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub'