1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-23 13:07:59 +01:00

Allows IQ packets to include extensions

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2262 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2004-03-29 21:31:52 +00:00 committed by gdombiak
parent 46f339d8db
commit 1c424c3449

View file

@ -212,18 +212,13 @@ public abstract class Packet {
/**
* Returns the first packet extension that matches the specified element name and
* namespace, or <tt>null</tt> if it doesn't exist. Packet extensions are
* are arbitrary XML sub-documents in standard XMPP packets (except for IQ packets,
* which don't allow extensions). By default, a DefaultPacketExtension instance will
* be returned for each extension. However, PacketExtensionProvider instances can be
* registered with the {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager}
* are arbitrary XML sub-documents in standard XMPP packets. By default, a
* DefaultPacketExtension instance will be returned for each extension. However,
* PacketExtensionProvider instances can be registered with the
* {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager}
* class to handle custom parsing. In that case, the type of the Object
* 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 namespace the XML element namespace of the packet extension.
* @return the extension, or <tt>null</tt> if it doesn't exist.
@ -244,19 +239,9 @@ public abstract class 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.
*/
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) {
packetExtensions = new ArrayList();
}
@ -266,11 +251,6 @@ public abstract class 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.
*/
public synchronized void removeExtension(PacketExtension extension) {