Merge branch '4.4'

master
Florian Schmaus 1 year ago
commit 5493a22e44
  1. 5
      smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java
  2. 10
      smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java
  3. 18
      smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/element/HashElement.java
  4. 10
      smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/Base64BinaryChunk.java
  5. 5
      smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/BlockQuoteElement.java
  6. 5
      smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCUser.java
  7. 17
      smack-extensions/src/main/java/org/jivesoftware/smackx/nick/packet/Nick.java
  8. 10
      smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java
  9. 9
      smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageInfo.java
  10. 3
      smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageRequest.java
  11. 8
      smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterPacket.java

@ -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");
* you may not use this file except in compliance with the License.
@ -17,6 +17,8 @@
package org.jivesoftware.smack.packet;
import javax.xml.namespace.QName;
import org.jxmpp.jid.EntityFullJid;
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 QName QNAME = new QName(NAMESPACE, ELEMENT);
public static final Feature INSTANCE = new 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");
* 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.logging.Logger;
import javax.xml.namespace.QName;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.StringUtils;
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 QName QNAME = new QName(StreamOpen.CLIENT_NAMESPACE, ERROR);
private static final Logger LOGGER = Logger.getLogger(StanzaError.class.getName());
static final Map<Condition, Type> CONDITION_TO_TYPE = new HashMap<Condition, Type>();
@ -199,12 +203,12 @@ public class StanzaError extends AbstractError implements ExtensionElement {
@Override
public String getElementName() {
return ERROR;
return QNAME.getLocalPart();
}
@Override
public String getNamespace() {
return StreamOpen.CLIENT_NAMESPACE;
return QNAME.getNamespaceURI();
}
@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");
* 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 javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.util.XmlStringBuilder;
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 ATTR_ALGO = "algo";
public static final QName QNAME = new QName(HashManager.NAMESPACE.V2.toString(), ELEMENT);
private final HashManager.ALGORITHM algorithm;
private final byte[] hash;
private final String hashB64;
@ -89,7 +93,12 @@ public class HashElement implements ExtensionElement {
@Override
public String getElementName() {
return ELEMENT;
return QNAME.getLocalPart();
}
@Override
public String getNamespace() {
return QNAME.getNamespaceURI();
}
@Override
@ -102,11 +111,6 @@ public class HashElement implements ExtensionElement {
return sb;
}
@Override
public String getNamespace() {
return HashManager.NAMESPACE.V2.toString();
}
@Override
public boolean equals(Object other) {
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");
* you may not use this file except in compliance with the License.
@ -16,6 +16,8 @@
*/
package org.jivesoftware.smackx.hoxt.packet;
import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.util.Objects;
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_NR = "nr";
public static final QName QNAME = new QName(HOXTManager.NAMESPACE, ELEMENT_CHUNK);
private final String streamId;
private final boolean last;
private final String text;
@ -108,12 +112,12 @@ public class Base64BinaryChunk implements ExtensionElement {
@Override
public String getElementName() {
return ELEMENT_CHUNK;
return QNAME.getLocalPart();
}
@Override
public String getNamespace() {
return HOXTManager.NAMESPACE;
return QNAME.getNamespaceURI();
}
@Override

@ -16,9 +16,12 @@
*/
package org.jivesoftware.smackx.message_markup.element;
import javax.xml.namespace.QName;
public class BlockQuoteElement extends MarkupElement.BlockLevelMarkupElement {
public static final String ELEMENT = "bquote";
public static final QName QNAME = new QName(MarkupElement.NAMESPACE, ELEMENT);
/**
* Create a new Block Quote element.
@ -32,7 +35,7 @@ public class BlockQuoteElement extends MarkupElement.BlockLevelMarkupElement {
@Override
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 final String ELEMENT = "decline";
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
private final String reason;
private final EntityBareJid from;
@ -384,12 +385,12 @@ public class MUCUser implements ExtensionElement {
@Override
public String getElementName() {
return ELEMENT;
return QNAME.getLocalPart();
}
@Override
public String getNamespace() {
return NAMESPACE;
return QNAME.getNamespaceURI();
}
}

@ -16,6 +16,8 @@
*/
package org.jivesoftware.smackx.nick.packet;
import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.util.StringUtils;
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 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;
@ -49,12 +60,12 @@ public class Nick implements ExtensionElement {
@Override
public String getElementName() {
return ELEMENT_NAME;
return QNAME.getLocalPart();
}
@Override
public String getNamespace() {
return NAMESPACE;
return QNAME.getNamespaceURI();
}
@Override

@ -65,7 +65,7 @@ public final class OfflineMessageManager extends Manager {
private static final Logger LOGGER = Logger.getLogger(OfflineMessageManager.class.getName());
private static final String namespace = "http://jabber.org/protocol/offline";
public static final String NAMESPACE = "http://jabber.org/protocol/offline";
private static final Map<XMPPConnection, OfflineMessageManager> INSTANCES = new WeakHashMap<>();
@ -100,7 +100,7 @@ public final class OfflineMessageManager extends Manager {
* @throws InterruptedException if the calling thread was interrupted.
*/
public boolean supportsFlexibleRetrieval() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return serviceDiscoveryManager.serverSupportsFeature(namespace);
return serviceDiscoveryManager.serverSupportsFeature(NAMESPACE);
}
/**
@ -114,8 +114,8 @@ public final class OfflineMessageManager extends Manager {
* @throws InterruptedException if the calling thread was interrupted.
*/
public int getMessageCount() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
DiscoverInfo info = serviceDiscoveryManager.discoverInfo(null, namespace);
DataForm dataForm = DataForm.from(info, namespace);
DiscoverInfo info = serviceDiscoveryManager.discoverInfo(null, NAMESPACE);
DataForm dataForm = DataForm.from(info, NAMESPACE);
if (dataForm == null) {
return 0;
}
@ -138,7 +138,7 @@ public final class OfflineMessageManager extends Manager {
*/
public List<OfflineMessageHeader> getHeaders() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<OfflineMessageHeader> answer = new ArrayList<>();
DiscoverItems items = serviceDiscoveryManager.discoverItems(null, namespace);
DiscoverItems items = serviceDiscoveryManager.discoverItems(null, NAMESPACE);
for (DiscoverItems.Item item : items.getItems()) {
answer.add(new OfflineMessageHeader(item));
}

@ -19,11 +19,14 @@ package org.jivesoftware.smackx.offline.packet;
import java.io.IOException;
import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.offline.OfflineMessageManager;
/**
* OfflineMessageInfo is an extension included in the retrieved offline messages requested by
@ -35,6 +38,8 @@ import org.jivesoftware.smack.xml.XmlPullParserException;
*/
public class OfflineMessageInfo implements ExtensionElement {
public static final QName QNAME = new QName(OfflineMessageManager.NAMESPACE, "offline");
private String node = null;
/**
@ -45,7 +50,7 @@ public class OfflineMessageInfo implements ExtensionElement {
*/
@Override
public String getElementName() {
return "offline";
return QNAME.getLocalPart();
}
/**
@ -56,7 +61,7 @@ public class OfflineMessageInfo implements ExtensionElement {
*/
@Override
public String getNamespace() {
return "http://jabber.org/protocol/offline";
return QNAME.getNamespaceURI();
}
/**

@ -27,6 +27,7 @@ import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.offline.OfflineMessageManager;
/**
* Represents a request to get some or all the offline messages of a user. This class can also
@ -37,7 +38,7 @@ import org.jivesoftware.smack.xml.XmlPullParserException;
public class OfflineMessageRequest extends IQ {
public static final String ELEMENT = "offline";
public static final String NAMESPACE = "http://jabber.org/protocol/offline";
public static final String NAMESPACE = OfflineMessageManager.NAMESPACE;
private final List<Item> items = new ArrayList<>();
private boolean purge = false;

@ -24,6 +24,8 @@ import java.util.Locale;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.IQ;
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 QName QNAME = new QName(NAMESPACE, ELEMENT);
public static final String GROUP = "group";
private final BareJid jid;
@ -160,12 +164,12 @@ public final class RosterPacket extends IQ {
@Override
public String getElementName() {
return ELEMENT;
return QNAME.getLocalPart();
}
@Override
public String getNamespace() {
return NAMESPACE;
return QNAME.getNamespaceURI();
}
/**

Loading…
Cancel
Save