From bff97731deed4c599dcb6c3a2887c9f47165dd3f Mon Sep 17 00:00:00 2001 From: steckbrief Date: Fri, 11 May 2018 19:49:27 +0200 Subject: introduces JidUtil for Jid creation, fixes duplication of childs while adding childs with xmlns and name --- .../conversationsplus/crypto/axolotl/AxolotlServiceImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java') diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java index 3569a7a5..cdf78761 100644 --- a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java +++ b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlServiceImpl.java @@ -52,6 +52,7 @@ import de.thedevstack.conversationsplus.xmpp.jid.InvalidJidException; import de.thedevstack.conversationsplus.xmpp.jid.Jid; import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacketReceiver; +import de.thedevstack.conversationsplus.xmpp.jid.JidUtil; public class AxolotlServiceImpl implements OnAdvancedStreamFeaturesLoaded, AxolotlService { @@ -166,7 +167,7 @@ public class AxolotlServiceImpl implements OnAdvancedStreamFeaturesLoaded, Axolo Bundle information = CryptoHelper.extractCertificateInformation(certificate); try { final String cn = information.getString("subject_cn"); - final Jid jid = Jid.fromString(bareJid); + final Jid jid = JidUtil.fromString(bareJid); Log.d(Config.LOGTAG,"setting common name for "+jid+" to "+cn); account.getRoster().getContact(jid).setCommonName(cn); } catch (final InvalidJidException ignored) { @@ -660,7 +661,7 @@ public class AxolotlServiceImpl implements OnAdvancedStreamFeaturesLoaded, Axolo final AxolotlAddress address = session.getRemoteAddress(); final IdentityKey identityKey = session.getIdentityKey(); try { - IqPacket packet = mXmppConnectionService.getIqGenerator().retrieveVerificationForDevice(Jid.fromString(address.getName()), address.getDeviceId()); + IqPacket packet = mXmppConnectionService.getIqGenerator().retrieveVerificationForDevice(JidUtil.fromString(address.getName()), address.getDeviceId()); mXmppConnectionService.sendIqPacket(account, packet, new OnIqPacketReceived() { @Override public void onIqPacketReceived(Account account, IqPacket packet) { @@ -681,7 +682,7 @@ public class AxolotlServiceImpl implements OnAdvancedStreamFeaturesLoaded, Axolo Bundle information = CryptoHelper.extractCertificateInformation(verification.first[0]); try { final String cn = information.getString("subject_cn"); - final Jid jid = Jid.fromString(address.getName()); + final Jid jid = JidUtil.fromString(address.getName()); Log.d(Config.LOGTAG,"setting common name for "+jid+" to "+cn); account.getRoster().getContact(jid).setCommonName(cn); } catch (final InvalidJidException ignored) { @@ -733,7 +734,7 @@ public class AxolotlServiceImpl implements OnAdvancedStreamFeaturesLoaded, Axolo try { IqPacket bundlesPacket = mXmppConnectionService.getIqGenerator().retrieveBundlesForDevice( - Jid.fromString(address.getName()), address.getDeviceId()); + JidUtil.fromString(address.getName()), address.getDeviceId()); Log.d(Config.LOGTAG, AxolotlServiceImpl.getLogprefix(account) + "Retrieving bundle: " + bundlesPacket); mXmppConnectionService.sendIqPacket(account, bundlesPacket, new OnIqPacketReceived() { -- cgit v1.2.3