Merge pull request #2805 from af8a524db1/data_namespace
Use constant for 'jabber❌data' namespace
This commit is contained in:
commit
92d59e9741
|
@ -11,11 +11,13 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
import eu.siacs.conversations.xmpp.forms.Data;
|
import eu.siacs.conversations.xmpp.forms.Data;
|
||||||
import eu.siacs.conversations.xmpp.forms.Field;
|
import eu.siacs.conversations.xmpp.forms.Field;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
||||||
|
@ -132,7 +134,7 @@ public class ServiceDiscoveryResult {
|
||||||
if (element.getAttribute("var") != null) {
|
if (element.getAttribute("var") != null) {
|
||||||
features.add(element.getAttribute("var"));
|
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));
|
forms.add(Data.parse(element));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2591,7 +2591,7 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Element form = query.findChild("x", "jabber:x:data");
|
Element form = query.findChild("x", Namespace.DATA);
|
||||||
if (form != null) {
|
if (form != null) {
|
||||||
conversation.getMucOptions().updateFormData(Data.parse(form));
|
conversation.getMucOptions().updateFormData(Data.parse(form));
|
||||||
}
|
}
|
||||||
|
@ -2621,7 +2621,7 @@ public class XmppConnectionService extends Service {
|
||||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||||
Element pubsub = packet.findChild("pubsub", "http://jabber.org/protocol/pubsub#owner");
|
Element pubsub = packet.findChild("pubsub", "http://jabber.org/protocol/pubsub#owner");
|
||||||
Element configuration = pubsub == null ? null : pubsub.findChild("configure");
|
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) {
|
if (x != null) {
|
||||||
Data data = Data.parse(x);
|
Data data = Data.parse(x);
|
||||||
data.submit(options);
|
data.submit(options);
|
||||||
|
@ -2653,7 +2653,7 @@ public class XmppConnectionService extends Service {
|
||||||
@Override
|
@Override
|
||||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
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);
|
data.submit(options);
|
||||||
IqPacket set = new IqPacket(IqPacket.TYPE.SET);
|
IqPacket set = new IqPacket(IqPacket.TYPE.SET);
|
||||||
set.setTo(conversation.getJid().toBareJid());
|
set.setTo(conversation.getJid().toBareJid());
|
||||||
|
|
|
@ -10,6 +10,7 @@ public final class Namespace {
|
||||||
public static final String MAM = "urn:xmpp:mam:2";
|
public static final String MAM = "urn:xmpp:mam:2";
|
||||||
public static final String MAM_LEGACY = "urn:xmpp:mam:0";
|
public static final String MAM_LEGACY = "urn:xmpp:mam:0";
|
||||||
public static final String IDLE = "urn:xmpp:idle:1";
|
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 OOB = "jabber:x:oob";
|
||||||
public static final String SASL = "urn:ietf:params:xml:ns:xmpp-sasl";
|
public static final String SASL = "urn:ietf:params:xml:ns:xmpp-sasl";
|
||||||
public static final String TLS = "urn:ietf:params:xml:ns:xmpp-tls";
|
public static final String TLS = "urn:ietf:params:xml:ns:xmpp-tls";
|
||||||
|
|
|
@ -978,8 +978,8 @@ public class XmppConnection implements Runnable {
|
||||||
register.query().addChild(password);
|
register.query().addChild(password);
|
||||||
register.setFrom(account.getJid().toBareJid());
|
register.setFrom(account.getJid().toBareJid());
|
||||||
sendUnmodifiedIqPacket(register, registrationResponseListener);
|
sendUnmodifiedIqPacket(register, registrationResponseListener);
|
||||||
} else if (query.hasChild("x", "jabber:x:data")) {
|
} else if (query.hasChild("x", Namespace.DATA)) {
|
||||||
final Data data = Data.parse(query.findChild("x", "jabber:x:data"));
|
final Data data = Data.parse(query.findChild("x", Namespace.DATA));
|
||||||
final Element blob = query.findChild("data", "urn:xmpp:bob");
|
final Element blob = query.findChild("data", "urn:xmpp:bob");
|
||||||
final String id = packet.getId();
|
final String id = packet.getId();
|
||||||
InputStream is;
|
InputStream is;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
|
|
||||||
public class Data extends Element {
|
public class Data extends Element {
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ public class Data extends Element {
|
||||||
|
|
||||||
public Data() {
|
public Data() {
|
||||||
super("x");
|
super("x");
|
||||||
this.setAttribute("xmlns","jabber:x:data");
|
this.setAttribute("xmlns", Namespace.DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Field> getFields() {
|
public List<Field> getFields() {
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class PushManagementService {
|
||||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||||
Element command = packet.findChild("command","http://jabber.org/protocol/commands");
|
Element command = packet.findChild("command","http://jabber.org/protocol/commands");
|
||||||
if (packet.getType() == IqPacket.TYPE.RESULT && command != null) {
|
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) {
|
if (x != null) {
|
||||||
Data data = Data.parse(x);
|
Data data = Data.parse(x);
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue