From 04cceabc3d46da6b55734b4820c206b59349123d Mon Sep 17 00:00:00 2001 From: delvh Date: Sun, 4 Oct 2020 09:23:42 +0200 Subject: [PATCH] Fixed bug showing incorrect user statuses --- client/src/main/java/envoy/client/data/Chat.java | 2 +- client/src/main/java/envoy/client/data/LocalDB.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/main/java/envoy/client/data/Chat.java b/client/src/main/java/envoy/client/data/Chat.java index beabf9c..80b2a97 100644 --- a/client/src/main/java/envoy/client/data/Chat.java +++ b/client/src/main/java/envoy/client/data/Chat.java @@ -135,7 +135,7 @@ public class Chat implements Serializable { * * @since Envoy Client v0.1-beta */ - public void incrementUnreadAmount() { unreadAmount++; } + public void incrementUnreadAmount() { ++unreadAmount; } /** * @return the amount of unread messages in this chat diff --git a/client/src/main/java/envoy/client/data/LocalDB.java b/client/src/main/java/envoy/client/data/LocalDB.java index 51fb2cc..7ab7a98 100644 --- a/client/src/main/java/envoy/client/data/LocalDB.java +++ b/client/src/main/java/envoy/client/data/LocalDB.java @@ -155,8 +155,9 @@ public final class LocalDB implements EventListener { users.put(user.getName(), user); // Synchronize user status data - for (final var contact : users.values()) - if (contact instanceof User) getChat(contact.getID()).ifPresent(chat -> { ((User) chat.getRecipient()).setStatus(contact.getStatus()); }); + for (final var contact : user.getContacts()) + if (contact instanceof User) + getChat(contact.getID()).ifPresent(chat -> { ((User) chat.getRecipient()).setStatus(((User) contact).getStatus()); }); // Create missing chats user.getContacts() -- 2.45.2