Example #1
0
 /**
  * Adds a stanza(/packet) extension to the packet. Does nothing if extension is null.
  *
  * @param extension a stanza(/packet) extension.
  */
 public void addExtension(ExtensionElement extension) {
   if (extension == null) return;
   String key = XmppStringUtils.generateKey(extension.getElementName(), extension.getNamespace());
   synchronized (packetExtensions) {
     packetExtensions.put(key, extension);
   }
 }
Example #2
0
 /**
  * Removes a stanza(/packet) extension from the packet.
  *
  * @param extension the stanza(/packet) extension to remove.
  * @return the removed stanza(/packet) extension or null.
  */
 public ExtensionElement removeExtension(ExtensionElement extension) {
   return removeExtension(extension.getElementName(), extension.getNamespace());
 }