package de.thedevstack.conversationsplus.xmpp.pubsub; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.stanzas.IqPacket; /** * Representation of a PubSub IQ packet as defined in XEP-0060. *
One example: *
 *   
 *      
 *          
 *      
 *   
 * 
* @see http://xmpp.org/extensions/xep-0060.html */ public class PubSubPacket extends IqPacket { /** * The namespace of pubsub. */ public static final String NAMESPACE = "http://jabber.org/protocol/pubsub"; /** * The name of the root element. */ public static final String ELEMENT_NAME = "pubsub"; /** * The PubSub element - everything which is added to this packet is a child of this element. */ private Element pubSubElement; /** * Instantiate the PubSubPacket for the given type. * @param type the IqPacket.TYPE */ public PubSubPacket(IqPacket.TYPE type) { super(type); this.pubSubElement = super.addChild(PubSubPacket.ELEMENT_NAME, PubSubPacket.NAMESPACE); } /** * Adds an element to the PubSub element instead of the IqPacket. * @param child the children to be added * @return the added children */ @Override public Element addChild(Element child) { return this.pubSubElement.addChild(child); } /** * Adds an element to the PubSub element instead of the IqPacket. * @param name name of the children to be added * @return the added children */ @Override public Element addChild(String name) { return this.pubSubElement.addChild(name); } /** * Adds an element to the PubSub element instead of the IqPacket. * @param name name of the children to be added * @param xmlns namespace of the children to be added * @return the added children */ @Override public Element addChild(String name, String xmlns) { return this.pubSubElement.addChild(name, xmlns); } }