diff options
Diffstat (limited to 'src/eu/siacs/conversations/entities/Presences.java')
-rw-r--r-- | src/eu/siacs/conversations/entities/Presences.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/entities/Presences.java b/src/eu/siacs/conversations/entities/Presences.java index af7926a8..9a22e559 100644 --- a/src/eu/siacs/conversations/entities/Presences.java +++ b/src/eu/siacs/conversations/entities/Presences.java @@ -8,6 +8,8 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import eu.siacs.conversations.xml.Element; + public class Presences { public static final int CHAT = -1; @@ -73,4 +75,24 @@ public class Presences { } return presences; } + + public static int parseShow(Element show) { + if (show == null) { + return Presences.ONLINE; + } else if (show.getContent().equals("away")) { + return Presences.AWAY; + } else if (show.getContent().equals("xa")) { + return Presences.XA; + } else if (show.getContent().equals("chat")) { + return Presences.CHAT; + } else if (show.getContent().equals("dnd")) { + return Presences.DND; + } else { + return Presences.OFFLINE; + } + } + + public int size() { + return presences.size(); + } } |