mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 03:52:06 +01:00
Make ExtensionElement marker interface wrt. QNAME field
ExtensionElement is now a marker interface that requires all implementation non-abstract classes to carry a static final QNAME field (of type QName). This is verified by a new unit test. Also FullyQualifiedElement is renamed to simply XmlElement. XmlElement is used over ExtensionElement when implementing classes do not statically know the qualified name of the XML elements they represent. In general, XmlElement should be used sparingly, and every XML element should be modeled by its own Java class (implementing ExtensionElement).
This commit is contained in:
parent
5493a22e44
commit
3d4e7938a7
146 changed files with 600 additions and 344 deletions
|
@ -153,6 +153,7 @@ allprojects {
|
||||||
bouncyCastleVersion = '1.68'
|
bouncyCastleVersion = '1.68'
|
||||||
guavaVersion = '30.1-jre'
|
guavaVersion = '30.1-jre'
|
||||||
mockitoVersion = '3.7.7'
|
mockitoVersion = '3.7.7'
|
||||||
|
orgReflectionsVersion = '0.9.11'
|
||||||
|
|
||||||
if (project.hasProperty("useSonatype")) {
|
if (project.hasProperty("useSonatype")) {
|
||||||
useSonatype = project.getProperty("useSonatype").toBoolean()
|
useSonatype = project.getProperty("useSonatype").toBoolean()
|
||||||
|
|
|
@ -74,7 +74,6 @@ import org.jivesoftware.smack.packet.AbstractStreamOpen;
|
||||||
import org.jivesoftware.smack.packet.Bind;
|
import org.jivesoftware.smack.packet.Bind;
|
||||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Mechanisms;
|
import org.jivesoftware.smack.packet.Mechanisms;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
|
@ -92,6 +91,7 @@ import org.jivesoftware.smack.packet.StartTls;
|
||||||
import org.jivesoftware.smack.packet.StreamError;
|
import org.jivesoftware.smack.packet.StreamError;
|
||||||
import org.jivesoftware.smack.packet.StreamOpen;
|
import org.jivesoftware.smack.packet.StreamOpen;
|
||||||
import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.packet.id.StanzaIdSource;
|
import org.jivesoftware.smack.packet.id.StanzaIdSource;
|
||||||
import org.jivesoftware.smack.parsing.ParsingExceptionCallback;
|
import org.jivesoftware.smack.parsing.ParsingExceptionCallback;
|
||||||
|
@ -239,7 +239,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
protected final Lock connectionLock = new ReentrantLock();
|
protected final Lock connectionLock = new ReentrantLock();
|
||||||
|
|
||||||
protected final Map<QName, FullyQualifiedElement> streamFeatures = new HashMap<>();
|
protected final Map<QName, XmlElement> streamFeatures = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The full JID of the authenticated user, as returned by the resource binding response of the server.
|
* The full JID of the authenticated user, as returned by the resource binding response of the server.
|
||||||
|
@ -1859,7 +1859,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
XmlPullParser.Event eventType = parser.next();
|
XmlPullParser.Event eventType = parser.next();
|
||||||
|
|
||||||
if (eventType == XmlPullParser.Event.START_ELEMENT && parser.getDepth() == initialDepth + 1) {
|
if (eventType == XmlPullParser.Event.START_ELEMENT && parser.getDepth() == initialDepth + 1) {
|
||||||
FullyQualifiedElement streamFeature = null;
|
XmlElement streamFeature = null;
|
||||||
String name = parser.getName();
|
String name = parser.getName();
|
||||||
String namespace = parser.getNamespace();
|
String namespace = parser.getNamespace();
|
||||||
switch (name) {
|
switch (name) {
|
||||||
|
@ -1928,7 +1928,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public <F extends FullyQualifiedElement> F getFeature(QName qname) {
|
public <F extends XmlElement> F getFeature(QName qname) {
|
||||||
return (F) streamFeatures.get(qname);
|
return (F) streamFeatures.get(qname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1937,7 +1937,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
return streamFeatures.containsKey(qname);
|
return streamFeatures.containsKey(qname);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addStreamFeature(FullyQualifiedElement feature) {
|
protected void addStreamFeature(XmlElement feature) {
|
||||||
QName key = feature.getQName();
|
QName key = feature.getQName();
|
||||||
streamFeatures.put(key, feature);
|
streamFeatures.put(key, feature);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import org.jivesoftware.smack.filter.IQReplyFilter;
|
||||||
import org.jivesoftware.smack.filter.StanzaFilter;
|
import org.jivesoftware.smack.filter.StanzaFilter;
|
||||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler;
|
import org.jivesoftware.smack.iqrequest.IQRequestHandler;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.MessageBuilder;
|
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||||
|
@ -36,6 +35,7 @@ import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.PresenceBuilder;
|
import org.jivesoftware.smack.packet.PresenceBuilder;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.StanzaFactory;
|
import org.jivesoftware.smack.packet.StanzaFactory;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.Consumer;
|
import org.jivesoftware.smack.util.Consumer;
|
||||||
import org.jivesoftware.smack.util.Predicate;
|
import org.jivesoftware.smack.util.Predicate;
|
||||||
import org.jivesoftware.smack.util.XmppElementUtil;
|
import org.jivesoftware.smack.util.XmppElementUtil;
|
||||||
|
@ -583,7 +583,7 @@ public interface XMPPConnection {
|
||||||
*/
|
*/
|
||||||
// TODO: Remove in Smack 4.5.
|
// TODO: Remove in Smack 4.5.
|
||||||
@Deprecated
|
@Deprecated
|
||||||
default <F extends FullyQualifiedElement> F getFeature(String element, String namespace) {
|
default <F extends XmlElement> F getFeature(String element, String namespace) {
|
||||||
QName qname = new QName(namespace, element);
|
QName qname = new QName(namespace, element);
|
||||||
return getFeature(qname);
|
return getFeature(qname);
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ public interface XMPPConnection {
|
||||||
* @return a stanza extensions of the feature or <code>null</code>
|
* @return a stanza extensions of the feature or <code>null</code>
|
||||||
* @since 4.4
|
* @since 4.4
|
||||||
*/
|
*/
|
||||||
<F extends FullyQualifiedElement> F getFeature(QName qname);
|
<F extends XmlElement> F getFeature(QName qname);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the feature stanza extensions for a given stream feature of the
|
* Get the feature stanza extensions for a given stream feature of the
|
||||||
|
@ -608,7 +608,7 @@ public interface XMPPConnection {
|
||||||
* @return a stanza extensions of the feature or <code>null</code>
|
* @return a stanza extensions of the feature or <code>null</code>
|
||||||
* @since 4.4
|
* @since 4.4
|
||||||
*/
|
*/
|
||||||
default <F extends FullyQualifiedElement> F getFeature(Class<F> featureClass) {
|
default <F extends XmlElement> F getFeature(Class<F> featureClass) {
|
||||||
QName qname = XmppElementUtil.getQNameFor(featureClass);
|
QName qname = XmppElementUtil.getQNameFor(featureClass);
|
||||||
return getFeature(qname);
|
return getFeature(qname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2020 Florian Schmaus
|
* Copyright 2020-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -20,6 +20,7 @@ import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.XmppElementUtil;
|
import org.jivesoftware.smack.util.XmppElementUtil;
|
||||||
|
|
||||||
public class ExtensionElementFilter<E extends ExtensionElement> implements StanzaFilter {
|
public class ExtensionElementFilter<E extends ExtensionElement> implements StanzaFilter {
|
||||||
|
@ -34,7 +35,7 @@ public class ExtensionElementFilter<E extends ExtensionElement> implements Stanz
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean accept(Stanza stanza) {
|
public final boolean accept(Stanza stanza) {
|
||||||
ExtensionElement extensionElement = stanza.getExtension(extensionElementQName);
|
XmlElement extensionElement = stanza.getExtension(extensionElementQName);
|
||||||
if (extensionElement == null) {
|
if (extensionElement == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2014-2015 Florian Schmaus
|
* Copyright 2014-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -32,18 +32,18 @@ public class AbstractError {
|
||||||
|
|
||||||
protected final String textNamespace;
|
protected final String textNamespace;
|
||||||
protected final Map<String, String> descriptiveTexts;
|
protected final Map<String, String> descriptiveTexts;
|
||||||
protected final List<ExtensionElement> extensions;
|
protected final List<XmlElement> extensions;
|
||||||
|
|
||||||
|
|
||||||
protected AbstractError(Map<String, String> descriptiveTexts) {
|
protected AbstractError(Map<String, String> descriptiveTexts) {
|
||||||
this(descriptiveTexts, null);
|
this(descriptiveTexts, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractError(Map<String, String> descriptiveTexts, List<ExtensionElement> extensions) {
|
protected AbstractError(Map<String, String> descriptiveTexts, List<XmlElement> extensions) {
|
||||||
this(descriptiveTexts, null, extensions);
|
this(descriptiveTexts, null, extensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractError(Map<String, String> descriptiveTexts, String textNamespace, List<ExtensionElement> extensions) {
|
protected AbstractError(Map<String, String> descriptiveTexts, String textNamespace, List<XmlElement> extensions) {
|
||||||
if (descriptiveTexts != null) {
|
if (descriptiveTexts != null) {
|
||||||
this.descriptiveTexts = descriptiveTexts;
|
this.descriptiveTexts = descriptiveTexts;
|
||||||
} else {
|
} else {
|
||||||
|
@ -108,7 +108,7 @@ public class AbstractError {
|
||||||
* @param <PE> type of the ExtensionElement.
|
* @param <PE> type of the ExtensionElement.
|
||||||
* @return the extension, or <code>null</code> if it doesn't exist.
|
* @return the extension, or <code>null</code> if it doesn't exist.
|
||||||
*/
|
*/
|
||||||
public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace) {
|
public <PE extends XmlElement> PE getExtension(String elementName, String namespace) {
|
||||||
return PacketUtil.extensionElementFrom(extensions, elementName, namespace);
|
return PacketUtil.extensionElementFrom(extensions, elementName, namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ public class AbstractError {
|
||||||
public abstract static class Builder<B extends Builder<B>> {
|
public abstract static class Builder<B extends Builder<B>> {
|
||||||
protected String textNamespace;
|
protected String textNamespace;
|
||||||
protected Map<String, String> descriptiveTexts;
|
protected Map<String, String> descriptiveTexts;
|
||||||
protected List<ExtensionElement> extensions;
|
protected List<XmlElement> extensions;
|
||||||
|
|
||||||
public B setDescriptiveTexts(Map<String, String> descriptiveTexts) {
|
public B setDescriptiveTexts(Map<String, String> descriptiveTexts) {
|
||||||
if (descriptiveTexts == null) {
|
if (descriptiveTexts == null) {
|
||||||
|
@ -173,7 +173,7 @@ public class AbstractError {
|
||||||
return getThis();
|
return getThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public B setExtensions(List<ExtensionElement> extensions) {
|
public B setExtensions(List<XmlElement> extensions) {
|
||||||
if (this.extensions == null) {
|
if (this.extensions == null) {
|
||||||
this.extensions = extensions;
|
this.extensions = extensions;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ public class AbstractError {
|
||||||
return getThis();
|
return getThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public B addExtension(ExtensionElement extension) {
|
public B addExtension(XmlElement extension) {
|
||||||
if (extensions == null) {
|
if (extensions == null) {
|
||||||
extensions = new ArrayList<>();
|
extensions = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2007 Jive Software, 2018 Florian Schmaus.
|
* Copyright 2003-2007 Jive Software, 2018-2021 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -17,21 +17,16 @@
|
||||||
package org.jivesoftware.smack.packet;
|
package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to represent extension elements.
|
* Interface to represent XMPP extension elements. Unlike {@link XmlElement}, every non-abstract class that implements
|
||||||
|
* {@link ExtensionElement} must have a static final QNAME member of the type {@link javax.xml.namespace.QName}. This
|
||||||
|
* allows type-safe functions like {@link StanzaView#getExtension(Class)}. Hence this is a marker interface.
|
||||||
* <p>
|
* <p>
|
||||||
* An extension element is an XML subdocument
|
* Use this class when implementing new extension elements when possible. This means that every instance of your
|
||||||
* with a root element name and namespace. Extension elements are used to provide
|
* implemented class must represent an XML element of the same qualified name.
|
||||||
* extended functionality beyond what is in the base XMPP specification. Examples of
|
|
||||||
* extensions elements include message events, message properties, and extra presence data.
|
|
||||||
* IQ stanzas have limited support for extension elements.
|
|
||||||
* <p>
|
|
||||||
* This class is used primarily for extended content in XMPP Stanzas, to act as so called "extension elements". For more
|
|
||||||
* information see <a href="https://tools.ietf.org/html/rfc6120#section-8.4">RFC 6120 § 8.4 Extended Content</a>.
|
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @see org.jivesoftware.smack.provider.ExtensionElementProvider
|
* @see <a href="https://tools.ietf.org/html/rfc6120#section-8.4">RFC 6120 § 8.4 Extended Content</a>
|
||||||
* @author Matt Tucker
|
|
||||||
*/
|
*/
|
||||||
public interface ExtensionElement extends FullyQualifiedElement {
|
public interface ExtensionElement extends XmlElement {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ public abstract class IQ extends Stanza implements IqView {
|
||||||
|
|
||||||
xml.append(iqChildElement);
|
xml.append(iqChildElement);
|
||||||
|
|
||||||
List<ExtensionElement> extensionsXml = getExtensions();
|
List<XmlElement> extensionsXml = getExtensions();
|
||||||
if (iqChildElement.isEmptyElement) {
|
if (iqChildElement.isEmptyElement) {
|
||||||
if (extensionsXml.isEmpty()) {
|
if (extensionsXml.isEmpty()) {
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
|
|
@ -344,7 +344,7 @@ public final class Message extends MessageOrPresence<MessageBuilder>
|
||||||
@Deprecated
|
@Deprecated
|
||||||
// TODO: Remove when stanza builder is ready.
|
// TODO: Remove when stanza builder is ready.
|
||||||
public boolean removeBody(Body body) {
|
public boolean removeBody(Body body) {
|
||||||
ExtensionElement removedElement = removeExtension(body);
|
XmlElement removedElement = removeExtension(body);
|
||||||
return removedElement != null;
|
return removedElement != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2007 Jive Software, 2019-2020 Florian Schmaus
|
* Copyright 2003-2007 Jive Software, 2019-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -150,9 +150,9 @@ public interface MessageView extends StanzaView {
|
||||||
* @since 3.0.2
|
* @since 3.0.2
|
||||||
*/
|
*/
|
||||||
default Set<Message.Body> getBodies() {
|
default Set<Message.Body> getBodies() {
|
||||||
List<ExtensionElement> bodiesList = getExtensions(Message.Body.QNAME);
|
List<XmlElement> bodiesList = getExtensions(Message.Body.QNAME);
|
||||||
Set<Message.Body> resultSet = new HashSet<>(bodiesList.size());
|
Set<Message.Body> resultSet = new HashSet<>(bodiesList.size());
|
||||||
for (ExtensionElement extensionElement : bodiesList) {
|
for (XmlElement extensionElement : bodiesList) {
|
||||||
Message.Body body = (Message.Body) extensionElement;
|
Message.Body body = (Message.Body) extensionElement;
|
||||||
resultSet.add(body);
|
resultSet.add(body);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ package org.jivesoftware.smack.packet;
|
||||||
* <p>
|
* <p>
|
||||||
* Please note that usage of this interface is <b>discouraged</b>. The reason is that every XML element is fully
|
* Please note that usage of this interface is <b>discouraged</b>. The reason is that every XML element is fully
|
||||||
* qualified, i.e., it is qualified by a namespace. The namespace may not be explicitly given, but instead, is inherited
|
* qualified, i.e., it is qualified by a namespace. The namespace may not be explicitly given, but instead, is inherited
|
||||||
* from an outer element. Use {@link FullyQualifiedElement} instead when possible.
|
* from an outer element. Use {@link XmlElement} instead when possible.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public interface NamedElement extends Element {
|
public interface NamedElement extends Element {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2007 Jive Software, 2020 Florian Schmaus.
|
* Copyright 2003-2007 Jive Software, 2020-2021 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -319,7 +319,7 @@ public final class Presence extends MessageOrPresence<PresenceBuilder>
|
||||||
buf.attribute("type", type);
|
buf.attribute("type", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ExtensionElement> extensions = getExtensions();
|
List<XmlElement> extensions = getExtensions();
|
||||||
if (status == null
|
if (status == null
|
||||||
&& priority == null
|
&& priority == null
|
||||||
&& (mode == null || mode == Mode.available)
|
&& (mode == null || mode == Mode.available)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2015-2020 Florian Schmaus.
|
* Copyright 2015-2021 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -41,7 +41,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
* @author Florian Schmaus
|
* @author Florian Schmaus
|
||||||
*/
|
*/
|
||||||
public final class StandardExtensionElement implements ExtensionElement {
|
public final class StandardExtensionElement implements XmlElement {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String namespace;
|
private final String namespace;
|
||||||
|
|
|
@ -64,7 +64,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
protected static final String DEFAULT_LANGUAGE =
|
protected static final String DEFAULT_LANGUAGE =
|
||||||
java.util.Locale.getDefault().getLanguage().toLowerCase(Locale.US);
|
java.util.Locale.getDefault().getLanguage().toLowerCase(Locale.US);
|
||||||
|
|
||||||
private final MultiMap<QName, ExtensionElement> extensionElements;
|
private final MultiMap<QName, XmlElement> extensionElements;
|
||||||
|
|
||||||
// Assume that all stanzas Smack handles are in the client namespace, since Smack is an XMPP client library. We can
|
// Assume that all stanzas Smack handles are in the client namespace, since Smack is an XMPP client library. We can
|
||||||
// change this behavior later if it is required.
|
// change this behavior later if it is required.
|
||||||
|
@ -284,18 +284,18 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final List<ExtensionElement> getExtensions() {
|
public final List<XmlElement> getExtensions() {
|
||||||
synchronized (extensionElements) {
|
synchronized (extensionElements) {
|
||||||
// No need to create a new list, values() will already create a new one for us
|
// No need to create a new list, values() will already create a new one for us
|
||||||
return extensionElements.values();
|
return extensionElements.values();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final MultiMap<QName, ExtensionElement> getExtensionsMap() {
|
public final MultiMap<QName, XmlElement> getExtensionsMap() {
|
||||||
return cloneExtensionsMap();
|
return cloneExtensionsMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
final MultiMap<QName, ExtensionElement> cloneExtensionsMap() {
|
final MultiMap<QName, XmlElement> cloneExtensionsMap() {
|
||||||
synchronized (extensionElements) {
|
synchronized (extensionElements) {
|
||||||
return extensionElements.clone();
|
return extensionElements.clone();
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
* @return a set of all matching extensions.
|
* @return a set of all matching extensions.
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public final List<ExtensionElement> getExtensions(String elementName, String namespace) {
|
public final List<XmlElement> getExtensions(String elementName, String namespace) {
|
||||||
requireNotNullNorEmpty(elementName, "elementName must not be null nor empty");
|
requireNotNullNorEmpty(elementName, "elementName must not be null nor empty");
|
||||||
requireNotNullNorEmpty(namespace, "namespace must not be null nor empty");
|
requireNotNullNorEmpty(namespace, "namespace must not be null nor empty");
|
||||||
QName key = new QName(namespace, elementName);
|
QName key = new QName(namespace, elementName);
|
||||||
|
@ -320,8 +320,8 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final List<ExtensionElement> getExtensions(QName qname) {
|
public final List<XmlElement> getExtensions(QName qname) {
|
||||||
List<ExtensionElement> res;
|
List<XmlElement> res;
|
||||||
synchronized (extensionElements) {
|
synchronized (extensionElements) {
|
||||||
res = extensionElements.getAll(qname);
|
res = extensionElements.getAll(qname);
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,8 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
* @param namespace the namespace of the extension that is desired.
|
* @param namespace the namespace of the extension that is desired.
|
||||||
* @return the stanza extension with the given namespace.
|
* @return the stanza extension with the given namespace.
|
||||||
*/
|
*/
|
||||||
public final ExtensionElement getExtension(String namespace) {
|
// TODO: Mark this method as deprecated in favor of getExtension(QName).
|
||||||
|
public final XmlElement getExtension(String namespace) {
|
||||||
return PacketUtil.extensionElementFrom(getExtensions(), null, namespace);
|
return PacketUtil.extensionElementFrom(getExtensions(), null, namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,12 +362,12 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
* @param namespace the XML element namespace of the extension.
|
* @param namespace the XML element namespace of the extension.
|
||||||
* @return the extension, or <code>null</code> if it doesn't exist.
|
* @return the extension, or <code>null</code> if it doesn't exist.
|
||||||
*/
|
*/
|
||||||
public final ExtensionElement getExtensionElement(String elementName, String namespace) {
|
public final XmlElement getExtensionElement(String elementName, String namespace) {
|
||||||
if (namespace == null) {
|
if (namespace == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
QName key = new QName(namespace, elementName);
|
QName key = new QName(namespace, elementName);
|
||||||
ExtensionElement packetExtension = getExtension(key);
|
XmlElement packetExtension = getExtension(key);
|
||||||
if (packetExtension == null) {
|
if (packetExtension == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -390,7 +391,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final ExtensionElement getExtension(QName qname) {
|
public final XmlElement getExtension(QName qname) {
|
||||||
synchronized (extensionElements) {
|
synchronized (extensionElements) {
|
||||||
return extensionElements.getFirst(qname);
|
return extensionElements.getFirst(qname);
|
||||||
}
|
}
|
||||||
|
@ -400,13 +401,13 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
* Adds a stanza extension to the packet. Does nothing if extension is null.
|
* Adds a stanza extension to the packet. Does nothing if extension is null.
|
||||||
* <p>
|
* <p>
|
||||||
* Please note that although this method is not yet marked as deprecated, it is recommended to use
|
* Please note that although this method is not yet marked as deprecated, it is recommended to use
|
||||||
* {@link StanzaBuilder#addExtension(ExtensionElement)} instead.
|
* {@link StanzaBuilder#addExtension(XmlElement)} instead.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param extension a stanza extension.
|
* @param extension a stanza extension.
|
||||||
*/
|
*/
|
||||||
// TODO: Mark this as deprecated once StanzaBuilder is ready and all call sites are gone.
|
// TODO: Mark this as deprecated once StanzaBuilder is ready and all call sites are gone.
|
||||||
public final void addExtension(ExtensionElement extension) {
|
public final void addExtension(XmlElement extension) {
|
||||||
if (extension == null) return;
|
if (extension == null) return;
|
||||||
QName key = extension.getQName();
|
QName key = extension.getQName();
|
||||||
synchronized (extensionElements) {
|
synchronized (extensionElements) {
|
||||||
|
@ -419,7 +420,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
* namespace.
|
* namespace.
|
||||||
* <p>
|
* <p>
|
||||||
* Please note that although this method is not yet marked as deprecated, it is recommended to use
|
* Please note that although this method is not yet marked as deprecated, it is recommended to use
|
||||||
* {@link StanzaBuilder#overrideExtension(ExtensionElement)} instead.
|
* {@link StanzaBuilder#overrideExtension(XmlElement)} instead.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param extension the extension element to add.
|
* @param extension the extension element to add.
|
||||||
|
@ -427,13 +428,13 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
* @since 4.1.2
|
* @since 4.1.2
|
||||||
*/
|
*/
|
||||||
// TODO: Mark this as deprecated once StanzaBuilder is ready and all call sites are gone.
|
// TODO: Mark this as deprecated once StanzaBuilder is ready and all call sites are gone.
|
||||||
public final ExtensionElement overrideExtension(ExtensionElement extension) {
|
public final XmlElement overrideExtension(XmlElement extension) {
|
||||||
if (extension == null) return null;
|
if (extension == null) return null;
|
||||||
synchronized (extensionElements) {
|
synchronized (extensionElements) {
|
||||||
// Note that we need to use removeExtension(String, String) here. If would use
|
// Note that we need to use removeExtension(String, String) here. If would use
|
||||||
// removeExtension(ExtensionElement) then we would remove based on the equality of ExtensionElement, which
|
// removeExtension(ExtensionElement) then we would remove based on the equality of ExtensionElement, which
|
||||||
// is not what we want in this case.
|
// is not what we want in this case.
|
||||||
ExtensionElement removedExtension = removeExtension(extension.getElementName(), extension.getNamespace());
|
XmlElement removedExtension = removeExtension(extension.getElementName(), extension.getNamespace());
|
||||||
addExtension(extension);
|
addExtension(extension);
|
||||||
return removedExtension;
|
return removedExtension;
|
||||||
}
|
}
|
||||||
|
@ -445,9 +446,9 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
* @param extensions a collection of stanza extensions
|
* @param extensions a collection of stanza extensions
|
||||||
*/
|
*/
|
||||||
// TODO: Mark this as deprecated once StanzaBuilder is ready and all call sites are gone.
|
// TODO: Mark this as deprecated once StanzaBuilder is ready and all call sites are gone.
|
||||||
public final void addExtensions(Collection<? extends ExtensionElement> extensions) {
|
public final void addExtensions(Collection<? extends XmlElement> extensions) {
|
||||||
if (extensions == null) return;
|
if (extensions == null) return;
|
||||||
for (ExtensionElement packetExtension : extensions) {
|
for (XmlElement packetExtension : extensions) {
|
||||||
addExtension(packetExtension);
|
addExtension(packetExtension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -476,7 +477,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
@Override
|
@Override
|
||||||
public final boolean hasExtension(String namespace) {
|
public final boolean hasExtension(String namespace) {
|
||||||
synchronized (extensionElements) {
|
synchronized (extensionElements) {
|
||||||
for (ExtensionElement packetExtension : extensionElements.values()) {
|
for (XmlElement packetExtension : extensionElements.values()) {
|
||||||
if (packetExtension.getNamespace().equals(namespace)) {
|
if (packetExtension.getNamespace().equals(namespace)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +494,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
* @return the removed stanza extension or null.
|
* @return the removed stanza extension or null.
|
||||||
*/
|
*/
|
||||||
// TODO: Mark this as deprecated once StanzaBuilder is ready and all call sites are gone.
|
// TODO: Mark this as deprecated once StanzaBuilder is ready and all call sites are gone.
|
||||||
public final ExtensionElement removeExtension(String elementName, String namespace) {
|
public final XmlElement removeExtension(String elementName, String namespace) {
|
||||||
QName key = new QName(namespace, elementName);
|
QName key = new QName(namespace, elementName);
|
||||||
synchronized (extensionElements) {
|
synchronized (extensionElements) {
|
||||||
return extensionElements.remove(key);
|
return extensionElements.remove(key);
|
||||||
|
@ -509,10 +510,10 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
// TODO: Remove in Smack 4.5.
|
// TODO: Remove in Smack 4.5.
|
||||||
public final ExtensionElement removeExtension(ExtensionElement extension) {
|
public final XmlElement removeExtension(XmlElement extension) {
|
||||||
QName key = extension.getQName();
|
QName key = extension.getQName();
|
||||||
synchronized (extensionElements) {
|
synchronized (extensionElements) {
|
||||||
List<ExtensionElement> list = extensionElements.getAll(key);
|
List<XmlElement> list = extensionElements.getAll(key);
|
||||||
boolean removed = list.remove(extension);
|
boolean removed = list.remove(extension);
|
||||||
if (removed) {
|
if (removed) {
|
||||||
return extension;
|
return extension;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2019-2020 Florian Schmaus
|
* Copyright 2019-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -44,7 +44,7 @@ public abstract class StanzaBuilder<B extends StanzaBuilder<B>> implements Stanz
|
||||||
|
|
||||||
String language;
|
String language;
|
||||||
|
|
||||||
MultiMap<QName, ExtensionElement> extensionElements = new MultiMap<>();
|
MultiMap<QName, XmlElement> extensionElements = new MultiMap<>();
|
||||||
|
|
||||||
protected StanzaBuilder(StanzaBuilder<?> other) {
|
protected StanzaBuilder(StanzaBuilder<?> other) {
|
||||||
stanzaIdSource = other.stanzaIdSource;
|
stanzaIdSource = other.stanzaIdSource;
|
||||||
|
@ -156,13 +156,13 @@ public abstract class StanzaBuilder<B extends StanzaBuilder<B>> implements Stanz
|
||||||
return getThis();
|
return getThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final B addExtension(ExtensionElement extensionElement) {
|
public final B addExtension(XmlElement extensionElement) {
|
||||||
QName key = extensionElement.getQName();
|
QName key = extensionElement.getQName();
|
||||||
extensionElements.put(key, extensionElement);
|
extensionElements.put(key, extensionElement);
|
||||||
return getThis();
|
return getThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final B addOptExtensions(Collection<? extends ExtensionElement> extensionElements) {
|
public final B addOptExtensions(Collection<? extends XmlElement> extensionElements) {
|
||||||
if (extensionElements == null) {
|
if (extensionElements == null) {
|
||||||
return getThis();
|
return getThis();
|
||||||
}
|
}
|
||||||
|
@ -170,14 +170,14 @@ public abstract class StanzaBuilder<B extends StanzaBuilder<B>> implements Stanz
|
||||||
return addExtensions(extensionElements);
|
return addExtensions(extensionElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final B addExtensions(Collection<? extends ExtensionElement> extensionElements) {
|
public final B addExtensions(Collection<? extends XmlElement> extensionElements) {
|
||||||
for (ExtensionElement extensionElement : extensionElements) {
|
for (XmlElement extensionElement : extensionElements) {
|
||||||
addExtension(extensionElement);
|
addExtension(extensionElement);
|
||||||
}
|
}
|
||||||
return getThis();
|
return getThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final B overrideExtension(ExtensionElement extensionElement) {
|
public final B overrideExtension(XmlElement extensionElement) {
|
||||||
QName key = extensionElement.getQName();
|
QName key = extensionElement.getQName();
|
||||||
extensionElements.remove(key);
|
extensionElements.remove(key);
|
||||||
extensionElements.put(key, extensionElement);
|
extensionElements.put(key, extensionElement);
|
||||||
|
@ -214,17 +214,17 @@ public abstract class StanzaBuilder<B extends StanzaBuilder<B>> implements Stanz
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final ExtensionElement getExtension(QName qname) {
|
public final XmlElement getExtension(QName qname) {
|
||||||
return extensionElements.getFirst(qname);
|
return extensionElements.getFirst(qname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final List<ExtensionElement> getExtensions() {
|
public final List<XmlElement> getExtensions() {
|
||||||
return extensionElements.values();
|
return extensionElements.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final List<ExtensionElement> getExtensions(QName qname) {
|
public final List<XmlElement> getExtensions(QName qname) {
|
||||||
return extensionElements.getAll(qname);
|
return extensionElements.getAll(qname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class StanzaError extends AbstractError implements ExtensionElement {
|
||||||
* @param extensions list of stanza extensions
|
* @param extensions list of stanza extensions
|
||||||
*/
|
*/
|
||||||
public StanzaError(Condition condition, String conditionText, String errorGenerator, Type type, Map<String, String> descriptiveTexts,
|
public StanzaError(Condition condition, String conditionText, String errorGenerator, Type type, Map<String, String> descriptiveTexts,
|
||||||
List<ExtensionElement> extensions) {
|
List<XmlElement> extensions) {
|
||||||
super(descriptiveTexts, ERROR_CONDITION_AND_TEXT_NAMESPACE, extensions);
|
super(descriptiveTexts, ERROR_CONDITION_AND_TEXT_NAMESPACE, extensions);
|
||||||
this.condition = Objects.requireNonNull(condition, "condition must not be null");
|
this.condition = Objects.requireNonNull(condition, "condition must not be null");
|
||||||
// Some implementations may send the condition as non-empty element containing the empty string, that is
|
// Some implementations may send the condition as non-empty element containing the empty string, that is
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2019-2020 Florian Schmaus
|
* Copyright 2019-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -61,7 +61,7 @@ public interface StanzaView extends XmlLangElement {
|
||||||
*/
|
*/
|
||||||
StanzaError getError();
|
StanzaError getError();
|
||||||
|
|
||||||
ExtensionElement getExtension(QName qname);
|
XmlElement getExtension(QName qname);
|
||||||
|
|
||||||
default boolean hasExtension(QName qname) {
|
default boolean hasExtension(QName qname) {
|
||||||
return getExtension(qname) != null;
|
return getExtension(qname) != null;
|
||||||
|
@ -78,7 +78,7 @@ public interface StanzaView extends XmlLangElement {
|
||||||
* @return true if a stanza extension exists, false otherwise.
|
* @return true if a stanza extension exists, false otherwise.
|
||||||
*/
|
*/
|
||||||
default boolean hasExtension(String namespace) {
|
default boolean hasExtension(String namespace) {
|
||||||
for (ExtensionElement packetExtension : getExtensions()) {
|
for (XmlElement packetExtension : getExtensions()) {
|
||||||
if (packetExtension.getNamespace().equals(namespace)) {
|
if (packetExtension.getNamespace().equals(namespace)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public interface StanzaView extends XmlLangElement {
|
||||||
|
|
||||||
default <E extends ExtensionElement> E getExtension(Class<E> extensionElementClass) {
|
default <E extends ExtensionElement> E getExtension(Class<E> extensionElementClass) {
|
||||||
QName qname = XmppElementUtil.getQNameFor(extensionElementClass);
|
QName qname = XmppElementUtil.getQNameFor(extensionElementClass);
|
||||||
ExtensionElement extensionElement = getExtension(qname);
|
XmlElement extensionElement = getExtension(qname);
|
||||||
|
|
||||||
if (extensionElement == null) {
|
if (extensionElement == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -103,9 +103,9 @@ public interface StanzaView extends XmlLangElement {
|
||||||
*
|
*
|
||||||
* @return a list of all extension elements of this stanza.
|
* @return a list of all extension elements of this stanza.
|
||||||
*/
|
*/
|
||||||
List<ExtensionElement> getExtensions();
|
List<XmlElement> getExtensions();
|
||||||
|
|
||||||
List<ExtensionElement> getExtensions(QName qname);
|
List<XmlElement> getExtensions(QName qname);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all extension elements of the given type. Returns the empty list if there a none.
|
* Return all extension elements of the given type. Returns the empty list if there a none.
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class StreamError extends AbstractError implements Nonza {
|
||||||
private final Condition condition;
|
private final Condition condition;
|
||||||
private final String conditionText;
|
private final String conditionText;
|
||||||
|
|
||||||
public StreamError(Condition condition, String conditionText, Map<String, String> descriptiveTexts, List<ExtensionElement> extensions) {
|
public StreamError(Condition condition, String conditionText, Map<String, String> descriptiveTexts, List<XmlElement> extensions) {
|
||||||
super(descriptiveTexts, extensions);
|
super(descriptiveTexts, extensions);
|
||||||
// Some implementations may send the condition as non-empty element containing the empty string, that is
|
// Some implementations may send the condition as non-empty element containing the empty string, that is
|
||||||
// <condition xmlns='foo'></condition>, in this case the parser may calls this constructor with the empty string
|
// <condition xmlns='foo'></condition>, in this case the parser may calls this constructor with the empty string
|
||||||
|
|
|
@ -20,6 +20,6 @@ package org.jivesoftware.smack.packet;
|
||||||
* A XMPP top level stream element. This is either a stanza ({@link Stanza}) or
|
* A XMPP top level stream element. This is either a stanza ({@link Stanza}) or
|
||||||
* just a plain stream element ({@link Nonza}).
|
* just a plain stream element ({@link Nonza}).
|
||||||
*/
|
*/
|
||||||
public interface TopLevelStreamElement extends FullyQualifiedElement {
|
public interface TopLevelStreamElement extends XmlElement {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2018-2019 Florian Schmaus
|
* Copyright 2018-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -18,7 +18,23 @@ package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
public interface FullyQualifiedElement extends NamedElement, XmlLangElement {
|
/**
|
||||||
|
* Interface to represent XML elements. Every XML element in XMPP has a qualified XML name ({@link QName}). This name
|
||||||
|
* can be obtained via {@link #getQName()}.
|
||||||
|
* <p>
|
||||||
|
* XMPP uses "extension elements", i.e. XML elements, to provide extended functionality beyond what is in the base XMPP
|
||||||
|
* specification. Examples of extensions elements include message events, message properties, and extra presence data.
|
||||||
|
* IQ stanzas have limited support for extension elements. See {@link ExtensionElement} for more information about XMPP
|
||||||
|
* extension elements.
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* It is recommend to use {@link ExtensionElement} over this class when creating new extension elements.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @see org.jivesoftware.smack.provider.ExtensionElementProvider
|
||||||
|
* @since 4.5
|
||||||
|
*/
|
||||||
|
public interface XmlElement extends NamedElement, XmlLangElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the root element XML namespace.
|
* Returns the root element XML namespace.
|
|
@ -22,7 +22,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
|
@ -82,7 +82,7 @@ import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*/
|
*/
|
||||||
public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> extends ExtensionElementProvider<PE> {
|
public abstract class EmbeddedExtensionProvider<PE extends XmlElement> extends ExtensionElementProvider<PE> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final PE parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
public final PE parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
|
@ -95,7 +95,7 @@ public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> ext
|
||||||
attMap.put(parser.getAttributeName(i), parser.getAttributeValue(i));
|
attMap.put(parser.getAttributeName(i), parser.getAttributeValue(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ExtensionElement> extensions = new ArrayList<>();
|
List<XmlElement> extensions = new ArrayList<>();
|
||||||
XmlPullParser.Event event;
|
XmlPullParser.Event event;
|
||||||
do {
|
do {
|
||||||
event = parser.next();
|
event = parser.next();
|
||||||
|
@ -109,5 +109,5 @@ public abstract class EmbeddedExtensionProvider<PE extends ExtensionElement> ext
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract PE createReturnExtension(String currentElement, String currentNamespace,
|
protected abstract PE createReturnExtension(String currentElement, String currentNamespace,
|
||||||
Map<String, String> attributeMap, List<? extends ExtensionElement> content);
|
Map<String, String> attributeMap, List<? extends XmlElement> content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.jivesoftware.smack.provider;
|
package org.jivesoftware.smack.provider;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An abstract class for parsing custom extensions elements. Each ExtensionElementProvider must
|
* An abstract class for parsing custom extensions elements. Each ExtensionElementProvider must
|
||||||
|
@ -26,6 +26,6 @@ import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
*
|
*
|
||||||
* @author Matt Tucker
|
* @author Matt Tucker
|
||||||
*/
|
*/
|
||||||
public abstract class ExtensionElementProvider<EE extends ExtensionElement> extends Provider<EE> {
|
public abstract class ExtensionElementProvider<E extends XmlElement> extends Provider<E> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ import org.jivesoftware.smack.packet.StanzaError;
|
||||||
import org.jivesoftware.smack.packet.StartTls;
|
import org.jivesoftware.smack.packet.StartTls;
|
||||||
import org.jivesoftware.smack.packet.StreamError;
|
import org.jivesoftware.smack.packet.StreamError;
|
||||||
import org.jivesoftware.smack.packet.UnparsedIQ;
|
import org.jivesoftware.smack.packet.UnparsedIQ;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
|
import org.jivesoftware.smack.parsing.StandardExtensionElementProvider;
|
||||||
|
@ -183,7 +184,7 @@ public class PacketParserUtils {
|
||||||
message.setError(parseError(parser, messageXmlEnvironment));
|
message.setError(parseError(parser, messageXmlEnvironment));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ExtensionElement extensionElement = parseExtensionElement(elementName, namespace, parser, messageXmlEnvironment);
|
XmlElement extensionElement = parseExtensionElement(elementName, namespace, parser, messageXmlEnvironment);
|
||||||
message.addExtension(extensionElement);
|
message.addExtension(extensionElement);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -474,7 +475,7 @@ public class PacketParserUtils {
|
||||||
// Be extra robust: Skip PacketExtensions that cause Exceptions, instead of
|
// Be extra robust: Skip PacketExtensions that cause Exceptions, instead of
|
||||||
// failing completely here. See SMACK-390 for more information.
|
// failing completely here. See SMACK-390 for more information.
|
||||||
try {
|
try {
|
||||||
ExtensionElement extensionElement = parseExtensionElement(elementName, namespace, parser, presenceXmlEnvironment);
|
XmlElement extensionElement = parseExtensionElement(elementName, namespace, parser, presenceXmlEnvironment);
|
||||||
presence.addExtension(extensionElement);
|
presence.addExtension(extensionElement);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.log(Level.WARNING, "Failed to parse extension element in Presence stanza: " + presence, e);
|
LOGGER.log(Level.WARNING, "Failed to parse extension element in Presence stanza: " + presence, e);
|
||||||
|
@ -701,7 +702,7 @@ public class PacketParserUtils {
|
||||||
*/
|
*/
|
||||||
public static StreamError parseStreamError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
public static StreamError parseStreamError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
List<ExtensionElement> extensions = new ArrayList<>();
|
List<XmlElement> extensions = new ArrayList<>();
|
||||||
Map<String, String> descriptiveTexts = null;
|
Map<String, String> descriptiveTexts = null;
|
||||||
StreamError.Condition condition = null;
|
StreamError.Condition condition = null;
|
||||||
String conditionText = null;
|
String conditionText = null;
|
||||||
|
@ -765,7 +766,7 @@ public class PacketParserUtils {
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
Map<String, String> descriptiveTexts = null;
|
Map<String, String> descriptiveTexts = null;
|
||||||
XmlEnvironment stanzaErrorXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
|
XmlEnvironment stanzaErrorXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
|
||||||
List<ExtensionElement> extensions = new ArrayList<>();
|
List<XmlElement> extensions = new ArrayList<>();
|
||||||
StanzaError.Builder builder = StanzaError.getBuilder();
|
StanzaError.Builder builder = StanzaError.getBuilder();
|
||||||
|
|
||||||
// Parse the error header
|
// Parse the error header
|
||||||
|
@ -825,7 +826,7 @@ public class PacketParserUtils {
|
||||||
* @throws IOException if an I/O error occurred.
|
* @throws IOException if an I/O error occurred.
|
||||||
* @throws SmackParsingException if the Smack parser (provider) encountered invalid input.
|
* @throws SmackParsingException if the Smack parser (provider) encountered invalid input.
|
||||||
*/
|
*/
|
||||||
public static ExtensionElement parseExtensionElement(String elementName, String namespace,
|
public static XmlElement parseExtensionElement(String elementName, String namespace,
|
||||||
XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
ParserUtils.assertAtStartTag(parser);
|
ParserUtils.assertAtStartTag(parser);
|
||||||
// See if a provider is registered to handle the extension.
|
// See if a provider is registered to handle the extension.
|
||||||
|
@ -907,7 +908,7 @@ public class PacketParserUtils {
|
||||||
|
|
||||||
public static void addExtensionElement(StanzaBuilder<?> stanzaBuilder, XmlPullParser parser, String elementName,
|
public static void addExtensionElement(StanzaBuilder<?> stanzaBuilder, XmlPullParser parser, String elementName,
|
||||||
String namespace, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
String namespace, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
ExtensionElement extensionElement = parseExtensionElement(elementName, namespace, parser, outerXmlEnvironment);
|
XmlElement extensionElement = parseExtensionElement(elementName, namespace, parser, outerXmlEnvironment);
|
||||||
stanzaBuilder.addExtension(extensionElement);
|
stanzaBuilder.addExtension(extensionElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,18 +920,18 @@ public class PacketParserUtils {
|
||||||
|
|
||||||
public static void addExtensionElement(Stanza packet, XmlPullParser parser, String elementName,
|
public static void addExtensionElement(Stanza packet, XmlPullParser parser, String elementName,
|
||||||
String namespace, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
String namespace, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser, outerXmlEnvironment);
|
XmlElement packetExtension = parseExtensionElement(elementName, namespace, parser, outerXmlEnvironment);
|
||||||
packet.addExtension(packetExtension);
|
packet.addExtension(packetExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser, XmlEnvironment outerXmlEnvironment)
|
public static void addExtensionElement(Collection<XmlElement> collection, XmlPullParser parser, XmlEnvironment outerXmlEnvironment)
|
||||||
throws XmlPullParserException, IOException, SmackParsingException {
|
throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
addExtensionElement(collection, parser, parser.getName(), parser.getNamespace(), outerXmlEnvironment);
|
addExtensionElement(collection, parser, parser.getName(), parser.getNamespace(), outerXmlEnvironment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser parser,
|
public static void addExtensionElement(Collection<XmlElement> collection, XmlPullParser parser,
|
||||||
String elementName, String namespace, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
String elementName, String namespace, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser, outerXmlEnvironment);
|
XmlElement packetExtension = parseExtensionElement(elementName, namespace, parser, outerXmlEnvironment);
|
||||||
collection.add(packetExtension);
|
collection.add(packetExtension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2014-2020 Florian Schmaus
|
* Copyright © 2014-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -18,7 +18,7 @@ package org.jivesoftware.smack.util;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
public class PacketUtil {
|
public class PacketUtil {
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ public class PacketUtil {
|
||||||
* @return the extension element
|
* @return the extension element
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <PE extends ExtensionElement> PE extensionElementFrom(Collection<ExtensionElement> collection,
|
public static <PE extends XmlElement> PE extensionElementFrom(Collection<XmlElement> collection,
|
||||||
String element, String namespace) {
|
String element, String namespace) {
|
||||||
for (ExtensionElement packetExtension : collection) {
|
for (XmlElement packetExtension : collection) {
|
||||||
if ((element == null || packetExtension.getElementName().equals(
|
if ((element == null || packetExtension.getElementName().equals(
|
||||||
element))
|
element))
|
||||||
&& packetExtension.getNamespace().equals(namespace)) {
|
&& packetExtension.getNamespace().equals(namespace)) {
|
||||||
|
|
|
@ -24,8 +24,8 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Element;
|
import org.jivesoftware.smack.packet.Element;
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
|
|
||||||
import org.jxmpp.util.XmppDateTime;
|
import org.jxmpp.util.XmppDateTime;
|
||||||
|
@ -42,7 +42,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
effectiveXmlEnvironment = null;
|
effectiveXmlEnvironment = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder(FullyQualifiedElement pe) {
|
public XmlStringBuilder(XmlElement pe) {
|
||||||
this(pe, null);
|
this(pe, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
halfOpenElement(e.getElementName());
|
halfOpenElement(e.getElementName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlStringBuilder(FullyQualifiedElement element, XmlEnvironment enclosingXmlEnvironment) {
|
public XmlStringBuilder(XmlElement element, XmlEnvironment enclosingXmlEnvironment) {
|
||||||
sb = new LazyStringBuilder();
|
sb = new LazyStringBuilder();
|
||||||
halfOpenElement(element);
|
halfOpenElement(element);
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
return escape(text.toString());
|
return escape(text.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected XmlStringBuilder prelude(FullyQualifiedElement pe) {
|
protected XmlStringBuilder prelude(XmlElement pe) {
|
||||||
return prelude(pe.getElementName(), pe.getNamespace());
|
return prelude(pe.getElementName(), pe.getNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2018-2020 Florian Schmaus
|
* Copyright 2018-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,19 +24,19 @@ import java.util.logging.Logger;
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
|
||||||
import org.jivesoftware.smack.packet.StandardExtensionElement;
|
import org.jivesoftware.smack.packet.StandardExtensionElement;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.provider.ProviderManager;
|
import org.jivesoftware.smack.provider.ProviderManager;
|
||||||
|
|
||||||
import org.jxmpp.util.cache.LruCache;
|
import org.jxmpp.util.cache.LruCache;
|
||||||
|
|
||||||
public class XmppElementUtil {
|
public class XmppElementUtil {
|
||||||
|
|
||||||
private static final LruCache<Class<? extends FullyQualifiedElement>, QName> CLASS_TO_QNAME_CACHE = new LruCache<>(512);
|
private static final LruCache<Class<? extends XmlElement>, QName> CLASS_TO_QNAME_CACHE = new LruCache<>(512);
|
||||||
|
|
||||||
public static final Logger LOGGER = Logger.getLogger(XmppElementUtil.class.getName());
|
public static final Logger LOGGER = Logger.getLogger(XmppElementUtil.class.getName());
|
||||||
|
|
||||||
public static QName getQNameFor(Class<? extends FullyQualifiedElement> fullyQualifiedElement) {
|
public static QName getQNameFor(Class<? extends XmlElement> fullyQualifiedElement) {
|
||||||
QName qname = CLASS_TO_QNAME_CACHE.get(fullyQualifiedElement);
|
QName qname = CLASS_TO_QNAME_CACHE.get(fullyQualifiedElement);
|
||||||
if (qname != null) {
|
if (qname != null) {
|
||||||
return qname;
|
return qname;
|
||||||
|
@ -72,24 +72,24 @@ public class XmppElementUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <E extends ExtensionElement> List<E> getElementsFrom(
|
public static <E extends ExtensionElement> List<E> getElementsFrom(
|
||||||
MultiMap<QName, ExtensionElement> elementMap, Class<E> extensionElementClass) {
|
MultiMap<QName, XmlElement> elementMap, Class<E> extensionElementClass) {
|
||||||
QName qname = XmppElementUtil.getQNameFor(extensionElementClass);
|
QName qname = XmppElementUtil.getQNameFor(extensionElementClass);
|
||||||
|
|
||||||
List<ExtensionElement> extensionElements = elementMap.getAll(qname);
|
List<XmlElement> extensionElements = elementMap.getAll(qname);
|
||||||
|
|
||||||
if (extensionElements.isEmpty()) {
|
if (extensionElements.isEmpty()) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<E> res = new ArrayList<>(extensionElements.size());
|
List<E> res = new ArrayList<>(extensionElements.size());
|
||||||
for (ExtensionElement extensionElement : extensionElements) {
|
for (XmlElement extensionElement : extensionElements) {
|
||||||
E e = castOrThrow(extensionElement, extensionElementClass);
|
E e = castOrThrow(extensionElement, extensionElementClass);
|
||||||
res.add(e);
|
res.add(e);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <E extends ExtensionElement> E castOrThrow(ExtensionElement extensionElement, Class<E> extensionElementClass) {
|
public static <E extends ExtensionElement> E castOrThrow(XmlElement extensionElement, Class<E> extensionElementClass) {
|
||||||
if (!extensionElementClass.isInstance(extensionElement)) {
|
if (!extensionElementClass.isInstance(extensionElement)) {
|
||||||
final QName qname = getQNameFor(extensionElementClass);
|
final QName qname = getQNameFor(extensionElementClass);
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class StreamErrorTest {
|
||||||
assertNotNull(error);
|
assertNotNull(error);
|
||||||
assertEquals(Condition.conflict, error.getCondition());
|
assertEquals(Condition.conflict, error.getCondition());
|
||||||
assertEquals("Replaced by new connection", error.getDescriptiveText());
|
assertEquals("Replaced by new connection", error.getDescriptiveText());
|
||||||
ExtensionElement appSpecificElement = error.getExtension("appSpecificElement", "myns");
|
XmlElement appSpecificElement = error.getExtension("appSpecificElement", "myns");
|
||||||
assertNotNull(appSpecificElement);
|
assertNotNull(appSpecificElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2013-2014 Georg Lukas, 2020 Florian Schmaus
|
* Copyright 2013-2014 Georg Lukas, 2020-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,9 +16,12 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.carbons.packet;
|
package org.jivesoftware.smackx.carbons.packet;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.MessageBuilder;
|
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.forward.packet.Forwarded;
|
import org.jivesoftware.smackx.forward.packet.Forwarded;
|
||||||
|
@ -34,7 +37,7 @@ import org.jivesoftware.smackx.forward.packet.Forwarded;
|
||||||
*
|
*
|
||||||
* @author Georg Lukas
|
* @author Georg Lukas
|
||||||
*/
|
*/
|
||||||
public class CarbonExtension implements ExtensionElement {
|
public class CarbonExtension implements XmlElement {
|
||||||
public static final String NAMESPACE = Carbon.NAMESPACE;
|
public static final String NAMESPACE = Carbon.NAMESPACE;
|
||||||
|
|
||||||
private final Direction dir;
|
private final Direction dir;
|
||||||
|
@ -136,6 +139,7 @@ public class CarbonExtension implements ExtensionElement {
|
||||||
public static final class Private implements ExtensionElement {
|
public static final class Private implements ExtensionElement {
|
||||||
public static final Private INSTANCE = new Private();
|
public static final Private INSTANCE = new Private();
|
||||||
public static final String ELEMENT = "private";
|
public static final String ELEMENT = "private";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private Private() {
|
private Private() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
package org.jivesoftware.smackx.chat_markers.filter;
|
package org.jivesoftware.smackx.chat_markers.filter;
|
||||||
|
|
||||||
import org.jivesoftware.smack.filter.StanzaExtensionFilter;
|
import org.jivesoftware.smack.filter.StanzaExtensionFilter;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.chatstates.ChatState;
|
import org.jivesoftware.smackx.chatstates.ChatState;
|
||||||
import org.jivesoftware.smackx.chatstates.ChatStateManager;
|
import org.jivesoftware.smackx.chatstates.ChatStateManager;
|
||||||
|
@ -56,7 +56,7 @@ public final class EligibleForChatMarkerFilter extends StanzaExtensionFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (super.accept(message)) {
|
if (super.accept(message)) {
|
||||||
ExtensionElement extension = message.getExtension(ChatStateManager.NAMESPACE);
|
XmlElement extension = message.getExtension(ChatStateManager.NAMESPACE);
|
||||||
String chatStateElementName = extension.getElementName();
|
String chatStateElementName = extension.getElementName();
|
||||||
|
|
||||||
ChatState state;
|
ChatState state;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2014-2015 Florian Schmaus
|
* Copyright © 2014-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.csi.packet;
|
package org.jivesoftware.smackx.csi.packet;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.Nonza;
|
import org.jivesoftware.smack.packet.Nonza;
|
||||||
|
|
||||||
|
@ -77,12 +79,19 @@ public class ClientStateIndication {
|
||||||
public static final Feature INSTANCE = new Feature();
|
public static final Feature INSTANCE = new Feature();
|
||||||
public static final String ELEMENT = "csi";
|
public static final String ELEMENT = "csi";
|
||||||
|
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private Feature() {
|
private Feature() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT;
|
return QNAME.getLocalPart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getNamespace() {
|
||||||
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -90,9 +99,5 @@ public class ClientStateIndication {
|
||||||
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getNamespace() {
|
|
||||||
return NAMESPACE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.jivesoftware.smackx.fallback_indication;
|
package org.jivesoftware.smackx.fallback_indication;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.fallback_indication.element.FallbackIndicationElement;
|
import org.jivesoftware.smackx.fallback_indication.element.FallbackIndicationElement;
|
||||||
|
|
||||||
public interface FallbackIndicationListener {
|
public interface FallbackIndicationListener {
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.jivesoftware.smack.filter.StanzaTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.MessageBuilder;
|
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.fallback_indication.element.FallbackIndicationElement;
|
import org.jivesoftware.smackx.fallback_indication.element.FallbackIndicationElement;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.fallback_indication.element.FallbackIndicationElement;
|
import org.jivesoftware.smackx.fallback_indication.element.FallbackIndicationElement;
|
||||||
|
|
||||||
public class FallbackIndicationElementProvider extends ExtensionElementProvider<FallbackIndicationElement> {
|
public class FallbackIndicationElementProvider extends ExtensionElementProvider<FallbackIndicationElement> {
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.hoxt.packet;
|
package org.jivesoftware.smackx.hoxt.packet;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
@ -161,6 +163,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
public static class Data extends HoxExtensionElement {
|
public static class Data extends HoxExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "data";
|
public static final String ELEMENT = "data";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final NamedElement child;
|
private final NamedElement child;
|
||||||
|
|
||||||
|
@ -210,6 +213,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
public static class Text extends HoxExtensionElement {
|
public static class Text extends HoxExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "text";
|
public static final String ELEMENT = "text";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final String text;
|
private final String text;
|
||||||
|
|
||||||
|
@ -252,6 +256,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
public static class Base64 extends HoxExtensionElement {
|
public static class Base64 extends HoxExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "base64";
|
public static final String ELEMENT = "base64";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final String text;
|
private final String text;
|
||||||
|
|
||||||
|
@ -294,6 +299,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
public static class Xml extends HoxExtensionElement {
|
public static class Xml extends HoxExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "xml";
|
public static final String ELEMENT = "xml";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final String text;
|
private final String text;
|
||||||
|
|
||||||
|
@ -336,6 +342,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
public static class ChunkedBase64 extends HoxExtensionElement {
|
public static class ChunkedBase64 extends HoxExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "chunkedBase64";
|
public static final String ELEMENT = "chunkedBase64";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final String streamId;
|
private final String streamId;
|
||||||
|
|
||||||
|
@ -379,6 +386,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
public static class Ibb extends HoxExtensionElement {
|
public static class Ibb extends HoxExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "ibb";
|
public static final String ELEMENT = "ibb";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final String sid;
|
private final String sid;
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
|
|
||||||
import org.jivesoftware.smack.proxy.ProxyInfo;
|
import org.jivesoftware.smack.proxy.ProxyInfo;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||||
import org.jivesoftware.smackx.httpfileupload.UploadService.Version;
|
import org.jivesoftware.smackx.httpfileupload.UploadService.Version;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2016-2019 Florian Schmaus
|
* Copyright © 2016-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -18,10 +18,10 @@ package org.jivesoftware.smackx.iot.control.element;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
public abstract class SetData implements ExtensionElement {
|
public abstract class SetData implements XmlElement {
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
BOOL,
|
BOOL,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2019 Florian Schmaus
|
* Copyright 2019-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,9 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.iot.data.element;
|
package org.jivesoftware.smackx.iot.data.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
public abstract class IoTDataExtensionElement implements ExtensionElement {
|
public abstract class IoTDataExtensionElement implements XmlElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String getNamespace() {
|
public final String getNamespace() {
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle_filetransfer.element;
|
package org.jivesoftware.smackx.jingle_filetransfer.element;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
@ -27,6 +29,8 @@ import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||||
*/
|
*/
|
||||||
public class Checksum implements ExtensionElement {
|
public class Checksum implements ExtensionElement {
|
||||||
public static final String ELEMENT = "checksum";
|
public static final String ELEMENT = "checksum";
|
||||||
|
public static final QName QNAME = new QName(JingleFileTransfer.NAMESPACE_V5, ELEMENT);
|
||||||
|
|
||||||
public static final String ATTR_CREATOR = "creator";
|
public static final String ATTR_CREATOR = "creator";
|
||||||
public static final String ATTR_NAME = "name";
|
public static final String ATTR_NAME = "name";
|
||||||
|
|
||||||
|
@ -43,7 +47,7 @@ public class Checksum implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,6 +63,6 @@ public class Checksum implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return JingleFileTransfer.NAMESPACE_V5;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,19 @@ package org.jivesoftware.smackx.jingle_filetransfer.element;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
||||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File element.
|
* File element.
|
||||||
*/
|
*/
|
||||||
public class JingleFileTransfer extends JingleContentDescription {
|
public class JingleFileTransfer extends JingleContentDescription implements ExtensionElement {
|
||||||
public static final String NAMESPACE_V5 = "urn:xmpp:jingle:apps:file-transfer:5";
|
public static final String NAMESPACE_V5 = "urn:xmpp:jingle:apps:file-transfer:5";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE_V5, ELEMENT);
|
||||||
|
|
||||||
public JingleFileTransfer(List<JingleContentDescriptionChildElement> payloads) {
|
public JingleFileTransfer(List<JingleContentDescriptionChildElement> payloads) {
|
||||||
super(payloads);
|
super(payloads);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle_filetransfer.element;
|
package org.jivesoftware.smackx.jingle_filetransfer.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||||
|
@ -24,7 +24,7 @@ import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||||
/**
|
/**
|
||||||
* RangeElement which specifies, which range of a file shall be transferred.
|
* RangeElement which specifies, which range of a file shall be transferred.
|
||||||
*/
|
*/
|
||||||
public class Range implements FullyQualifiedElement {
|
public class Range implements XmlElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "range";
|
public static final String ELEMENT = "range";
|
||||||
public static final String NAMESPACE = JingleFileTransferChild.NAMESPACE;
|
public static final String NAMESPACE = JingleFileTransferChild.NAMESPACE;
|
||||||
|
|
|
@ -49,6 +49,7 @@ import org.jivesoftware.smackx.commands.RemoteCommand;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
||||||
import org.jivesoftware.smackx.forward.packet.Forwarded;
|
import org.jivesoftware.smackx.forward.packet.Forwarded;
|
||||||
|
import org.jivesoftware.smackx.mam.MamManager.MamQueryArgs;
|
||||||
import org.jivesoftware.smackx.mam.element.MamElements;
|
import org.jivesoftware.smackx.mam.element.MamElements;
|
||||||
import org.jivesoftware.smackx.mam.element.MamElements.MamResultExtension;
|
import org.jivesoftware.smackx.mam.element.MamElements.MamResultExtension;
|
||||||
import org.jivesoftware.smackx.mam.element.MamFinIQ;
|
import org.jivesoftware.smackx.mam.element.MamFinIQ;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.jivesoftware.smack.Manager;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
||||||
import org.jivesoftware.smack.packet.MessageBuilder;
|
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.message_fastening.element.FasteningElement;
|
import org.jivesoftware.smackx.message_fastening.element.FasteningElement;
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,11 @@ import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.MessageBuilder;
|
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.message_fastening.MessageFasteningManager;
|
import org.jivesoftware.smackx.message_fastening.MessageFasteningManager;
|
||||||
import org.jivesoftware.smackx.sid.element.OriginIdElement;
|
import org.jivesoftware.smackx.sid.element.OriginIdElement;
|
||||||
|
|
||||||
|
@ -43,12 +45,12 @@ public final class FasteningElement implements ExtensionElement {
|
||||||
|
|
||||||
private final OriginIdElement referencedStanzasOriginId;
|
private final OriginIdElement referencedStanzasOriginId;
|
||||||
private final List<ExternalElement> externalPayloads = new ArrayList<>();
|
private final List<ExternalElement> externalPayloads = new ArrayList<>();
|
||||||
private final List<ExtensionElement> wrappedPayloads = new ArrayList<>();
|
private final List<XmlElement> wrappedPayloads = new ArrayList<>();
|
||||||
private final boolean clear;
|
private final boolean clear;
|
||||||
private final boolean shell;
|
private final boolean shell;
|
||||||
|
|
||||||
private FasteningElement(OriginIdElement originId,
|
private FasteningElement(OriginIdElement originId,
|
||||||
List<ExtensionElement> wrappedPayloads,
|
List<XmlElement> wrappedPayloads,
|
||||||
List<ExternalElement> externalPayloads,
|
List<ExternalElement> externalPayloads,
|
||||||
boolean clear,
|
boolean clear,
|
||||||
boolean shell) {
|
boolean shell) {
|
||||||
|
@ -76,7 +78,7 @@ public final class FasteningElement implements ExtensionElement {
|
||||||
*
|
*
|
||||||
* @return wrapped payloads.
|
* @return wrapped payloads.
|
||||||
*/
|
*/
|
||||||
public List<ExtensionElement> getWrappedPayloads() {
|
public List<XmlElement> getWrappedPayloads() {
|
||||||
return Collections.unmodifiableList(wrappedPayloads);
|
return Collections.unmodifiableList(wrappedPayloads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +164,7 @@ public final class FasteningElement implements ExtensionElement {
|
||||||
for (ExternalElement external : externalPayloads) {
|
for (ExternalElement external : externalPayloads) {
|
||||||
xml.append(external);
|
xml.append(external);
|
||||||
}
|
}
|
||||||
for (ExtensionElement wrapped : wrappedPayloads) {
|
for (XmlElement wrapped : wrappedPayloads) {
|
||||||
xml.append(wrapped);
|
xml.append(wrapped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +206,7 @@ public final class FasteningElement implements ExtensionElement {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private OriginIdElement originId;
|
private OriginIdElement originId;
|
||||||
private final List<ExtensionElement> wrappedPayloads = new ArrayList<>();
|
private final List<XmlElement> wrappedPayloads = new ArrayList<>();
|
||||||
private final List<ExternalElement> externalPayloads = new ArrayList<>();
|
private final List<ExternalElement> externalPayloads = new ArrayList<>();
|
||||||
private boolean isClear = false;
|
private boolean isClear = false;
|
||||||
private boolean isShell = false;
|
private boolean isShell = false;
|
||||||
|
@ -236,7 +238,7 @@ public final class FasteningElement implements ExtensionElement {
|
||||||
* @param wrappedPayload wrapped payload
|
* @param wrappedPayload wrapped payload
|
||||||
* @return builder instance
|
* @return builder instance
|
||||||
*/
|
*/
|
||||||
public Builder addWrappedPayload(ExtensionElement wrappedPayload) {
|
public Builder addWrappedPayload(XmlElement wrappedPayload) {
|
||||||
return addWrappedPayloads(Collections.singletonList(wrappedPayload));
|
return addWrappedPayloads(Collections.singletonList(wrappedPayload));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +248,7 @@ public final class FasteningElement implements ExtensionElement {
|
||||||
* @param wrappedPayloads list of wrapped payloads
|
* @param wrappedPayloads list of wrapped payloads
|
||||||
* @return builder instance
|
* @return builder instance
|
||||||
*/
|
*/
|
||||||
public Builder addWrappedPayloads(List<ExtensionElement> wrappedPayloads) {
|
public Builder addWrappedPayloads(List<XmlElement> wrappedPayloads) {
|
||||||
this.wrappedPayloads.addAll(wrappedPayloads);
|
this.wrappedPayloads.addAll(wrappedPayloads);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.message_fastening.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
|
@ -26,6 +26,7 @@ import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smack.util.ParserUtils;
|
import org.jivesoftware.smack.util.ParserUtils;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.message_fastening.MessageFasteningManager;
|
import org.jivesoftware.smackx.message_fastening.MessageFasteningManager;
|
||||||
import org.jivesoftware.smackx.message_fastening.element.ExternalElement;
|
import org.jivesoftware.smackx.message_fastening.element.ExternalElement;
|
||||||
import org.jivesoftware.smackx.message_fastening.element.FasteningElement;
|
import org.jivesoftware.smackx.message_fastening.element.FasteningElement;
|
||||||
|
@ -62,7 +63,7 @@ public class FasteningElementProvider extends ExtensionElementProvider<Fastening
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse wrapped payload
|
// Parse wrapped payload
|
||||||
ExtensionElement wrappedPayload = PacketParserUtils.parseExtensionElement(name, namespace, parser, xmlEnvironment);
|
XmlElement wrappedPayload = PacketParserUtils.parseExtensionElement(name, namespace, parser, xmlEnvironment);
|
||||||
builder.addWrappedPayload(wrappedPayload);
|
builder.addWrappedPayload(wrappedPayload);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import javax.xml.namespace.QName;
|
||||||
public class BlockQuoteElement extends MarkupElement.BlockLevelMarkupElement {
|
public class BlockQuoteElement extends MarkupElement.BlockLevelMarkupElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "bquote";
|
public static final String ELEMENT = "bquote";
|
||||||
public static final QName QNAME = new QName(MarkupElement.NAMESPACE, ELEMENT);
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Block Quote element.
|
* Create a new Block Quote element.
|
||||||
|
|
|
@ -16,9 +16,12 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.message_markup.element;
|
package org.jivesoftware.smackx.message_markup.element;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
public class CodeBlockElement extends MarkupElement.BlockLevelMarkupElement {
|
public class CodeBlockElement extends MarkupElement.BlockLevelMarkupElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "bcode";
|
public static final String ELEMENT = "bcode";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Code Block element.
|
* Create a new Code Block element.
|
||||||
|
|
|
@ -19,13 +19,15 @@ package org.jivesoftware.smackx.message_markup.element;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
public class ListElement extends MarkupElement.NonEmptyChildElement {
|
public class ListElement extends MarkupElement.NonEmptyChildElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "list";
|
public static final String ELEMENT = "list";
|
||||||
public static final String ELEM_LI = "li";
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final List<ListEntryElement> entries;
|
private final List<ListEntryElement> entries;
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ public class ListElement extends MarkupElement.NonEmptyChildElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,6 +64,10 @@ public class ListElement extends MarkupElement.NonEmptyChildElement {
|
||||||
|
|
||||||
public static class ListEntryElement implements ExtensionElement {
|
public static class ListEntryElement implements ExtensionElement {
|
||||||
|
|
||||||
|
public static final String ELEMENT = "li";
|
||||||
|
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final int start;
|
private final int start;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,12 +89,12 @@ public class ListElement extends MarkupElement.NonEmptyChildElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEM_LI;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return MarkupElement.NAMESPACE;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -271,6 +271,8 @@ public class MarkupElement implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
public abstract static class MarkupChildElement implements ExtensionElement {
|
public abstract static class MarkupChildElement implements ExtensionElement {
|
||||||
|
|
||||||
|
public static final String NAMESPACE = MarkupElement.NAMESPACE;
|
||||||
|
|
||||||
public static final String ATTR_START = "start";
|
public static final String ATTR_START = "start";
|
||||||
public static final String ATTR_END = "end";
|
public static final String ATTR_END = "end";
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,14 @@ package org.jivesoftware.smackx.message_markup.element;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
public class SpanElement extends MarkupElement.NonEmptyChildElement {
|
public class SpanElement extends MarkupElement.NonEmptyChildElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "span";
|
public static final String ELEMENT = "span";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final Set<SpanStyle> styles;
|
private final Set<SpanStyle> styles;
|
||||||
|
|
||||||
|
@ -60,7 +63,7 @@ public class SpanElement extends MarkupElement.NonEmptyChildElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class MarkupElementProvider extends ExtensionElementProvider<MarkupElemen
|
||||||
"Message Markup ListElement MUST contain a 'end' attribute.");
|
"Message Markup ListElement MUST contain a 'end' attribute.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ListElement.ELEM_LI:
|
case ListElement.ListEntryElement.ELEMENT:
|
||||||
start = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
|
start = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
|
||||||
"Message Markup ListElement 'li' MUST contain a 'start' attribute.");
|
"Message Markup ListElement 'li' MUST contain a 'start' attribute.");
|
||||||
lis.add(new ListElement.ListEntryElement(start));
|
lis.add(new ListElement.ListEntryElement(start));
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.jivesoftware.smack.SmackException;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
||||||
import org.jivesoftware.smack.packet.MessageBuilder;
|
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.message_fastening.element.FasteningElement;
|
import org.jivesoftware.smackx.message_fastening.element.FasteningElement;
|
||||||
import org.jivesoftware.smackx.message_retraction.element.RetractElement;
|
import org.jivesoftware.smackx.message_retraction.element.RetractElement;
|
||||||
|
|
|
@ -18,14 +18,18 @@ package org.jivesoftware.smackx.message_retraction.element;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.sid.element.OriginIdElement;
|
import org.jivesoftware.smackx.sid.element.OriginIdElement;
|
||||||
|
|
||||||
public class RetractedElement implements ExtensionElement {
|
public class RetractedElement implements ExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "retracted";
|
public static final String ELEMENT = "retracted";
|
||||||
|
public static final QName QNAME = new QName(RetractElement.NAMESPACE, ELEMENT);
|
||||||
public static final String ATTR_STAMP = "stamp";
|
public static final String ATTR_STAMP = "stamp";
|
||||||
|
|
||||||
private final Date stamp;
|
private final Date stamp;
|
||||||
|
@ -46,12 +50,12 @@ public class RetractedElement implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return RetractElement.NAMESPACE;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.message_retraction.element.RetractElement;
|
import org.jivesoftware.smackx.message_retraction.element.RetractElement;
|
||||||
|
|
||||||
public class RetractElementProvider extends ExtensionElementProvider<RetractElement> {
|
public class RetractElementProvider extends ExtensionElementProvider<RetractElement> {
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.util.ParserUtils;
|
import org.jivesoftware.smack.util.ParserUtils;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.message_retraction.element.RetractedElement;
|
import org.jivesoftware.smackx.message_retraction.element.RetractedElement;
|
||||||
import org.jivesoftware.smackx.sid.StableUniqueStanzaIdManager;
|
import org.jivesoftware.smackx.sid.StableUniqueStanzaIdManager;
|
||||||
import org.jivesoftware.smackx.sid.element.OriginIdElement;
|
import org.jivesoftware.smackx.sid.element.OriginIdElement;
|
||||||
|
|
|
@ -21,8 +21,11 @@ import java.net.URISyntaxException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
|
@ -33,6 +36,9 @@ import org.jxmpp.jid.BareJid;
|
||||||
public class ReferenceElement implements ExtensionElement {
|
public class ReferenceElement implements ExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "reference";
|
public static final String ELEMENT = "reference";
|
||||||
|
public static final String NAMESPACE = ReferenceManager.NAMESPACE;
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
public static final String ATTR_BEGIN = "begin";
|
public static final String ATTR_BEGIN = "begin";
|
||||||
public static final String ATTR_END = "end";
|
public static final String ATTR_END = "end";
|
||||||
public static final String ATTR_TYPE = "type";
|
public static final String ATTR_TYPE = "type";
|
||||||
|
@ -51,7 +57,7 @@ public class ReferenceElement implements ExtensionElement {
|
||||||
private final URI uri;
|
private final URI uri;
|
||||||
|
|
||||||
// Non-XEP-compliant, but needed for SIMS
|
// Non-XEP-compliant, but needed for SIMS
|
||||||
private final ExtensionElement child;
|
private final XmlElement child;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XEP-incompliant (v0.2) constructor. This is needed for SIMS.
|
* XEP-incompliant (v0.2) constructor. This is needed for SIMS.
|
||||||
|
@ -63,7 +69,7 @@ public class ReferenceElement implements ExtensionElement {
|
||||||
* @param uri TODO javadoc me please
|
* @param uri TODO javadoc me please
|
||||||
* @param child TODO javadoc me please
|
* @param child TODO javadoc me please
|
||||||
*/
|
*/
|
||||||
public ReferenceElement(Integer begin, Integer end, Type type, String anchor, URI uri, ExtensionElement child) {
|
public ReferenceElement(Integer begin, Integer end, Type type, String anchor, URI uri, XmlElement child) {
|
||||||
if (begin != null && begin < 0) {
|
if (begin != null && begin < 0) {
|
||||||
throw new IllegalArgumentException("Attribute 'begin' MUST NOT be smaller than 0.");
|
throw new IllegalArgumentException("Attribute 'begin' MUST NOT be smaller than 0.");
|
||||||
}
|
}
|
||||||
|
@ -147,9 +153,9 @@ public class ReferenceElement implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
public static List<ReferenceElement> getReferencesFromStanza(Stanza stanza) {
|
public static List<ReferenceElement> getReferencesFromStanza(Stanza stanza) {
|
||||||
List<ReferenceElement> references = new ArrayList<>();
|
List<ReferenceElement> references = new ArrayList<>();
|
||||||
List<ExtensionElement> extensions = stanza.getExtensions(ReferenceElement.ELEMENT, ReferenceManager.NAMESPACE);
|
List<ReferenceElement> extensions = stanza.getExtensions(ReferenceElement.class);
|
||||||
for (ExtensionElement e : extensions) {
|
for (ReferenceElement e : extensions) {
|
||||||
references.add((ReferenceElement) e);
|
references.add(e);
|
||||||
}
|
}
|
||||||
return references;
|
return references;
|
||||||
}
|
}
|
||||||
|
@ -166,12 +172,12 @@ public class ReferenceElement implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return ReferenceManager.NAMESPACE;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
|
@ -51,7 +51,7 @@ public class ReferenceProvider extends ExtensionElementProvider<ReferenceElement
|
||||||
// TODO: Should be SmackParseException and probably be factored into ParserUtils.
|
// TODO: Should be SmackParseException and probably be factored into ParserUtils.
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
ExtensionElement child = null;
|
XmlElement child = null;
|
||||||
outerloop: while (true) {
|
outerloop: while (true) {
|
||||||
XmlPullParser.Event eventType = parser.next();
|
XmlPullParser.Event eventType = parser.next();
|
||||||
if (eventType == XmlPullParser.Event.START_ELEMENT) {
|
if (eventType == XmlPullParser.Event.START_ELEMENT) {
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
@ -32,6 +34,7 @@ public class SpoilerElement implements ExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "spoiler";
|
public static final String ELEMENT = "spoiler";
|
||||||
public static final String NAMESPACE = SpoilerManager.NAMESPACE_0;
|
public static final String NAMESPACE = SpoilerManager.NAMESPACE_0;
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
public static final SpoilerElement EMPTY = new SpoilerElement(null, null);
|
public static final SpoilerElement EMPTY = new SpoilerElement(null, null);
|
||||||
|
|
||||||
|
@ -116,11 +119,10 @@ public class SpoilerElement implements ExtensionElement {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ExtensionElement> spoilers = message.getExtensions(SpoilerElement.ELEMENT, NAMESPACE);
|
List<SpoilerElement> spoilers = message.getExtensions(SpoilerElement.class);
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
|
|
||||||
for (ExtensionElement e : spoilers) {
|
for (SpoilerElement s : spoilers) {
|
||||||
SpoilerElement s = (SpoilerElement) e;
|
|
||||||
if (s.getLanguage() == null || s.getLanguage().equals("")) {
|
if (s.getLanguage() == null || s.getLanguage().equals("")) {
|
||||||
map.put("", s.getHint());
|
map.put("", s.getHint());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -23,12 +23,15 @@ import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.address.packet.MultipleAddresses;
|
import org.jivesoftware.smackx.address.packet.MultipleAddresses;
|
||||||
import org.jivesoftware.smackx.hints.element.MessageProcessingHint;
|
import org.jivesoftware.smackx.hints.element.MessageProcessingHint;
|
||||||
import org.jivesoftware.smackx.sid.element.StanzaIdElement;
|
import org.jivesoftware.smackx.sid.element.StanzaIdElement;
|
||||||
|
@ -120,7 +123,7 @@ public class ContentElement implements ExtensionElement {
|
||||||
private RandomPaddingAffixElement rpad = null;
|
private RandomPaddingAffixElement rpad = null;
|
||||||
|
|
||||||
private final List<AffixElement> otherAffixElements = new ArrayList<>();
|
private final List<AffixElement> otherAffixElements = new ArrayList<>();
|
||||||
private final List<ExtensionElement> payloadItems = new ArrayList<>();
|
private final List<XmlElement> payloadItems = new ArrayList<>();
|
||||||
|
|
||||||
private Builder() {
|
private Builder() {
|
||||||
|
|
||||||
|
@ -246,7 +249,7 @@ public class ContentElement implements ExtensionElement {
|
||||||
* @return builder
|
* @return builder
|
||||||
* @throws IllegalArgumentException in case an extension element from the blacklist is added.
|
* @throws IllegalArgumentException in case an extension element from the blacklist is added.
|
||||||
*/
|
*/
|
||||||
public Builder addPayloadItem(ExtensionElement payloadItem) {
|
public Builder addPayloadItem(XmlElement payloadItem) {
|
||||||
Objects.requireNonNull(payloadItem, "Payload item MUST NOT be null.");
|
Objects.requireNonNull(payloadItem, "Payload item MUST NOT be null.");
|
||||||
this.payloadItems.add(checkForIllegalPayloadsAndPossiblyThrow(payloadItem));
|
this.payloadItems.add(checkForIllegalPayloadsAndPossiblyThrow(payloadItem));
|
||||||
return this;
|
return this;
|
||||||
|
@ -263,7 +266,7 @@ public class ContentElement implements ExtensionElement {
|
||||||
return new ContentElement(payloadElement, allAffixElements);
|
return new ContentElement(payloadElement, allAffixElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ExtensionElement checkForIllegalPayloadsAndPossiblyThrow(ExtensionElement payloadItem) {
|
private static XmlElement checkForIllegalPayloadsAndPossiblyThrow(XmlElement payloadItem) {
|
||||||
QName qName = payloadItem.getQName();
|
QName qName = payloadItem.getQName();
|
||||||
if (BLACKLISTED_QNAMES.contains(qName)) {
|
if (BLACKLISTED_QNAMES.contains(qName)) {
|
||||||
throw new IllegalArgumentException("Element identified by " + qName +
|
throw new IllegalArgumentException("Element identified by " + qName +
|
||||||
|
|
|
@ -19,8 +19,8 @@ package org.jivesoftware.smackx.stanza_content_encryption.element;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
|
@ -28,13 +28,13 @@ public class PayloadElement implements NamedElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "payload";
|
public static final String ELEMENT = "payload";
|
||||||
|
|
||||||
private final List<ExtensionElement> payloadElements;
|
private final List<XmlElement> payloadElements;
|
||||||
|
|
||||||
public PayloadElement(List<ExtensionElement> payloadElements) {
|
public PayloadElement(List<XmlElement> payloadElements) {
|
||||||
this.payloadElements = Collections.unmodifiableList(payloadElements);
|
this.payloadElements = Collections.unmodifiableList(payloadElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ExtensionElement> getItems() {
|
public List<XmlElement> getItems() {
|
||||||
return payloadElements;
|
return payloadElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.jivesoftware.smackx.stanza_content_encryption.provider;
|
package org.jivesoftware.smackx.stanza_content_encryption.provider;
|
||||||
|
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.stanza_content_encryption.element.AffixExtensionElement;
|
import org.jivesoftware.smackx.stanza_content_encryption.element.AffixExtensionElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
|
@ -28,6 +28,7 @@ import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
import org.jivesoftware.smack.util.ParserUtils;
|
import org.jivesoftware.smack.util.ParserUtils;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.stanza_content_encryption.element.AffixElement;
|
import org.jivesoftware.smackx.stanza_content_encryption.element.AffixElement;
|
||||||
import org.jivesoftware.smackx.stanza_content_encryption.element.ContentElement;
|
import org.jivesoftware.smackx.stanza_content_encryption.element.ContentElement;
|
||||||
import org.jivesoftware.smackx.stanza_content_encryption.element.FromAffixElement;
|
import org.jivesoftware.smackx.stanza_content_encryption.element.FromAffixElement;
|
||||||
|
@ -102,7 +103,7 @@ public class ContentElementProvider extends ExtensionElementProvider<ContentElem
|
||||||
if (tag == XmlPullParser.Event.START_ELEMENT) {
|
if (tag == XmlPullParser.Event.START_ELEMENT) {
|
||||||
String name = parser.getName();
|
String name = parser.getName();
|
||||||
String namespace = parser.getNamespace();
|
String namespace = parser.getNamespace();
|
||||||
ExtensionElement element = PacketParserUtils.parseExtensionElement(name, namespace, parser, outerXmlEnvironment);
|
XmlElement element = PacketParserUtils.parseExtensionElement(name, namespace, parser, outerXmlEnvironment);
|
||||||
builder.addPayloadItem(element);
|
builder.addPayloadItem(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.MessageBuilder;
|
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||||
import org.jivesoftware.smack.packet.StanzaBuilder;
|
import org.jivesoftware.smack.packet.StanzaBuilder;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.eme.element.ExplicitMessageEncryptionElement;
|
import org.jivesoftware.smackx.eme.element.ExplicitMessageEncryptionElement;
|
||||||
|
@ -44,7 +44,7 @@ public class ExplicitMessageEncryptionElementTest extends SmackTestSuite {
|
||||||
assertFalse(ExplicitMessageEncryptionElement.hasProtocol(message,
|
assertFalse(ExplicitMessageEncryptionElement.hasProtocol(message,
|
||||||
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol.omemoVAxolotl));
|
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol.omemoVAxolotl));
|
||||||
|
|
||||||
List<ExtensionElement> extensions = message.getExtensions();
|
List<XmlElement> extensions = message.getExtensions();
|
||||||
assertEquals(0, extensions.size());
|
assertEquals(0, extensions.size());
|
||||||
|
|
||||||
MessageBuilder messageBuilder = StanzaBuilder.buildMessage();
|
MessageBuilder messageBuilder = StanzaBuilder.buildMessage();
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.test.util.SmackTestUtil;
|
import org.jivesoftware.smack.test.util.SmackTestUtil;
|
||||||
import org.jivesoftware.smack.test.util.TestUtils;
|
import org.jivesoftware.smack.test.util.TestUtils;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.message_fastening.element.ExternalElement;
|
import org.jivesoftware.smackx.message_fastening.element.ExternalElement;
|
||||||
import org.jivesoftware.smackx.message_fastening.element.FasteningElement;
|
import org.jivesoftware.smackx.message_fastening.element.FasteningElement;
|
||||||
import org.jivesoftware.smackx.message_fastening.provider.FasteningElementProvider;
|
import org.jivesoftware.smackx.message_fastening.provider.FasteningElementProvider;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.io.IOException;
|
||||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.test.util.SmackTestUtil;
|
import org.jivesoftware.smack.test.util.SmackTestUtil;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.message_retraction.provider.RetractElementProvider;
|
import org.jivesoftware.smackx.message_retraction.provider.RetractElementProvider;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Date;
|
||||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.test.util.SmackTestUtil;
|
import org.jivesoftware.smack.test.util.SmackTestUtil;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.message_retraction.provider.RetractedElementProvider;
|
import org.jivesoftware.smackx.message_retraction.provider.RetractedElementProvider;
|
||||||
import org.jivesoftware.smackx.sid.element.OriginIdElement;
|
import org.jivesoftware.smackx.sid.element.OriginIdElement;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.text.ParseException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.hints.element.StoreHint;
|
import org.jivesoftware.smackx.hints.element.StoreHint;
|
||||||
import org.jivesoftware.smackx.sid.element.StanzaIdElement;
|
import org.jivesoftware.smackx.sid.element.StanzaIdElement;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.test.util.TestUtils;
|
import org.jivesoftware.smack.test.util.TestUtils;
|
||||||
import org.jivesoftware.smack.util.ParserUtils;
|
import org.jivesoftware.smack.util.ParserUtils;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.stanza_content_encryption.element.ContentElement;
|
import org.jivesoftware.smackx.stanza_content_encryption.element.ContentElement;
|
||||||
import org.jivesoftware.smackx.stanza_content_encryption.element.FromAffixElement;
|
import org.jivesoftware.smackx.stanza_content_encryption.element.FromAffixElement;
|
||||||
import org.jivesoftware.smackx.stanza_content_encryption.element.RandomPaddingAffixElement;
|
import org.jivesoftware.smackx.stanza_content_encryption.element.RandomPaddingAffixElement;
|
||||||
|
|
|
@ -134,6 +134,7 @@ public class MultipleAddresses implements ExtensionElement {
|
||||||
public static final class Address implements ExtensionElement {
|
public static final class Address implements ExtensionElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "address";
|
public static final String ELEMENT = "address";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final Type type;
|
private final Type type;
|
||||||
private Jid jid;
|
private Jid jid;
|
||||||
|
@ -192,12 +193,12 @@ public class MultipleAddresses implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return NAMESPACE;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.attention.packet;
|
package org.jivesoftware.smackx.attention.packet;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
|
@ -44,6 +46,8 @@ public class AttentionExtension implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
public static final String NAMESPACE = "urn:xmpp:attention:0";
|
public static final String NAMESPACE = "urn:xmpp:attention:0";
|
||||||
|
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT_NAME);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -51,7 +55,7 @@ public class AttentionExtension implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT_NAME;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -61,7 +65,7 @@ public class AttentionExtension implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return NAMESPACE;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.StanzaView;
|
import org.jivesoftware.smack.packet.StanzaView;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bob.BoBData;
|
import org.jivesoftware.smackx.bob.BoBData;
|
||||||
import org.jivesoftware.smackx.bob.BoBManager;
|
import org.jivesoftware.smackx.bob.BoBManager;
|
||||||
import org.jivesoftware.smackx.bob.ContentId;
|
import org.jivesoftware.smackx.bob.ContentId;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.util.Pair;
|
import org.jivesoftware.smack.util.Pair;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bob.BoBData;
|
import org.jivesoftware.smackx.bob.BoBData;
|
||||||
import org.jivesoftware.smackx.bob.ContentId;
|
import org.jivesoftware.smackx.bob.ContentId;
|
||||||
import org.jivesoftware.smackx.bob.element.BoBDataExtension;
|
import org.jivesoftware.smackx.bob.element.BoBDataExtension;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.jivesoftware.smack.util.Pair;
|
||||||
import org.jivesoftware.smack.util.ParserUtils;
|
import org.jivesoftware.smack.util.ParserUtils;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.bob.BoBData;
|
import org.jivesoftware.smackx.bob.BoBData;
|
||||||
import org.jivesoftware.smackx.bob.ContentId;
|
import org.jivesoftware.smackx.bob.ContentId;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.util.InternetAddress;
|
import org.jivesoftware.smack.util.InternetAddress;
|
||||||
|
@ -275,7 +277,8 @@ public class Bytestream extends IQ {
|
||||||
*/
|
*/
|
||||||
public static class StreamHost extends BytestreamExtensionElement {
|
public static class StreamHost extends BytestreamExtensionElement {
|
||||||
|
|
||||||
public static String ELEMENTNAME = "streamhost";
|
public static final String ELEMENT = "streamhost";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final Jid jid;
|
private final Jid jid;
|
||||||
|
|
||||||
|
@ -344,7 +347,7 @@ public class Bytestream extends IQ {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENTNAME;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -375,7 +378,8 @@ public class Bytestream extends IQ {
|
||||||
*/
|
*/
|
||||||
public static class StreamHostUsed extends BytestreamExtensionElement {
|
public static class StreamHostUsed extends BytestreamExtensionElement {
|
||||||
|
|
||||||
public static String ELEMENTNAME = "streamhost-used";
|
public static final String ELEMENT = "streamhost-used";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final Jid jid;
|
private final Jid jid;
|
||||||
|
|
||||||
|
@ -399,7 +403,7 @@ public class Bytestream extends IQ {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENTNAME;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -418,7 +422,8 @@ public class Bytestream extends IQ {
|
||||||
*/
|
*/
|
||||||
public static class Activate extends BytestreamExtensionElement {
|
public static class Activate extends BytestreamExtensionElement {
|
||||||
|
|
||||||
public static String ELEMENTNAME = "activate";
|
public static final String ELEMENT = "activate";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final Jid target;
|
private final Jid target;
|
||||||
|
|
||||||
|
@ -442,7 +447,7 @@ public class Bytestream extends IQ {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENTNAME;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -57,15 +57,15 @@ public class BytestreamsProvider extends IQProvider<Bytestream> {
|
||||||
eventType = parser.next();
|
eventType = parser.next();
|
||||||
elementName = parser.getName();
|
elementName = parser.getName();
|
||||||
if (eventType == XmlPullParser.Event.START_ELEMENT) {
|
if (eventType == XmlPullParser.Event.START_ELEMENT) {
|
||||||
if (elementName.equals(Bytestream.StreamHost.ELEMENTNAME)) {
|
if (elementName.equals(Bytestream.StreamHost.ELEMENT)) {
|
||||||
JID = ParserUtils.getJidAttribute(parser);
|
JID = ParserUtils.getJidAttribute(parser);
|
||||||
host = parser.getAttributeValue("", "host");
|
host = parser.getAttributeValue("", "host");
|
||||||
port = parser.getAttributeValue("", "port");
|
port = parser.getAttributeValue("", "port");
|
||||||
}
|
}
|
||||||
else if (elementName.equals(Bytestream.StreamHostUsed.ELEMENTNAME)) {
|
else if (elementName.equals(Bytestream.StreamHostUsed.ELEMENT)) {
|
||||||
toReturn.setUsedHost(ParserUtils.getJidAttribute(parser));
|
toReturn.setUsedHost(ParserUtils.getJidAttribute(parser));
|
||||||
}
|
}
|
||||||
else if (elementName.equals(Bytestream.Activate.ELEMENTNAME)) {
|
else if (elementName.equals(Bytestream.Activate.ELEMENT)) {
|
||||||
toReturn.setToActivate(ParserUtils.getJidAttribute(parser));
|
toReturn.setToActivate(ParserUtils.getJidAttribute(parser));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,11 +39,11 @@ import org.jivesoftware.smack.filter.FromTypeFilter;
|
||||||
import org.jivesoftware.smack.filter.MessageTypeFilter;
|
import org.jivesoftware.smack.filter.MessageTypeFilter;
|
||||||
import org.jivesoftware.smack.filter.StanzaExtensionFilter;
|
import org.jivesoftware.smack.filter.StanzaExtensionFilter;
|
||||||
import org.jivesoftware.smack.filter.StanzaFilter;
|
import org.jivesoftware.smack.filter.StanzaFilter;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.MessageBuilder;
|
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.StanzaBuilder;
|
import org.jivesoftware.smack.packet.StanzaBuilder;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.chatstates.packet.ChatStateExtension;
|
import org.jivesoftware.smackx.chatstates.packet.ChatStateExtension;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
|
@ -142,7 +142,7 @@ public final class ChatStateManager extends Manager {
|
||||||
EntityBareJid bareFrom = fullFrom.asEntityBareJid();
|
EntityBareJid bareFrom = fullFrom.asEntityBareJid();
|
||||||
|
|
||||||
final Chat chat = ChatManager.getInstanceFor(connection()).chatWith(bareFrom);
|
final Chat chat = ChatManager.getInstanceFor(connection()).chatWith(bareFrom);
|
||||||
ExtensionElement extension = message.getExtension(NAMESPACE);
|
XmlElement extension = message.getExtension(NAMESPACE);
|
||||||
String chatStateElementName = extension.getElementName();
|
String chatStateElementName = extension.getElementName();
|
||||||
|
|
||||||
ChatState state;
|
ChatState state;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.chatstates.packet;
|
package org.jivesoftware.smackx.chatstates.packet;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.chatstates.ChatState;
|
import org.jivesoftware.smackx.chatstates.ChatState;
|
||||||
|
@ -29,7 +29,7 @@ import org.jivesoftware.smackx.chatstates.ChatState;
|
||||||
* @author Alexander Wenckus
|
* @author Alexander Wenckus
|
||||||
* @see org.jivesoftware.smackx.chatstates.ChatState
|
* @see org.jivesoftware.smackx.chatstates.ChatState
|
||||||
*/
|
*/
|
||||||
public class ChatStateExtension implements ExtensionElement {
|
public class ChatStateExtension implements XmlElement {
|
||||||
|
|
||||||
public static final String NAMESPACE = "http://jabber.org/protocol/chatstates";
|
public static final String NAMESPACE = "http://jabber.org/protocol/chatstates";
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ package org.jivesoftware.smackx.commands.packet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.commands.AdHocCommand;
|
import org.jivesoftware.smackx.commands.AdHocCommand;
|
||||||
import org.jivesoftware.smackx.commands.AdHocCommand.Action;
|
import org.jivesoftware.smackx.commands.AdHocCommand.Action;
|
||||||
|
@ -240,7 +240,7 @@ public class AdHocCommandData extends IQ {
|
||||||
return sessionID;
|
return sessionID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SpecificError implements ExtensionElement {
|
public static class SpecificError implements XmlElement {
|
||||||
|
|
||||||
public static final String namespace = "http://jabber.org/protocol/commands";
|
public static final String namespace = "http://jabber.org/protocol/commands";
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.logging.Logger;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smack.util.XmlUtil;
|
import org.jivesoftware.smack.util.XmlUtil;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.xdata.FormField;
|
import org.jivesoftware.smackx.xdata.FormField;
|
||||||
import org.jivesoftware.smackx.xdata.TextSingleFormField;
|
import org.jivesoftware.smackx.xdata.TextSingleFormField;
|
||||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||||
|
|
|
@ -22,8 +22,8 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
|
@ -39,7 +39,7 @@ public class RegistrationProvider extends IQProvider<Registration> {
|
||||||
public Registration parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
public Registration parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
String instruction = null;
|
String instruction = null;
|
||||||
Map<String, String> fields = new HashMap<>();
|
Map<String, String> fields = new HashMap<>();
|
||||||
List<ExtensionElement> packetExtensions = new LinkedList<>();
|
List<XmlElement> packetExtensions = new LinkedList<>();
|
||||||
outerloop:
|
outerloop:
|
||||||
while (true) {
|
while (true) {
|
||||||
XmlPullParser.Event eventType = parser.next();
|
XmlPullParser.Event eventType = parser.next();
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle.element;
|
package org.jivesoftware.smackx.jingle.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
@ -25,7 +25,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
/**
|
/**
|
||||||
* Jingle content element.
|
* Jingle content element.
|
||||||
*/
|
*/
|
||||||
public final class JingleContent implements FullyQualifiedElement {
|
public final class JingleContent implements XmlElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "content";
|
public static final String ELEMENT = "content";
|
||||||
public static final String NAMESPACE = Jingle.NAMESPACE;
|
public static final String NAMESPACE = Jingle.NAMESPACE;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2017 Florian Schmaus.
|
* Copyright 2017-2021 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -19,15 +19,15 @@ package org.jivesoftware.smackx.jingle.element;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jingle content description.
|
* Jingle content description.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class JingleContentDescription implements ExtensionElement {
|
public abstract class JingleContentDescription implements XmlElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "description";
|
public static final String ELEMENT = "description";
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle.element;
|
package org.jivesoftware.smackx.jingle.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An element found usually in 'description' elements.
|
* An element found usually in 'description' elements.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface JingleContentDescriptionChildElement extends FullyQualifiedElement {
|
public interface JingleContentDescriptionChildElement extends XmlElement {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2017-2019 Florian Schmaus
|
* Copyright 2017-2021 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jingle.element;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
* A jingle transport extension.
|
* A jingle transport extension.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class JingleContentTransport implements ExtensionElement {
|
public abstract class JingleContentTransport implements XmlElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "transport";
|
public static final String ELEMENT = "transport";
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle.element;
|
package org.jivesoftware.smackx.jingle.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An element found usually in Jingle 'transport' elements.
|
* An element found usually in Jingle 'transport' elements.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class JingleContentTransportCandidate implements FullyQualifiedElement {
|
public abstract class JingleContentTransportCandidate implements XmlElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "candidate";
|
public static final String ELEMENT = "candidate";
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle.element;
|
package org.jivesoftware.smackx.jingle.element;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract JingleContentTransportInfo element.
|
* Abstract JingleContentTransportInfo element.
|
||||||
*/
|
*/
|
||||||
public interface JingleContentTransportInfo extends FullyQualifiedElement {
|
public interface JingleContentTransportInfo extends XmlElement {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2005 Jive Software, 2017 Florian Schmaus.
|
* Copyright 2003-2005 Jive Software, 2017-2021 Florian Schmaus.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -19,10 +19,10 @@ package org.jivesoftware.smackx.jingle.element;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
public final class JingleError implements ExtensionElement {
|
public final class JingleError implements XmlElement {
|
||||||
|
|
||||||
public static String NAMESPACE = "urn:xmpp:jingle:errors:1";
|
public static String NAMESPACE = "urn:xmpp:jingle:errors:1";
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jingle.element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
@ -30,7 +30,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
* @see <a href="https://xmpp.org/extensions/xep-0166.html#def-reason">XEP-0166 § 7.4</a>
|
* @see <a href="https://xmpp.org/extensions/xep-0166.html#def-reason">XEP-0166 § 7.4</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class JingleReason implements FullyQualifiedElement {
|
public class JingleReason implements XmlElement {
|
||||||
|
|
||||||
public static final String ELEMENT = "reason";
|
public static final String ELEMENT = "reason";
|
||||||
public static final String NAMESPACE = Jingle.NAMESPACE;
|
public static final String NAMESPACE = Jingle.NAMESPACE;
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle.transports.jingle_ibb.element;
|
package org.jivesoftware.smackx.jingle.transports.jingle_ibb.element;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
|
@ -24,8 +27,10 @@ import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
|
||||||
/**
|
/**
|
||||||
* Transport Element for JingleInBandBytestream transports.
|
* Transport Element for JingleInBandBytestream transports.
|
||||||
*/
|
*/
|
||||||
public class JingleIBBTransport extends JingleContentTransport {
|
public class JingleIBBTransport extends JingleContentTransport implements ExtensionElement {
|
||||||
public static final String NAMESPACE_V1 = "urn:xmpp:jingle:transports:ibb:1";
|
public static final String NAMESPACE_V1 = "urn:xmpp:jingle:transports:ibb:1";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE_V1, ELEMENT);
|
||||||
|
|
||||||
public static final String ATTR_BLOCK_SIZE = "block-size";
|
public static final String ATTR_BLOCK_SIZE = "block-size";
|
||||||
public static final String ATTR_SID = "sid";
|
public static final String ATTR_SID = "sid";
|
||||||
|
|
||||||
|
@ -72,7 +77,7 @@ public class JingleIBBTransport extends JingleContentTransport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return NAMESPACE_V1;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,9 @@ package org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
|
@ -30,12 +33,14 @@ import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfo;
|
||||||
/**
|
/**
|
||||||
* Socks5Bytestream transport element.
|
* Socks5Bytestream transport element.
|
||||||
*/
|
*/
|
||||||
public class JingleS5BTransport extends JingleContentTransport {
|
public class JingleS5BTransport extends JingleContentTransport implements ExtensionElement {
|
||||||
public static final String NAMESPACE_V1 = "urn:xmpp:jingle:transports:s5b:1";
|
public static final String NAMESPACE_V1 = "urn:xmpp:jingle:transports:s5b:1";
|
||||||
public static final String ATTR_DSTADDR = "dstaddr";
|
public static final String ATTR_DSTADDR = "dstaddr";
|
||||||
public static final String ATTR_MODE = "mode";
|
public static final String ATTR_MODE = "mode";
|
||||||
public static final String ATTR_SID = "sid";
|
public static final String ATTR_SID = "sid";
|
||||||
|
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE_V1, ELEMENT);
|
||||||
|
|
||||||
private final String streamId;
|
private final String streamId;
|
||||||
private final String dstAddr;
|
private final String dstAddr;
|
||||||
private final Bytestream.Mode mode;
|
private final Bytestream.Mode mode;
|
||||||
|
@ -62,7 +67,7 @@ public class JingleS5BTransport extends JingleContentTransport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return NAMESPACE_V1;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.datatypes.UInt16;
|
import org.jivesoftware.smack.datatypes.UInt16;
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
@ -130,7 +130,7 @@ public class MediaElement implements FormFieldChildElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Uri implements FullyQualifiedElement {
|
public static final class Uri implements XmlElement {
|
||||||
public static final String ELEMENT = "uri";
|
public static final String ELEMENT = "uri";
|
||||||
|
|
||||||
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
|
@ -19,9 +19,9 @@ package org.jivesoftware.smackx.mood.element;
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.FullyQualifiedElement;
|
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
@ -158,7 +158,7 @@ public class MoodElement implements ExtensionElement {
|
||||||
* {@link NamedElement} which represents the mood.
|
* {@link NamedElement} which represents the mood.
|
||||||
* This element has the element name of the mood selected from {@link Mood}.
|
* This element has the element name of the mood selected from {@link Mood}.
|
||||||
*/
|
*/
|
||||||
public static class MoodSubjectElement implements FullyQualifiedElement {
|
public static class MoodSubjectElement implements XmlElement {
|
||||||
|
|
||||||
private final Mood mood;
|
private final Mood mood;
|
||||||
private final MoodConcretisation concretisation;
|
private final MoodConcretisation concretisation;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.offline.OfflineMessageManager;
|
import org.jivesoftware.smackx.offline.OfflineMessageManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.offline.OfflineMessageManager;
|
import org.jivesoftware.smackx.offline.OfflineMessageManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.jivesoftware.smackx.pubsub;
|
package org.jivesoftware.smackx.pubsub;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
@ -36,7 +36,7 @@ import org.jxmpp.jid.BareJid;
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*/
|
*/
|
||||||
public class Affiliation implements ExtensionElement {
|
public class Affiliation implements XmlElement {
|
||||||
public static final String ELEMENT = "affiliation";
|
public static final String ELEMENT = "affiliation";
|
||||||
|
|
||||||
public enum AffiliationNamespace {
|
public enum AffiliationNamespace {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.pubsub.form.FilledConfigureForm;
|
import org.jivesoftware.smackx.pubsub.form.FilledConfigureForm;
|
||||||
|
|
||||||
|
@ -48,10 +48,10 @@ public class ConfigurationEvent extends NodeExtension implements EmbeddedPacketE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ExtensionElement> getExtensions() {
|
public List<XmlElement> getExtensions() {
|
||||||
if (getConfiguration() == null)
|
if (getConfiguration() == null)
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
else
|
else
|
||||||
return Arrays.asList((ExtensionElement) getConfiguration().getDataForm());
|
return Arrays.asList((XmlElement) getConfiguration().getDataForm());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,11 +38,11 @@ import org.jivesoftware.smack.util.PacketParserUtils;
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*/
|
*/
|
||||||
public interface EmbeddedPacketExtension extends ExtensionElement {
|
public interface EmbeddedPacketExtension extends XmlElement {
|
||||||
/**
|
/**
|
||||||
* Get the list of embedded {@link ExtensionElement} objects.
|
* Get the list of embedded {@link ExtensionElement} objects.
|
||||||
*
|
*
|
||||||
* @return List of embedded {@link ExtensionElement}
|
* @return List of embedded {@link ExtensionElement}
|
||||||
*/
|
*/
|
||||||
List<ExtensionElement> getExtensions();
|
List<XmlElement> getExtensions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||||
|
@ -35,7 +36,7 @@ import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*/
|
*/
|
||||||
public class EventElement implements EmbeddedPacketExtension {
|
public class EventElement implements EmbeddedPacketExtension, ExtensionElement {
|
||||||
/**
|
/**
|
||||||
* The constant String "event".
|
* The constant String "event".
|
||||||
*/
|
*/
|
||||||
|
@ -61,8 +62,8 @@ public class EventElement implements EmbeddedPacketExtension {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ExtensionElement> getExtensions() {
|
public List<XmlElement> getExtensions() {
|
||||||
return Arrays.asList(new ExtensionElement[] {getEvent()});
|
return Arrays.asList(new XmlElement[] {getEvent()});
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeExtension getEvent() {
|
public NodeExtension getEvent() {
|
||||||
|
@ -71,12 +72,12 @@ public class EventElement implements EmbeddedPacketExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return "event";
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return PubSubNamespace.event.getXmlns();
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||||
import org.jivesoftware.smack.packet.NamedElement;
|
import org.jivesoftware.smack.packet.NamedElement;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,8 +128,8 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<ExtensionElement> getExtensions() {
|
public List<XmlElement> getExtensions() {
|
||||||
return (List<ExtensionElement>) getItems();
|
return (List<XmlElement>) getItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,8 +23,8 @@ import java.util.List;
|
||||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
||||||
import org.jivesoftware.smackx.pubsub.form.ConfigureForm;
|
import org.jivesoftware.smackx.pubsub.form.ConfigureForm;
|
||||||
|
@ -71,7 +71,7 @@ public class LeafNode extends Node {
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @throws InterruptedException if the calling thread was interrupted.
|
||||||
*/
|
*/
|
||||||
public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
return getItems((List<ExtensionElement>) null, null);
|
return getItems((List<XmlElement>) null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,8 +177,8 @@ public class LeafNode extends Node {
|
||||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @throws InterruptedException if the calling thread was interrupted.
|
||||||
*/
|
*/
|
||||||
public <T extends Item> List<T> getItems(List<ExtensionElement> additionalExtensions,
|
public <T extends Item> List<T> getItems(List<XmlElement> additionalExtensions,
|
||||||
List<ExtensionElement> returnedExtensions) throws NoResponseException,
|
List<XmlElement> returnedExtensions) throws NoResponseException,
|
||||||
XMPPErrorException, NotConnectedException, InterruptedException {
|
XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
PubSub request = createPubsubPacket(IQ.Type.get, new GetItemsRequest(getId()));
|
PubSub request = createPubsubPacket(IQ.Type.get, new GetItemsRequest(getId()));
|
||||||
request.addExtensions(additionalExtensions);
|
request.addExtensions(additionalExtensions);
|
||||||
|
@ -192,7 +192,7 @@ public class LeafNode extends Node {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private <T extends Item> List<T> getItems(PubSub request,
|
private <T extends Item> List<T> getItems(PubSub request,
|
||||||
List<ExtensionElement> returnedExtensions) throws NoResponseException,
|
List<XmlElement> returnedExtensions) throws NoResponseException,
|
||||||
XMPPErrorException, NotConnectedException, InterruptedException {
|
XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
PubSub result = pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
PubSub result = pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||||
ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS);
|
ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS);
|
||||||
|
|
|
@ -28,10 +28,10 @@ import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||||
import org.jivesoftware.smack.filter.FlexibleStanzaTypeFilter;
|
import org.jivesoftware.smack.filter.FlexibleStanzaTypeFilter;
|
||||||
import org.jivesoftware.smack.filter.OrFilter;
|
import org.jivesoftware.smack.filter.OrFilter;
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.delay.DelayInformationManager;
|
import org.jivesoftware.smackx.delay.DelayInformationManager;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||||
|
@ -163,7 +163,7 @@ public abstract class Node {
|
||||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @throws InterruptedException if the calling thread was interrupted.
|
||||||
*/
|
*/
|
||||||
public List<Subscription> getSubscriptions(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions)
|
public List<Subscription> getSubscriptions(List<XmlElement> additionalExtensions, Collection<XmlElement> returnedExtensions)
|
||||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
return getSubscriptions(SubscriptionsNamespace.basic, additionalExtensions, returnedExtensions);
|
return getSubscriptions(SubscriptionsNamespace.basic, additionalExtensions, returnedExtensions);
|
||||||
}
|
}
|
||||||
|
@ -207,20 +207,20 @@ public abstract class Node {
|
||||||
* Retrieve Subscriptions List</a>
|
* Retrieve Subscriptions List</a>
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public List<Subscription> getSubscriptionsAsOwner(List<ExtensionElement> additionalExtensions,
|
public List<Subscription> getSubscriptionsAsOwner(List<XmlElement> additionalExtensions,
|
||||||
Collection<ExtensionElement> returnedExtensions) throws NoResponseException, XMPPErrorException,
|
Collection<XmlElement> returnedExtensions) throws NoResponseException, XMPPErrorException,
|
||||||
NotConnectedException, InterruptedException {
|
NotConnectedException, InterruptedException {
|
||||||
return getSubscriptions(SubscriptionsNamespace.owner, additionalExtensions, returnedExtensions);
|
return getSubscriptions(SubscriptionsNamespace.owner, additionalExtensions, returnedExtensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Subscription> getSubscriptions(SubscriptionsNamespace subscriptionsNamespace, List<ExtensionElement> additionalExtensions,
|
private List<Subscription> getSubscriptions(SubscriptionsNamespace subscriptionsNamespace, List<XmlElement> additionalExtensions,
|
||||||
Collection<ExtensionElement> returnedExtensions)
|
Collection<XmlElement> returnedExtensions)
|
||||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
PubSubElementType pubSubElementType = subscriptionsNamespace.type;
|
PubSubElementType pubSubElementType = subscriptionsNamespace.type;
|
||||||
|
|
||||||
PubSub pubSub = createPubsubPacket(IQ.Type.get, new NodeExtension(pubSubElementType, getId()));
|
PubSub pubSub = createPubsubPacket(IQ.Type.get, new NodeExtension(pubSubElementType, getId()));
|
||||||
if (additionalExtensions != null) {
|
if (additionalExtensions != null) {
|
||||||
for (ExtensionElement pe : additionalExtensions) {
|
for (XmlElement pe : additionalExtensions) {
|
||||||
pubSub.addExtension(pe);
|
pubSub.addExtension(pe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ public abstract class Node {
|
||||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @throws InterruptedException if the calling thread was interrupted.
|
||||||
*/
|
*/
|
||||||
public List<Affiliation> getAffiliations(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions)
|
public List<Affiliation> getAffiliations(List<XmlElement> additionalExtensions, Collection<XmlElement> returnedExtensions)
|
||||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
|
|
||||||
return getAffiliations(AffiliationNamespace.basic, additionalExtensions, returnedExtensions);
|
return getAffiliations(AffiliationNamespace.basic, additionalExtensions, returnedExtensions);
|
||||||
|
@ -326,20 +326,20 @@ public abstract class Node {
|
||||||
* @see <a href="http://www.xmpp.org/extensions/xep-0060.html#owner-affiliations-retrieve">XEP-60 § 8.9.1 Retrieve Affiliations List</a>
|
* @see <a href="http://www.xmpp.org/extensions/xep-0060.html#owner-affiliations-retrieve">XEP-60 § 8.9.1 Retrieve Affiliations List</a>
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
public List<Affiliation> getAffiliationsAsOwner(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions)
|
public List<Affiliation> getAffiliationsAsOwner(List<XmlElement> additionalExtensions, Collection<XmlElement> returnedExtensions)
|
||||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
|
|
||||||
return getAffiliations(AffiliationNamespace.owner, additionalExtensions, returnedExtensions);
|
return getAffiliations(AffiliationNamespace.owner, additionalExtensions, returnedExtensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Affiliation> getAffiliations(AffiliationNamespace affiliationsNamespace, List<ExtensionElement> additionalExtensions,
|
private List<Affiliation> getAffiliations(AffiliationNamespace affiliationsNamespace, List<XmlElement> additionalExtensions,
|
||||||
Collection<ExtensionElement> returnedExtensions) throws NoResponseException, XMPPErrorException,
|
Collection<XmlElement> returnedExtensions) throws NoResponseException, XMPPErrorException,
|
||||||
NotConnectedException, InterruptedException {
|
NotConnectedException, InterruptedException {
|
||||||
PubSubElementType pubSubElementType = affiliationsNamespace.type;
|
PubSubElementType pubSubElementType = affiliationsNamespace.type;
|
||||||
|
|
||||||
PubSub pubSub = createPubsubPacket(IQ.Type.get, new NodeExtension(pubSubElementType, getId()));
|
PubSub pubSub = createPubsubPacket(IQ.Type.get, new NodeExtension(pubSubElementType, getId()));
|
||||||
if (additionalExtensions != null) {
|
if (additionalExtensions != null) {
|
||||||
for (ExtensionElement pe : additionalExtensions) {
|
for (XmlElement pe : additionalExtensions) {
|
||||||
pubSub.addExtension(pe);
|
pubSub.addExtension(pe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -717,7 +717,7 @@ public abstract class Node {
|
||||||
// CHECKSTYLE:OFF
|
// CHECKSTYLE:OFF
|
||||||
EventElement event = (EventElement) packet.getExtensionElement("event", PubSubNamespace.event.getXmlns());
|
EventElement event = (EventElement) packet.getExtensionElement("event", PubSubNamespace.event.getXmlns());
|
||||||
|
|
||||||
List<ExtensionElement> extList = event.getExtensions();
|
List<XmlElement> extList = event.getExtensions();
|
||||||
|
|
||||||
if (extList.get(0).getElementName().equals(PubSubElementType.PURGE_EVENT.getElementName())) {
|
if (extList.get(0).getElementName().equals(PubSubElementType.PURGE_EVENT.getElementName())) {
|
||||||
listener.handlePurge();
|
listener.handlePurge();
|
||||||
|
@ -804,7 +804,7 @@ public abstract class Node {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (embedEvent instanceof EmbeddedPacketExtension) {
|
if (embedEvent instanceof EmbeddedPacketExtension) {
|
||||||
List<ExtensionElement> secondLevelList = ((EmbeddedPacketExtension) embedEvent).getExtensions();
|
List<XmlElement> secondLevelList = ((EmbeddedPacketExtension) embedEvent).getExtensions();
|
||||||
|
|
||||||
// XEP-0060 allows no elements on second level for notifications. See schema or
|
// XEP-0060 allows no elements on second level for notifications. See schema or
|
||||||
// for example § 4.3:
|
// for example § 4.3:
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.pubsub;
|
package org.jivesoftware.smackx.pubsub;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
import org.jivesoftware.smack.packet.XmlElement;
|
||||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||||
*
|
*
|
||||||
* @author Robin Collier
|
* @author Robin Collier
|
||||||
*/
|
*/
|
||||||
public class NodeExtension implements ExtensionElement {
|
public class NodeExtension implements XmlElement {
|
||||||
private final PubSubElementType element;
|
private final PubSubElementType element;
|
||||||
private final String node;
|
private final String node;
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue