aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-08-02 12:43:47 +0200
committersteckbrief <steckbrief@chefmail.de>2017-08-02 12:43:47 +0200
commit76ce6f52062aa802482497bc79aa05ee3e73244b (patch)
treeae6b23574f544c80c38338fbf0b948756c174ddc /src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java
parent8c5208bacd95ebd1ad6a6c192e536fd1ed47bfe2 (diff)
Using a generator approach for generating PresencePackets
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java
index 5fd21b3b..7d5bf43a 100644
--- a/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java
+++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/PresencePacket.java
@@ -1,8 +1,35 @@
package de.thedevstack.conversationsplus.xmpp.stanzas;
+import de.thedevstack.conversationsplus.entities.Presence;
+
public class PresencePacket extends AbstractAcknowledgeableStanza {
- public PresencePacket() {
+ 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);
+ }
}
}