plugin XEP-0470: create a default configuration if node config can't be accessed
This commit is contained in:
parent
6459ef59bc
commit
895ddd36be
2 changed files with 11 additions and 4 deletions
|
|
@ -961,6 +961,14 @@ class XEP_0060(object):
|
|||
d.addCallback(cb)
|
||||
return d
|
||||
|
||||
def make_configuration_form(self, options: dict) -> data_form.Form:
|
||||
"""Build a configuration form"""
|
||||
form = data_form.Form(
|
||||
formType="submit", formNamespace=pubsub.NS_PUBSUB_NODE_CONFIG
|
||||
)
|
||||
form.makeFields(options)
|
||||
return form
|
||||
|
||||
def _setNodeConfiguration(self, service_s, nodeIdentifier, options, profile_key):
|
||||
client = self.host.getClient(profile_key)
|
||||
d = self.setConfiguration(
|
||||
|
|
@ -973,10 +981,7 @@ class XEP_0060(object):
|
|||
request.recipient = service
|
||||
request.nodeIdentifier = nodeIdentifier
|
||||
|
||||
form = data_form.Form(
|
||||
formType="submit", formNamespace=pubsub.NS_PUBSUB_NODE_CONFIG
|
||||
)
|
||||
form.makeFields(options)
|
||||
form = self.make_configuration_form(options)
|
||||
request.options = form
|
||||
|
||||
d = request.send(client.xmlstream)
|
||||
|
|
|
|||
|
|
@ -194,6 +194,8 @@ class PubsubAttachments:
|
|||
client, service, node
|
||||
)
|
||||
node_config = await self._p.getConfiguration(client, service, node)
|
||||
elif e.condition == "forbidden":
|
||||
node_config = self._p.make_configuration_form({})
|
||||
else:
|
||||
raise e
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue