aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-02-19 20:58:23 +0100
committerChristian Schneppe <christian@pix-art.de>2018-02-19 20:58:23 +0100
commit2e29525bd7df66fe4eb7b5c1683ca4822acefbb3 (patch)
treeff7b57610082385de8b2e032a13b29e4f647043d
parent26ae6626b8f52b10030ad474d4b258ba533b26a9 (diff)
Namespace: Add constant for 'jabber:x:data' & Make use of Namespace.DATA constant
-rw-r--r--src/main/java/de/pixart/messenger/entities/ServiceDiscoveryResult.java3
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java6
-rw-r--r--src/main/java/de/pixart/messenger/utils/Namespace.java1
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java4
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/forms/Data.java3
-rw-r--r--src/standardPush/java/de/pixart/messenger/services/PushManagementService.java2
6 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/ServiceDiscoveryResult.java b/src/main/java/de/pixart/messenger/entities/ServiceDiscoveryResult.java
index b0c3ebb77..dda221fdc 100644
--- a/src/main/java/de/pixart/messenger/entities/ServiceDiscoveryResult.java
+++ b/src/main/java/de/pixart/messenger/entities/ServiceDiscoveryResult.java
@@ -16,6 +16,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import de.pixart.messenger.utils.Namespace;
import de.pixart.messenger.xml.Element;
import de.pixart.messenger.xmpp.forms.Data;
import de.pixart.messenger.xmpp.forms.Field;
@@ -133,7 +134,7 @@ public class ServiceDiscoveryResult {
if (element.getAttribute("var") != null) {
features.add(element.getAttribute("var"));
}
- } else if (element.getName().equals("x") && "jabber:x:data".equals(element.getAttribute("xmlns"))) {
+ } else if (element.getName().equals("x") && element.getAttribute("xmlns").equals(Namespace.DATA)) {
forms.add(Data.parse(element));
}
}
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 0af1b1567..3fe5ea9f1 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -2777,7 +2777,7 @@ public class XmppConnectionService extends Service {
}
}
}
- Element form = query.findChild("x", "jabber:x:data");
+ Element form = query.findChild("x", Namespace.DATA);
if (form != null) {
conversation.getMucOptions().updateFormData(Data.parse(form));
}
@@ -2807,7 +2807,7 @@ public class XmppConnectionService extends Service {
if (packet.getType() == IqPacket.TYPE.RESULT) {
Element pubsub = packet.findChild("pubsub", "http://jabber.org/protocol/pubsub#owner");
Element configuration = pubsub == null ? null : pubsub.findChild("configure");
- Element x = configuration == null ? null : configuration.findChild("x", "jabber:x:data");
+ Element x = configuration == null ? null : configuration.findChild("x", Namespace.DATA);
if (x != null) {
Data data = Data.parse(x);
data.submit(options);
@@ -2839,7 +2839,7 @@ public class XmppConnectionService extends Service {
@Override
public void onIqPacketReceived(Account account, IqPacket packet) {
if (packet.getType() == IqPacket.TYPE.RESULT) {
- Data data = Data.parse(packet.query().findChild("x", "jabber:x:data"));
+ Data data = Data.parse(packet.query().findChild("x", Namespace.DATA));
data.submit(options);
IqPacket set = new IqPacket(IqPacket.TYPE.SET);
set.setTo(conversation.getJid().toBareJid());
diff --git a/src/main/java/de/pixart/messenger/utils/Namespace.java b/src/main/java/de/pixart/messenger/utils/Namespace.java
index 679fc191f..2d6b4708f 100644
--- a/src/main/java/de/pixart/messenger/utils/Namespace.java
+++ b/src/main/java/de/pixart/messenger/utils/Namespace.java
@@ -10,6 +10,7 @@ public final class Namespace {
public static final String MAM = "urn:xmpp:mam:2";
public static final String MAM_LEGACY = "urn:xmpp:mam:0";
public static final String IDLE = "urn:xmpp:idle:1";
+ public static final String DATA = "jabber:x:data";
public static final String OOB = "jabber:x:oob";
public static final String SASL = "urn:ietf:params:xml:ns:xmpp-sasl";
public static final String TLS = "urn:ietf:params:xml:ns:xmpp-tls";
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index f7c80d841..f58aeb671 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -1007,8 +1007,8 @@ public class XmppConnection implements Runnable {
register.query().addChild(password);
register.setFrom(account.getJid().toBareJid());
sendUnmodifiedIqPacket(register, registrationResponseListener);
- } else if (query.hasChild("x", "jabber:x:data")) {
- final Data data = Data.parse(query.findChild("x", "jabber:x:data"));
+ } else if (query.hasChild("x", Namespace.DATA)) {
+ final Data data = Data.parse(query.findChild("x", Namespace.DATA));
final Element blob = query.findChild("data", "urn:xmpp:bob");
final String id = packet.getId();
InputStream is;
diff --git a/src/main/java/de/pixart/messenger/xmpp/forms/Data.java b/src/main/java/de/pixart/messenger/xmpp/forms/Data.java
index ed426f397..ba70a5d1a 100644
--- a/src/main/java/de/pixart/messenger/xmpp/forms/Data.java
+++ b/src/main/java/de/pixart/messenger/xmpp/forms/Data.java
@@ -7,6 +7,7 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import de.pixart.messenger.utils.Namespace;
import de.pixart.messenger.xml.Element;
public class Data extends Element {
@@ -15,7 +16,7 @@ public class Data extends Element {
public Data() {
super("x");
- this.setAttribute("xmlns", "jabber:x:data");
+ this.setAttribute("xmlns", Namespace.DATA);
}
public List<Field> getFields() {
diff --git a/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java b/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java
index c9c252501..80fb5ce1c 100644
--- a/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java
+++ b/src/standardPush/java/de/pixart/messenger/services/PushManagementService.java
@@ -43,7 +43,7 @@ public class PushManagementService {
public void onIqPacketReceived(Account account, IqPacket packet) {
Element command = packet.findChild("command", "http://jabber.org/protocol/commands");
if (packet.getType() == IqPacket.TYPE.RESULT && command != null) {
- Element x = command.findChild("x", "jabber:x:data");
+ Element x = command.findChild("x", Namespace.DATA);
if (x != null) {
Data data = Data.parse(x);
try {