aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java
index 961277cb..31186191 100644
--- a/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java
+++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacket.java
@@ -4,28 +4,69 @@ import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
/**
- * Created by tzur on 15.01.2016.
+ * Representation of a PubSub IQ packet as defined in XEP-0060.
+ * <br>One example:
+ * <pre>
+ * <iq type='get'
+ * from='romeo@montague.lit'
+ * to='pubsub.shakespeare.lit'
+ * id='items1'>
+ * <pubsub xmlns='http://jabber.org/protocol/pubsub'>
+ * <items node='urn:xmpp:pubsub:subscription'/>
+ * </pubsub>
+ * </iq>
+ * </pre>
+ * @see <a href="http://xmpp.org/extensions/xep-0330.html">http://xmpp.org/extensions/xep-0060.html</a>
*/
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);