blob: 398ec032565af6c0fafdcd2dd8c4b1a7ae937bd2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package de.thedevstack.conversationsplus.xmpp.pubsub;
import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
/**
* Created by tzur on 15.01.2016.
*/
public final class PubSubPacketGenerator {
public static PubSubPacket generatePubSubPublishPacket(String nodeName, Element item) {
final PubSubPacket pubsub = new PubSubPacket(IqPacket.TYPE.SET);
final Element publish = pubsub.addChild("publish");
publish.setAttribute("node", nodeName);
publish.addChild(item);
return pubsub;
}
public static PubSubPacket generatePubSubRetrievePacket(String nodeName, Element item) {
final PubSubPacket pubsub = new PubSubPacket(IqPacket.TYPE.GET);
final Element items = pubsub.addChild("items");
items.setAttribute("node", nodeName);
if (item != null) {
items.addChild(item);
}
return pubsub;
}
private PubSubPacketGenerator() {
// Avoid instantiation
}
}
|