diff options
author | Stephen Paul Weber <singpolyma@singpolyma.net> | 2016-01-17 16:28:38 -0500 |
---|---|---|
committer | Stephen Paul Weber <singpolyma@singpolyma.net> | 2016-01-24 17:46:08 -0500 |
commit | bf5b2f73f5a61f0a0179c9d4431579f87eecb001 (patch) | |
tree | 5bd8b9aaa8b4326dfecb699fd1cdcf97a02b8097 /src/main/java/eu/siacs/conversations/generator | |
parent | ad36a4ba89f880a5522ffd5179dcaa98985e4164 (diff) |
Use a Presence class for presence information
Only has status for now, but doing it so I can add disco to it
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java b/src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java index fdfde88c..093a8963 100644 --- a/src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java @@ -2,7 +2,7 @@ package eu.siacs.conversations.generator; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; -import eu.siacs.conversations.entities.Presences; +import eu.siacs.conversations.entities.Presence; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.stanzas.PresencePacket; @@ -37,21 +37,10 @@ public class PresenceGenerator extends AbstractGenerator { return subscription("subscribed", contact); } - public PresencePacket selfPresence(Account account, int presence) { + public PresencePacket selfPresence(Account account, Presence.Status status) { PresencePacket packet = new PresencePacket(); - switch(presence) { - case Presences.AWAY: - packet.addChild("show").setContent("away"); - break; - case Presences.XA: - packet.addChild("show").setContent("xa"); - break; - case Presences.CHAT: - packet.addChild("show").setContent("chat"); - break; - case Presences.DND: - packet.addChild("show").setContent("dnd"); - break; + if(status.toShowString() != null) { + packet.addChild("show").setContent(status.toShowString()); } packet.setFrom(account.getJid()); String sig = account.getPgpSignature(); |