mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Add more QNAME fields to extension element classes
This commit is contained in:
parent
36c7521ca2
commit
961882ff7f
8 changed files with 56 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2007 Jive Software, 2015-2016 Florian Schmaus.
|
* Copyright 2003-2007 Jive Software, 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.
|
||||||
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package org.jivesoftware.smack.packet;
|
package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jxmpp.jid.EntityFullJid;
|
import org.jxmpp.jid.EntityFullJid;
|
||||||
import org.jxmpp.jid.parts.Resourcepart;
|
import org.jxmpp.jid.parts.Resourcepart;
|
||||||
|
|
||||||
|
@ -73,6 +75,7 @@ public final class Bind extends IQ {
|
||||||
|
|
||||||
public static final class Feature implements ExtensionElement {
|
public static final class Feature implements ExtensionElement {
|
||||||
|
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
public static final Feature INSTANCE = new Feature();
|
public static final Feature INSTANCE = new Feature();
|
||||||
|
|
||||||
private Feature() {
|
private Feature() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2003-2007 Jive Software, 2015-2019 Florian Schmaus
|
* Copyright 2003-2007 Jive Software, 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.
|
||||||
|
@ -22,6 +22,8 @@ import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -74,6 +76,8 @@ public class StanzaError extends AbstractError implements ExtensionElement {
|
||||||
|
|
||||||
public static final String ERROR = "error";
|
public static final String ERROR = "error";
|
||||||
|
|
||||||
|
public static final QName QNAME = new QName(StreamOpen.CLIENT_NAMESPACE, ERROR);
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(StanzaError.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(StanzaError.class.getName());
|
||||||
static final Map<Condition, Type> CONDITION_TO_TYPE = new HashMap<Condition, Type>();
|
static final Map<Condition, Type> CONDITION_TO_TYPE = new HashMap<Condition, Type>();
|
||||||
|
|
||||||
|
@ -199,12 +203,12 @@ public class StanzaError extends AbstractError implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ERROR;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return StreamOpen.CLIENT_NAMESPACE;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2017 Paul Schaub
|
* Copyright © 2017 Paul Schaub, 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,6 +18,8 @@ package org.jivesoftware.smackx.hashes.element;
|
||||||
|
|
||||||
import static org.jivesoftware.smack.util.Objects.requireNonNull;
|
import static org.jivesoftware.smack.util.Objects.requireNonNull;
|
||||||
|
|
||||||
|
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;
|
||||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||||
|
@ -34,6 +36,8 @@ public class HashElement implements ExtensionElement {
|
||||||
public static final String ELEMENT = "hash";
|
public static final String ELEMENT = "hash";
|
||||||
public static final String ATTR_ALGO = "algo";
|
public static final String ATTR_ALGO = "algo";
|
||||||
|
|
||||||
|
public static final QName QNAME = new QName(HashManager.NAMESPACE.V2.toString(), ELEMENT);
|
||||||
|
|
||||||
private final HashManager.ALGORITHM algorithm;
|
private final HashManager.ALGORITHM algorithm;
|
||||||
private final byte[] hash;
|
private final byte[] hash;
|
||||||
private final String hashB64;
|
private final String hashB64;
|
||||||
|
@ -89,7 +93,12 @@ public class HashElement implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT;
|
return QNAME.getLocalPart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getNamespace() {
|
||||||
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,11 +111,6 @@ public class HashElement implements ExtensionElement {
|
||||||
return sb;
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getNamespace() {
|
|
||||||
return HashManager.NAMESPACE.V2.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (other == null || !(other instanceof HashElement)) {
|
if (other == null || !(other instanceof HashElement)) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2014 Andriy Tsykholyas, 2015 Florian Schmaus
|
* Copyright 2014 Andriy Tsykholyas, 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.
|
||||||
|
@ -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.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
@ -36,6 +38,8 @@ public class Base64BinaryChunk implements ExtensionElement {
|
||||||
public static final String ATTRIBUTE_LAST = "last";
|
public static final String ATTRIBUTE_LAST = "last";
|
||||||
public static final String ATTRIBUTE_NR = "nr";
|
public static final String ATTRIBUTE_NR = "nr";
|
||||||
|
|
||||||
|
public static final QName QNAME = new QName(HOXTManager.NAMESPACE, ELEMENT_CHUNK);
|
||||||
|
|
||||||
private final String streamId;
|
private final String streamId;
|
||||||
private final boolean last;
|
private final boolean last;
|
||||||
private final String text;
|
private final String text;
|
||||||
|
@ -108,12 +112,12 @@ public class Base64BinaryChunk implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT_CHUNK;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return HOXTManager.NAMESPACE;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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 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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Block Quote element.
|
* Create a new Block Quote element.
|
||||||
|
@ -32,7 +35,7 @@ public class BlockQuoteElement extends MarkupElement.BlockLevelMarkupElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,6 +328,7 @@ public class MUCUser implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
public static class Decline implements ExtensionElement {
|
public static class Decline implements ExtensionElement {
|
||||||
public static final String ELEMENT = "decline";
|
public static final String ELEMENT = "decline";
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
private final String reason;
|
private final String reason;
|
||||||
private final EntityBareJid from;
|
private final EntityBareJid from;
|
||||||
|
@ -384,12 +385,12 @@ public class MUCUser 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.nick.packet;
|
package org.jivesoftware.smackx.nick.packet;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
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,7 +32,16 @@ public class Nick implements ExtensionElement {
|
||||||
|
|
||||||
public static final String NAMESPACE = "http://jabber.org/protocol/nick";
|
public static final String NAMESPACE = "http://jabber.org/protocol/nick";
|
||||||
|
|
||||||
public static final String ELEMENT_NAME = "nick";
|
public static final QName QNAME = new QName(NAMESPACE, "nick");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deprected, do not use.
|
||||||
|
*
|
||||||
|
* @deprecated use {@link #QNAME} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
// TODO: Remove in Smack 4.6.
|
||||||
|
public static final String ELEMENT_NAME = QNAME.getLocalPart();
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
@ -49,12 +60,12 @@ public class Nick implements ExtensionElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
return ELEMENT_NAME;
|
return QNAME.getLocalPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNamespace() {
|
public String getNamespace() {
|
||||||
return NAMESPACE;
|
return QNAME.getNamespaceURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,6 +24,8 @@ import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
||||||
|
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.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
|
@ -119,6 +121,8 @@ public final class RosterPacket extends IQ {
|
||||||
*/
|
*/
|
||||||
public static final String ELEMENT = Stanza.ITEM;
|
public static final String ELEMENT = Stanza.ITEM;
|
||||||
|
|
||||||
|
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||||
|
|
||||||
public static final String GROUP = "group";
|
public static final String GROUP = "group";
|
||||||
|
|
||||||
private final BareJid jid;
|
private final BareJid jid;
|
||||||
|
@ -160,12 +164,12 @@ public final class RosterPacket extends IQ {
|
||||||
|
|
||||||
@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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue