From 49349d898b14aecf9133bbd8738df3a0ed4db5f1 Mon Sep 17 00:00:00 2001 From: linkmauve Date: Sat, 18 Aug 2018 17:24:29 +0100 Subject: [PATCH] add id="current" on every published PEP item (#3133) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes sure even misconfigured PEP nodes still get only one item, as defined in XEP-0060 ยง12.20. --- .../java/eu/siacs/conversations/generator/IqGenerator.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index aab0edcc0..5fa292068 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -205,6 +205,7 @@ public class IqGenerator extends AbstractGenerator { public IqPacket publishDeviceIds(final Set ids, final Bundle publishOptions) { final Element item = new Element("item"); + item.setAttribute("id", "current"); final Element list = item.addChild("list", AxolotlService.PEP_PREFIX); for (Integer id : ids) { final Element device = new Element("device"); @@ -217,6 +218,7 @@ public class IqGenerator extends AbstractGenerator { public IqPacket publishBundles(final SignedPreKeyRecord signedPreKeyRecord, final IdentityKey identityKey, final Set preKeyRecords, final int deviceId, Bundle publishOptions) { final Element item = new Element("item"); + item.setAttribute("id", "current"); final Element bundle = item.addChild("bundle", AxolotlService.PEP_PREFIX); final Element signedPreKeyPublic = bundle.addChild("signedPreKeyPublic"); signedPreKeyPublic.setAttribute("signedPreKeyId", signedPreKeyRecord.getId()); @@ -239,6 +241,7 @@ public class IqGenerator extends AbstractGenerator { public IqPacket publishVerification(byte[] signature, X509Certificate[] certificates, final int deviceId) { final Element item = new Element("item"); + item.setAttribute("id", "current"); final Element verification = item.addChild("verification", AxolotlService.PEP_PREFIX); final Element chain = verification.addChild("chain"); for (int i = 0; i < certificates.length; ++i) {