Test publishng an item with options.
This commit is contained in:
@@ -283,7 +283,8 @@ class xep_0060(base_plugin):
|
||||
return iq.send(block=block, callback=callback, timeout=timeout)
|
||||
|
||||
def publish(self, jid, node, item_id=None, payload=None, items=None,
|
||||
ifrom=None, block=True, callback=None, timeout=None):
|
||||
options=None, ifrom=None, block=True, callback=None,
|
||||
timeout=None):
|
||||
"""
|
||||
Add or edit items in a node.
|
||||
|
||||
@@ -304,6 +305,8 @@ 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
|
||||
return iq.send(block=block, callback=callback, timeout=timeout)
|
||||
|
||||
def retract(self, jid, node, item, ifrom=None, block=True,
|
||||
|
@@ -257,12 +257,16 @@ class PublishOptions(ElementBase):
|
||||
return form
|
||||
|
||||
def set_publish_options(self, value):
|
||||
self.xml.append(value.getXML())
|
||||
if value is None:
|
||||
del self['publish_options']
|
||||
else:
|
||||
self.xml.append(value.getXML())
|
||||
return self
|
||||
|
||||
def del_publish_options(self):
|
||||
config = self.xml.find('{jabber:x:data}x')
|
||||
self.xml.remove(config)
|
||||
if config is not None:
|
||||
self.xml.remove(config)
|
||||
|
||||
registerStanzaPlugin(Pubsub, PublishOptions)
|
||||
|
||||
|
Reference in New Issue
Block a user