Make use of Namespace.REGISTER constant (#3446)

This commit is contained in:
af8a524db1 2019-04-29 09:51:46 +02:00 committed by Daniel Gultsch
parent a99d65d7d4
commit 137d48810d
2 changed files with 4 additions and 4 deletions

View file

@ -415,7 +415,7 @@ public class IqGenerator extends AbstractGenerator {
register.setFrom(account.getJid().asBareJid()); register.setFrom(account.getJid().asBareJid());
register.setTo(Jid.of(account.getServer())); register.setTo(Jid.of(account.getServer()));
register.setId(id); register.setId(id);
Element query = register.query("jabber:iq:register"); Element query = register.query(Namespace.REGISTER);
if (data != null) { if (data != null) {
query.addChild(data); query.addChild(data);
} }

View file

@ -922,7 +922,7 @@ public class XmppConnection implements Runnable {
private void sendRegistryRequest() { private void sendRegistryRequest() {
final IqPacket register = new IqPacket(IqPacket.TYPE.GET); final IqPacket register = new IqPacket(IqPacket.TYPE.GET);
register.query("jabber:iq:register"); register.query(Namespace.REGISTER);
register.setTo(Jid.of(account.getServer())); register.setTo(Jid.of(account.getServer()));
sendUnmodifiedIqPacket(register, (account, packet) -> { sendUnmodifiedIqPacket(register, (account, packet) -> {
if (packet.getType() == IqPacket.TYPE.TIMEOUT) { if (packet.getType() == IqPacket.TYPE.TIMEOUT) {
@ -931,12 +931,12 @@ public class XmppConnection implements Runnable {
if (packet.getType() == IqPacket.TYPE.ERROR) { if (packet.getType() == IqPacket.TYPE.ERROR) {
throw new StateChangingError(Account.State.REGISTRATION_FAILED); throw new StateChangingError(Account.State.REGISTRATION_FAILED);
} }
final Element query = packet.query("jabber:iq:register"); final Element query = packet.query(Namespace.REGISTER);
if (query.hasChild("username") && (query.hasChild("password"))) { if (query.hasChild("username") && (query.hasChild("password"))) {
final IqPacket register1 = new IqPacket(IqPacket.TYPE.SET); final IqPacket register1 = new IqPacket(IqPacket.TYPE.SET);
final Element username = new Element("username").setContent(account.getUsername()); final Element username = new Element("username").setContent(account.getUsername());
final Element password = new Element("password").setContent(account.getPassword()); final Element password = new Element("password").setContent(account.getPassword());
register1.query("jabber:iq:register").addChild(username); register1.query(Namespace.REGISTER).addChild(username);
register1.query().addChild(password); register1.query().addChild(password);
register1.setFrom(account.getJid().asBareJid()); register1.setFrom(account.getJid().asBareJid());
sendUnmodifiedIqPacket(register1, registrationResponseListener, true); sendUnmodifiedIqPacket(register1, registrationResponseListener, true);