From 0b9d38cf32d6db3e8c794134daca60619745d9d0 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 25 Aug 2016 13:50:54 +0200 Subject: [PATCH] send register IQs without full from --- .../java/eu/siacs/conversations/generator/IqGenerator.java | 2 +- .../conversations/services/XmppConnectionService.java | 2 +- .../java/eu/siacs/conversations/xmpp/XmppConnection.java | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 4116729ab..884bc4aff 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -321,7 +321,7 @@ public class IqGenerator extends AbstractGenerator { public IqPacket generateCreateAccountWithCaptcha(Account account, String id, Data data) { final IqPacket register = new IqPacket(IqPacket.TYPE.SET); - + register.setFrom(account.getJid().toBareJid()); register.setTo(account.getServer()); register.setId(id); Element query = register.query("jabber:iq:register"); diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 2f5262dee..5fe6e14e3 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -3111,7 +3111,7 @@ public class XmppConnectionService extends Service { final XmppConnection connection = account.getXmppConnection(); if (connection != null) { IqPacket request = mIqGenerator.generateCreateAccountWithCaptcha(account, id, data); - sendIqPacket(account, request, connection.registrationResponseListener); + connection.sendUnmodifiedIqPacket(request, connection.registrationResponseListener); } } diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 528c14edc..739e8ac28 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -879,7 +879,7 @@ public class XmppConnection implements Runnable { final IqPacket register = new IqPacket(IqPacket.TYPE.GET); register.query("jabber:iq:register"); register.setTo(account.getServer()); - sendIqPacket(register, new OnIqPacketReceived() { + sendUnmodifiedIqPacket(register, new OnIqPacketReceived() { @Override public void onIqPacketReceived(final Account account, final IqPacket packet) { @@ -892,7 +892,8 @@ public class XmppConnection implements Runnable { final Element password = new Element("password").setContent(account.getPassword()); register.query("jabber:iq:register").addChild(username); register.query().addChild(password); - sendIqPacket(register, registrationResponseListener); + register.setFrom(account.getJid().toBareJid()); + sendUnmodifiedIqPacket(register, registrationResponseListener); } else if (packet.getType() == IqPacket.TYPE.RESULT && (packet.query().hasChild("x", "jabber:x:data"))) { final Data data = Data.parse(packet.query().findChild("x", "jabber:x:data")); @@ -1258,7 +1259,7 @@ public class XmppConnection implements Runnable { return this.sendUnmodifiedIqPacket(packet, callback); } - private synchronized String sendUnmodifiedIqPacket(final IqPacket packet, final OnIqPacketReceived callback) { + public synchronized String sendUnmodifiedIqPacket(final IqPacket packet, final OnIqPacketReceived callback) { if (packet.getId() == null) { final String id = nextRandomId(); packet.setAttribute("id", id);