aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/xmpp/stanzas/AbstractAcknowledgeableStanza.java
blob: 22d035e6e59f9c257f1c4e78da8a14c6e2147979 (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
package de.pixart.messenger.xmpp.stanzas;

import de.pixart.messenger.xml.Element;

abstract public class AbstractAcknowledgeableStanza extends AbstractStanza {

    protected AbstractAcknowledgeableStanza(String name) {
        super(name);
    }


    public String getId() {
        return this.getAttribute("id");
    }

    public void setId(final String id) {
        setAttribute("id", id);
    }

    public Element getError() {
        Element error = findChild("error");
        if (error != null) {
            for (Element element : error.getChildren()) {
                if (!element.getName().equals("text")) {
                    return element;
                }
            }
        }
        return null;
    }
}