diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-08-25 13:50:54 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-08-25 13:50:54 +0200 |
commit | 0b9d38cf32d6db3e8c794134daca60619745d9d0 (patch) | |
tree | 6b418448509bc54449e1edf7088f7879a5795f0d | |
parent | f1ecbf2ff8ea9788341f9e1a33906e2f81c55cc6 (diff) |
send register IQs without full from
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 4116729a..884bc4af 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 2f5262de..5fe6e14e 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 528c14ed..739e8ac2 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); |