1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

SMACK-361 Added support for Entity Capabilities.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13560 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-03-18 08:50:48 +00:00 committed by flow
parent 1cdb86989a
commit 21be8c55ee
33 changed files with 2395 additions and 88 deletions

View file

@ -43,6 +43,14 @@ public abstract class IQ extends Packet {
private Type type = Type.GET;
public IQ() {
super();
}
public IQ(IQ iq) {
super(iq);
type = iq.getType();
}
/**
* Returns the type of the IQ packet.
*

View file

@ -90,6 +90,22 @@ public abstract class Packet {
private final Map<String,Object> properties = new HashMap<String, Object>();
private XMPPError error = null;
public Packet() {
}
public Packet(Packet p) {
packetID = p.getPacketID();
to = p.getTo();
from = p.getFrom();
xmlns = p.xmlns;
error = p.error;
// Copy extensions
for (PacketExtension pe : p.getExtensions()) {
addExtension(pe);
}
}
/**
* Returns the unique ID of the packet. The returned value could be <tt>null</tt> when
* ID_NOT_AVAILABLE was set as the packet's id.
@ -247,14 +263,25 @@ public abstract class Packet {
}
/**
* Adds a packet extension to the packet.
* Adds a packet extension to the packet. Does nothing if extension is null.
*
* @param extension a packet extension.
*/
public void addExtension(PacketExtension extension) {
if (extension == null) return;
packetExtensions.add(extension);
}
/**
* Adds a collection of packet extensions to the packet. Does nothing if extensions is null.
*
* @param extensions a collection of packet extensions
*/
public void addExtensions(Collection<PacketExtension> extensions) {
if (extensions == null) return;
packetExtensions.addAll(extensions);
}
/**
* Removes a packet extension from the packet.
*
@ -266,7 +293,7 @@ public abstract class Packet {
/**
* Returns the packet property with the specified name or <tt>null</tt> if the
* property doesn't exist. Property values that were orginally primitives will
* property doesn't exist. Property values that were originally primitives will
* be returned as their object equivalent. For example, an int property will be
* returned as an Integer, a double as a Double, etc.
*
@ -456,4 +483,4 @@ public abstract class Packet {
result = 31 * result + (error != null ? error.hashCode() : 0);
return result;
}
}
}