From 137d48810dd6b92d0728324b5f959186e6eeb508 Mon Sep 17 00:00:00 2001 From: af8a524db1 <34442754+af8a524db1@users.noreply.github.com> Date: Mon, 29 Apr 2019 09:51:46 +0200 Subject: [PATCH] Make use of Namespace.REGISTER constant (#3446) --- .../java/eu/siacs/conversations/generator/IqGenerator.java | 2 +- .../java/eu/siacs/conversations/xmpp/XmppConnection.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 17f07bcb0..69af74ac2 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -415,7 +415,7 @@ public class IqGenerator extends AbstractGenerator { register.setFrom(account.getJid().asBareJid()); register.setTo(Jid.of(account.getServer())); register.setId(id); - Element query = register.query("jabber:iq:register"); + Element query = register.query(Namespace.REGISTER); if (data != null) { query.addChild(data); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 0e5f41694..90a7fe02c 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -922,7 +922,7 @@ public class XmppConnection implements Runnable { private void sendRegistryRequest() { final IqPacket register = new IqPacket(IqPacket.TYPE.GET); - register.query("jabber:iq:register"); + register.query(Namespace.REGISTER); register.setTo(Jid.of(account.getServer())); sendUnmodifiedIqPacket(register, (account, packet) -> { if (packet.getType() == IqPacket.TYPE.TIMEOUT) { @@ -931,12 +931,12 @@ public class XmppConnection implements Runnable { if (packet.getType() == IqPacket.TYPE.ERROR) { 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"))) { final IqPacket register1 = new IqPacket(IqPacket.TYPE.SET); final Element username = new Element("username").setContent(account.getUsername()); 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.setFrom(account.getJid().asBareJid()); sendUnmodifiedIqPacket(register1, registrationResponseListener, true);