plugin XEP-0060: added setConfiguration/psNodeConfigurationSet + fix in tmp.wokkel.pubsub
This commit is contained in:
parent
b9db15510f
commit
34f6f89025
1 changed files with 20 additions and 1 deletions
|
|
@ -86,6 +86,7 @@ class XEP_0060(object):
|
|||
self._node_cb = {} # dictionnary of callbacks for node (key: node, value: list of callbacks)
|
||||
self.rt_sessions = sat_defer.RTDeferredSessions()
|
||||
host.bridge.addMethod("psNodeConfigurationGet", ".plugin", in_sign='sss', out_sign='a{ss}', method=self._getNodeConfiguration, async=True)
|
||||
host.bridge.addMethod("psNodeConfigurationSet", ".plugin", in_sign='ssa{ss}s', out_sign='', method=self._setNodeConfiguration, async=True)
|
||||
host.bridge.addMethod("psDeleteNode", ".plugin", in_sign='sss', out_sign='', method=self._deleteNode, async=True)
|
||||
host.bridge.addMethod("psItemGet", ".plugin", in_sign='ssiassa{ss}s', out_sign='(asa{ss})', method=self._getItems, async=True)
|
||||
host.bridge.addMethod("psRetractItem", ".plugin", in_sign='sssbs', out_sign='', method=self._retractItem, async=True)
|
||||
|
|
@ -416,6 +417,24 @@ class XEP_0060(object):
|
|||
d.addCallback(cb)
|
||||
return d
|
||||
|
||||
def _setNodeConfiguration(self, service_s, nodeIdentifier, options, profile_key):
|
||||
client = self.host.getClient(profile_key)
|
||||
d = self.setConfiguration(client, jid.JID(service_s) if service_s else None, nodeIdentifier, options)
|
||||
return d
|
||||
|
||||
def setConfiguration(self, client, service, nodeIdentifier, options):
|
||||
request = pubsub.PubSubRequest('configureSet')
|
||||
request.recipient = service
|
||||
request.nodeIdentifier = nodeIdentifier
|
||||
|
||||
form = data_form.Form(formType='submit',
|
||||
formNamespace=pubsub.NS_PUBSUB_NODE_CONFIG)
|
||||
form.makeFields(options)
|
||||
request.options = form
|
||||
|
||||
d = request.send(client.xmlstream)
|
||||
return d
|
||||
|
||||
def _deleteNode(self, service_s, nodeIdentifier, profile_key):
|
||||
return self.deleteNode(jid.JID(service_s) if service_s else None, nodeIdentifier, profile_key)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue