--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/unixwork/im/PresenceInfo.java Thu Dec 26 17:19:15 2024 +0100 @@ -0,0 +1,31 @@ +package de.unixwork.im; + +import java.util.HashMap; +import java.util.Map; +import org.jivesoftware.smack.packet.Presence; + + +public class PresenceInfo { + private final Map<String, Presence.Type> presence = new HashMap<>(4); + + public PresenceInfo() { + + } + + public void setStatus(String resource, Presence.Type type) { + presence.put(resource, type); + } + + public String getOnlineStatus() { + String status = "<offline> "; + for (Map.Entry<String, Presence.Type> entry : presence.entrySet()) { + Presence.Type type = entry.getValue(); + if(type == Presence.Type.available) { + status = "<online> "; + break; + } + } + + return status; + } +}