Mercurial > libervia-backend
diff sat/plugins/plugin_xep_0363.py @ 4021:412b99c29d83
core (xmpp), component file sharing, plugin XEP-0363: `enabled_features` + HTTP Upload:
add a mechanism to explicitely enable some features in components, and use it to enable
HTTP Upload only if it's explicitely enabled.
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 23 Mar 2023 15:38:07 +0100 |
parents | 0ff265725489 |
children | 524856bd7b19 |
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0363.py Thu Mar 23 15:32:10 2023 +0100 +++ b/sat/plugins/plugin_xep_0363.py Thu Mar 23 15:38:07 2023 +0100 @@ -433,14 +433,19 @@ self.plugin_parent = plugin_parent def connectionInitialized(self): - if self.parent.is_component: + if ((self.parent.is_component + and PLUGIN_INFO[C.PI_IMPORT_NAME] in self.parent.enabled_features)): self.xmlstream.addObserver( IQ_HTTP_UPLOAD_REQUEST, self.plugin_parent.onComponentRequest, client=self.parent ) def getDiscoInfo(self, requestor, target, nodeIdentifier=""): - return [disco.DiscoFeature(NS_HTTP_UPLOAD)] + if ((self.parent.is_component + and not PLUGIN_INFO[C.PI_IMPORT_NAME] in self.parent.enabled_features)): + return [] + else: + return [disco.DiscoFeature(NS_HTTP_UPLOAD)] def getDiscoItems(self, requestor, target, nodeIdentifier=""): return []