aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java
blob: 7d5bf43a998d2393262e9d01af1ffbfe4441fc05 (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
33
34
35
package de.thedevstack.conversationsplus.xmpp.stanzas;

import de.thedevstack.conversationsplus.entities.Presence;

public class PresencePacket extends AbstractAcknowledgeableStanza {

    public PresencePacket() {
        super("presence");
    }

	public PresencePacket(Presence.Status status) {
		super("presence");
        String show;
        switch(status) {
            case CHAT:
                show = "chat";
                break;
            case AWAY:
                show = "away";
                break;
            case XA:
                show = "xa";
                break;
            case DND:
                show = "dnd";
                break;
            default:
                show = null;
        }

		if(show != null) {
			this.addChild("show").setContent(show);
		}
	}
}