mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-27 00:32:07 +01:00
Remove xmlns field from Packet
Stanzas do not have a xmlns attribute in their top level element.
This commit is contained in:
parent
644ddf3d4c
commit
67011fc322
3 changed files with 2 additions and 18 deletions
|
@ -416,7 +416,6 @@ public class Message extends Packet {
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML() {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder();
|
XmlStringBuilder buf = new XmlStringBuilder();
|
||||||
buf.halfOpenElement("message");
|
buf.halfOpenElement("message");
|
||||||
buf.xmlnsAttribute(getXmlns());
|
|
||||||
buf.xmllangAttribute(getLanguage());
|
buf.xmllangAttribute(getLanguage());
|
||||||
addCommonAttributes(buf);
|
addCommonAttributes(buf);
|
||||||
if (type != Type.normal) {
|
if (type != Type.normal) {
|
||||||
|
|
|
@ -42,8 +42,6 @@ public abstract class Packet {
|
||||||
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 static String DEFAULT_XML_NS = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A prefix helps to make sure that ID's are unique across multiple instances.
|
* A prefix helps to make sure that ID's are unique across multiple instances.
|
||||||
*/
|
*/
|
||||||
|
@ -55,12 +53,6 @@ public abstract class Packet {
|
||||||
*/
|
*/
|
||||||
private static AtomicLong id = new AtomicLong();
|
private static AtomicLong id = new AtomicLong();
|
||||||
|
|
||||||
private String xmlns = DEFAULT_XML_NS;
|
|
||||||
|
|
||||||
public static void setDefaultXmlns(String defaultXmlns) {
|
|
||||||
DEFAULT_XML_NS = defaultXmlns;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String packetID = null;
|
private String packetID = null;
|
||||||
private String to = null;
|
private String to = null;
|
||||||
private String from = null;
|
private String from = null;
|
||||||
|
@ -81,7 +73,6 @@ public abstract class Packet {
|
||||||
packetID = p.getPacketID();
|
packetID = p.getPacketID();
|
||||||
to = p.getTo();
|
to = p.getTo();
|
||||||
from = p.getFrom();
|
from = p.getFrom();
|
||||||
xmlns = p.xmlns;
|
|
||||||
error = p.error;
|
error = p.error;
|
||||||
|
|
||||||
// Copy extensions
|
// Copy extensions
|
||||||
|
@ -280,10 +271,6 @@ public abstract class Packet {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getXmlns() {
|
|
||||||
return this.xmlns;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default language used for all messages containing localized content.
|
* Returns the default language used for all messages containing localized content.
|
||||||
*
|
*
|
||||||
|
@ -307,13 +294,12 @@ public abstract class Packet {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (to != null ? !to.equals(packet.to) : packet.to != null) { return false; }
|
if (to != null ? !to.equals(packet.to) : packet.to != null) { return false; }
|
||||||
return !(xmlns != null ? !xmlns.equals(packet.xmlns) : packet.xmlns != null);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result;
|
int result = 1;
|
||||||
result = (xmlns != null ? xmlns.hashCode() : 0);
|
|
||||||
result = 31 * result + (packetID != null ? packetID.hashCode() : 0);
|
result = 31 * result + (packetID != null ? packetID.hashCode() : 0);
|
||||||
result = 31 * result + (to != null ? to.hashCode() : 0);
|
result = 31 * result + (to != null ? to.hashCode() : 0);
|
||||||
result = 31 * result + (from != null ? from.hashCode() : 0);
|
result = 31 * result + (from != null ? from.hashCode() : 0);
|
||||||
|
|
|
@ -228,7 +228,6 @@ public class Presence extends Packet {
|
||||||
public XmlStringBuilder toXML() {
|
public XmlStringBuilder toXML() {
|
||||||
XmlStringBuilder buf = new XmlStringBuilder();
|
XmlStringBuilder buf = new XmlStringBuilder();
|
||||||
buf.halfOpenElement(ELEMENT);
|
buf.halfOpenElement(ELEMENT);
|
||||||
buf.xmlnsAttribute(getXmlns());
|
|
||||||
buf.xmllangAttribute(getLanguage());
|
buf.xmllangAttribute(getLanguage());
|
||||||
addCommonAttributes(buf);
|
addCommonAttributes(buf);
|
||||||
if (type != Type.available) {
|
if (type != Type.available) {
|
||||||
|
|
Loading…
Reference in a new issue