Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0060.py @ 3993:722c25818778
plugin XEP-0470: create a default configuration if node config can't be accessed
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 05 Dec 2022 11:54:47 +0100 |
parents | cd4d95b3fed3 |
children | 9456852d3286 |
comparison
equal
deleted
inserted
replaced
3992:1c84268752a1 | 3993:722c25818778 |
---|---|
959 | 959 |
960 d = request.send(client.xmlstream) | 960 d = request.send(client.xmlstream) |
961 d.addCallback(cb) | 961 d.addCallback(cb) |
962 return d | 962 return d |
963 | 963 |
964 def make_configuration_form(self, options: dict) -> data_form.Form: | |
965 """Build a configuration form""" | |
966 form = data_form.Form( | |
967 formType="submit", formNamespace=pubsub.NS_PUBSUB_NODE_CONFIG | |
968 ) | |
969 form.makeFields(options) | |
970 return form | |
971 | |
964 def _setNodeConfiguration(self, service_s, nodeIdentifier, options, profile_key): | 972 def _setNodeConfiguration(self, service_s, nodeIdentifier, options, profile_key): |
965 client = self.host.getClient(profile_key) | 973 client = self.host.getClient(profile_key) |
966 d = self.setConfiguration( | 974 d = self.setConfiguration( |
967 client, jid.JID(service_s) if service_s else None, nodeIdentifier, options | 975 client, jid.JID(service_s) if service_s else None, nodeIdentifier, options |
968 ) | 976 ) |
971 def setConfiguration(self, client, service, nodeIdentifier, options): | 979 def setConfiguration(self, client, service, nodeIdentifier, options): |
972 request = pubsub.PubSubRequest("configureSet") | 980 request = pubsub.PubSubRequest("configureSet") |
973 request.recipient = service | 981 request.recipient = service |
974 request.nodeIdentifier = nodeIdentifier | 982 request.nodeIdentifier = nodeIdentifier |
975 | 983 |
976 form = data_form.Form( | 984 form = self.make_configuration_form(options) |
977 formType="submit", formNamespace=pubsub.NS_PUBSUB_NODE_CONFIG | |
978 ) | |
979 form.makeFields(options) | |
980 request.options = form | 985 request.options = form |
981 | 986 |
982 d = request.send(client.xmlstream) | 987 d = request.send(client.xmlstream) |
983 return d | 988 return d |
984 | 989 |