diff --git a/src/main/java/envoy/server/data/GroupMessage.java b/src/main/java/envoy/server/data/GroupMessage.java index bc9fed7..4c64cf7 100644 --- a/src/main/java/envoy/server/data/GroupMessage.java +++ b/src/main/java/envoy/server/data/GroupMessage.java @@ -18,7 +18,6 @@ import envoy.data.MessageBuilder; * @author Maximilian Käfer * @since Envoy Server Standalone v0.1-beta */ - @Entity public class GroupMessage extends Message { diff --git a/src/main/java/envoy/server/data/Message.java b/src/main/java/envoy/server/data/Message.java index 128b122..9203a4f 100755 --- a/src/main/java/envoy/server/data/Message.java +++ b/src/main/java/envoy/server/data/Message.java @@ -2,16 +2,7 @@ package envoy.server.data; import java.util.Date; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.NamedQuery; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; +import javax.persistence.*; import envoy.data.MessageBuilder; diff --git a/src/main/java/envoy/server/net/ConnectionManager.java b/src/main/java/envoy/server/net/ConnectionManager.java index ef384bb..03f3810 100755 --- a/src/main/java/envoy/server/net/ConnectionManager.java +++ b/src/main/java/envoy/server/net/ConnectionManager.java @@ -1,6 +1,10 @@ package envoy.server.net; -import java.util.*; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; import com.jenkov.nioserver.ISocketIdListener; @@ -111,9 +115,6 @@ public class ConnectionManager implements ISocketIdListener { * @since Envoy Server Standalone v0.1-beta */ public Set getOnlineUsersOfGroup(Group group) { - Set onlineMembers = new HashSet<>(); - Set members = group.getContacts().stream().map(envoy.server.data.Contact::getID).collect(Collectors.toSet()); - members.forEach(userID -> { if (isOnline(userID)) onlineMembers.add(userID); }); - return onlineMembers; + return group.getContacts().stream().map(envoy.server.data.Contact::getID).filter(this::isOnline).collect(Collectors.toSet()); } } diff --git a/src/main/java/envoy/server/processors/GroupMessageProcessor.java b/src/main/java/envoy/server/processors/GroupMessageProcessor.java index 790f4e3..087e2c0 100644 --- a/src/main/java/envoy/server/processors/GroupMessageProcessor.java +++ b/src/main/java/envoy/server/processors/GroupMessageProcessor.java @@ -8,7 +8,6 @@ import javax.persistence.EntityExistsException; import envoy.data.GroupMessage; import envoy.data.Message.MessageStatus; -import envoy.event.MessageStatusChangeEvent; import envoy.server.data.PersistenceManager; import envoy.server.net.ConnectionManager; import envoy.server.net.ObjectWriteProxy; @@ -30,12 +29,6 @@ public class GroupMessageProcessor implements ObjectProcessor { public void process(GroupMessage groupMessage, long socketID, ObjectWriteProxy writeProxy) { groupMessage.nextStatus(); ConnectionManager connectionManager = ConnectionManager.getInstance(); - try { - writeProxy.write(socketID, new MessageStatusChangeEvent(groupMessage)); - } catch (IOException e) { - logger.warning("Could not send messageStatusChangeEvent to the sender of this groupMessage with ID: " + groupMessage.getID()); - e.printStackTrace(); - } final var members = PersistenceManager.getInstance().getGroupByID(groupMessage.getRecipientID()).getContacts(); for (long i = 0; i < groupMessage.getMemberStatuses().size(); i++) { diff --git a/src/main/java/envoy/server/processors/GroupResizeProcessor.java b/src/main/java/envoy/server/processors/GroupResizeProcessor.java index 7bcc72a..dc99535 100644 --- a/src/main/java/envoy/server/processors/GroupResizeProcessor.java +++ b/src/main/java/envoy/server/processors/GroupResizeProcessor.java @@ -49,7 +49,7 @@ public class GroupResizeProcessor implements ObjectProcessor { .map(connectionManager::getSocketId) .forEach(memberSocketID -> { try { - writeProxy.write(memberSocketID, commonGroup); + writeProxy.write(memberSocketID, commonGroup); } catch (IOException e) { e.printStackTrace(); }