Check for publish-options support and add them in devicelist and bundle set operations
Ensure that publish-options are added at the end in the pubsub request, otherwise it seems to be invalid. Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
0b6ef3a860
commit
0e65c68371
1 changed files with 20 additions and 15 deletions
|
@ -241,13 +241,6 @@ class XEP_0384(BasePlugin):
|
||||||
|
|
||||||
iq = self.xmpp.Iq(stype='set')
|
iq = self.xmpp.Iq(stype='set')
|
||||||
|
|
||||||
if publish_options:
|
|
||||||
options = _make_publish_options_form({
|
|
||||||
'pubsub#persist_items': True,
|
|
||||||
'pubsub#access_model': 'open',
|
|
||||||
})
|
|
||||||
iq['pubsub']['publish_options'] = options
|
|
||||||
|
|
||||||
publish = iq['pubsub']['publish']
|
publish = iq['pubsub']['publish']
|
||||||
publish['node'] = '%s:%d' % (OMEMO_BUNDLES_NS, self._device_id)
|
publish['node'] = '%s:%d' % (OMEMO_BUNDLES_NS, self._device_id)
|
||||||
payload = publish['item']['bundle']
|
payload = publish['item']['bundle']
|
||||||
|
@ -268,6 +261,13 @@ class XEP_0384(BasePlugin):
|
||||||
prekeys.append(prekey)
|
prekeys.append(prekey)
|
||||||
payload['prekeys'] = prekeys
|
payload['prekeys'] = prekeys
|
||||||
|
|
||||||
|
if publish_options:
|
||||||
|
options = _make_publish_options_form({
|
||||||
|
'pubsub#persist_items': True,
|
||||||
|
'pubsub#access_model': 'open',
|
||||||
|
})
|
||||||
|
iq['pubsub']['publish_options'] = options
|
||||||
|
|
||||||
return iq
|
return iq
|
||||||
|
|
||||||
async def _publish_bundle(self) -> None:
|
async def _publish_bundle(self) -> None:
|
||||||
|
@ -348,6 +348,11 @@ class XEP_0384(BasePlugin):
|
||||||
payload = Devices()
|
payload = Devices()
|
||||||
payload['devices'] = devices
|
payload['devices'] = devices
|
||||||
|
|
||||||
|
jid = self.xmpp.boundjid
|
||||||
|
disco = await self.xmpp['xep_0030'].get_info(jid.bare)
|
||||||
|
publish_options = PUBLISH_OPTIONS_NODE in disco['disco_info'].get_features()
|
||||||
|
|
||||||
|
if publish_options:
|
||||||
options = _make_publish_options_form({
|
options = _make_publish_options_form({
|
||||||
'pubsub#persist_items': True,
|
'pubsub#persist_items': True,
|
||||||
# Everybody will be able to encrypt for us, without having to add
|
# Everybody will be able to encrypt for us, without having to add
|
||||||
|
|
Loading…
Reference in a new issue