aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketParser.java
blob: 682803c4872ce8c23db6d4677d6ce01b94b79c19 (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
package de.thedevstack.conversationsplus.xmpp.pubsub;

import de.thedevstack.conversationsplus.xml.Element;
import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket;

/**
 * Created by tzur on 15.01.2016.
 */
public class PubSubPacketParser {
    public static Element findPubSubPacket(IqPacket packet){
        if (null == packet) {
            return null;
        }
        return packet.findChild("pubsub", "http://jabber.org/protocol/pubsub");
    }

    public static Element findItemsFromPubSubElement(Element pubSubPacket) {
        if (null == pubSubPacket) {
            return null;
        }
        return pubSubPacket.findChild("items");
    }

    public static Element findItems(IqPacket packet) {
        return PubSubPacketParser.findItemsFromPubSubElement(PubSubPacketParser.findPubSubPacket(packet));
    }
}