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,14 +348,19 @@ class XEP_0384(BasePlugin):
|
||||||
payload = Devices()
|
payload = Devices()
|
||||||
payload['devices'] = devices
|
payload['devices'] = devices
|
||||||
|
|
||||||
options = _make_publish_options_form({
|
jid = self.xmpp.boundjid
|
||||||
'pubsub#persist_items': True,
|
disco = await self.xmpp['xep_0030'].get_info(jid.bare)
|
||||||
# Everybody will be able to encrypt for us, without having to add
|
publish_options = PUBLISH_OPTIONS_NODE in disco['disco_info'].get_features()
|
||||||
# us into their roster. This obviously leaks the number of devices
|
|
||||||
# and the associated metadata of us pushing new device lists every
|
if publish_options:
|
||||||
# so often.
|
options = _make_publish_options_form({
|
||||||
'pubsub#access_model': 'open',
|
'pubsub#persist_items': True,
|
||||||
})
|
# Everybody will be able to encrypt for us, without having to add
|
||||||
|
# us into their roster. This obviously leaks the number of devices
|
||||||
|
# and the associated metadata of us pushing new device lists every
|
||||||
|
# so often.
|
||||||
|
'pubsub#access_model': 'open',
|
||||||
|
})
|
||||||
|
|
||||||
await self.xmpp['xep_0060'].publish(
|
await self.xmpp['xep_0060'].publish(
|
||||||
own_jid.bare, OMEMO_DEVICES_NS, payload=payload, options=options,
|
own_jid.bare, OMEMO_DEVICES_NS, payload=payload, options=options,
|
||||||
|
|
Loading…
Reference in a new issue