mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +01:00
Noted that IQ packets can't have extensions.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2009 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
8ed06a4f06
commit
2aeb58b776
1 changed files with 20 additions and 0 deletions
|
@ -206,6 +206,11 @@ public abstract class Packet {
|
||||||
* class to handle custom parsing. In that case, the type of the Object
|
* class to handle custom parsing. In that case, the type of the Object
|
||||||
* will be determined by the provider.
|
* will be determined by the provider.
|
||||||
*
|
*
|
||||||
|
* <p>Note: According to the XMPP specification, IQ packets cannot contain
|
||||||
|
* packet extensions. Instead, they must contain only a single XML sub-document,
|
||||||
|
* which is returned via the {@link IQ#getChildElementXML()} method. Therefore,
|
||||||
|
* attempting to add an extension to an IQ packet will silently fail.
|
||||||
|
*
|
||||||
* @param elementName the XML element name of the packet extension.
|
* @param elementName the XML element name of the packet extension.
|
||||||
* @param namespace the XML element namespace of the packet extension.
|
* @param namespace the XML element namespace of the packet extension.
|
||||||
* @return the extension, or <tt>null</tt> if it doesn't exist.
|
* @return the extension, or <tt>null</tt> if it doesn't exist.
|
||||||
|
@ -226,9 +231,19 @@ public abstract class Packet {
|
||||||
/**
|
/**
|
||||||
* Adds a packet extension to the packet.
|
* Adds a packet extension to the packet.
|
||||||
*
|
*
|
||||||
|
* <p>Note: According to the XMPP specification, IQ packets cannot contain
|
||||||
|
* packet extensions. Instead, they must contain only a single XML sub-document,
|
||||||
|
* which is returned via the {@link IQ#getChildElementXML()} method. Therefore,
|
||||||
|
* attempting to add an extension to an IQ packet will silently fail.
|
||||||
|
*
|
||||||
* @param extension a packet extension.
|
* @param extension a packet extension.
|
||||||
*/
|
*/
|
||||||
public synchronized void addExtension(PacketExtension extension) {
|
public synchronized void addExtension(PacketExtension extension) {
|
||||||
|
// If the packet is an IQ packet, ignore trying to add an extension to it.
|
||||||
|
if (this instanceof IQ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (packetExtensions == null) {
|
if (packetExtensions == null) {
|
||||||
packetExtensions = new ArrayList();
|
packetExtensions = new ArrayList();
|
||||||
}
|
}
|
||||||
|
@ -238,6 +253,11 @@ public abstract class Packet {
|
||||||
/**
|
/**
|
||||||
* Removes a packet extension from the packet.
|
* Removes a packet extension from the packet.
|
||||||
*
|
*
|
||||||
|
* <p>Note: According to the XMPP specification, IQ packets cannot contain
|
||||||
|
* packet extensions. Instead, they must contain only a single XML sub-document,
|
||||||
|
* which is returned via the {@link IQ#getChildElementXML()} method. Therefore,
|
||||||
|
* attempting to add an extension to an IQ packet will silently fail.
|
||||||
|
*
|
||||||
* @param extension the packet extension to remove.
|
* @param extension the packet extension to remove.
|
||||||
*/
|
*/
|
||||||
public synchronized void removeExtension(PacketExtension extension) {
|
public synchronized void removeExtension(PacketExtension extension) {
|
||||||
|
|
Loading…
Reference in a new issue