aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/xmpp/pubsub/PubSubPacketParser.java
blob: 394fb5b24f042300cd4244584aa6ca926b2955c0 (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 eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.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));
    }
}