send register IQs without full from

This commit is contained in:
Daniel Gultsch 2016-08-25 13:50:54 +02:00
parent f1ecbf2ff8
commit 0b9d38cf32
3 changed files with 6 additions and 5 deletions

View File

@ -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");

View File

@ -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);
}
}

View File

@ -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);