diff --git a/client/src/main/java/envoy/client/net/ReceivedMessageProcessor.java b/client/src/main/java/envoy/client/net/ReceivedMessageProcessor.java index f83815c..84aa7dc 100644 --- a/client/src/main/java/envoy/client/net/ReceivedMessageProcessor.java +++ b/client/src/main/java/envoy/client/net/ReceivedMessageProcessor.java @@ -1,14 +1,11 @@ package envoy.client.net; import java.util.function.Consumer; -import java.util.logging.Level; -import java.util.logging.Logger; import envoy.client.event.MessageCreationEvent; import envoy.data.Message; import envoy.data.Message.MessageStatus; import envoy.event.EventBus; -import envoy.util.EnvoyLog; /** * Project: envoy-client
@@ -20,17 +17,12 @@ import envoy.util.EnvoyLog; */ public class ReceivedMessageProcessor implements Consumer { - private static final Logger logger = EnvoyLog.getLogger(ReceivedMessageProcessor.class); - @Override public void accept(Message message) { - if (message.getStatus() != MessageStatus.SENT) logger.log(Level.WARNING, "The message has the unexpected status " + message.getStatus()); - else { - // Update status to RECEIVED - message.nextStatus(); + // Update status to RECEIVED + if (message.getStatus() == MessageStatus.SENT) message.nextStatus(); - // Dispatch event - EventBus.getInstance().dispatch(new MessageCreationEvent(message)); - } + // Dispatch event + EventBus.getInstance().dispatch(new MessageCreationEvent(message)); } } diff --git a/client/src/main/java/envoy/client/ui/controller/ChatScene.java b/client/src/main/java/envoy/client/ui/controller/ChatScene.java index c8c9062..ef4e38f 100644 --- a/client/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/client/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -1,5 +1,7 @@ package envoy.client.ui.controller; +import static envoy.data.Message.MessageStatus.RECEIVED; + import java.awt.Toolkit; import java.awt.datatransfer.StringSelection; import java.io.ByteArrayInputStream; @@ -145,7 +147,7 @@ public final class ChatScene implements Restorable { logger.log(Level.WARNING, "Could not read current chat: ", e1); } Platform.runLater(() -> { messageList.refresh(); scrollToMessageListEnd(); }); - } else chat.incrementUnreadAmount(); + } else if (message.getRecipientID() == chat.getRecipient().getID() && message.getStatus() == RECEIVED) chat.incrementUnreadAmount(); // Moving chat with most recent unreadMessages to the top Platform.runLater(() -> { chatList.getItems().remove(chat); diff --git a/server/src/main/java/envoy/server/processors/LoginCredentialProcessor.java b/server/src/main/java/envoy/server/processors/LoginCredentialProcessor.java index f7ee34e..391dab0 100755 --- a/server/src/main/java/envoy/server/processors/LoginCredentialProcessor.java +++ b/server/src/main/java/envoy/server/processors/LoginCredentialProcessor.java @@ -110,10 +110,6 @@ public final class LoginCredentialProcessor implements ObjectProcessor