Fixed reading messages

Fixes #23
This commit is contained in:
DieGurke
2019-11-09 14:06:09 +01:00
parent 42f3a97e8a
commit cd8a92c619
3 changed files with 57 additions and 80 deletions

View File

@ -205,6 +205,9 @@ public class ChatWindow extends JFrame {
.findFirst()
.get();
// Set all unread messages in the chat to read
if (currentChat != null) { localDB.setMessagesToRead(currentChat); }
client.setRecipient(user);
textPane.setText(currentChat.getRecipient().getName());
@ -265,8 +268,6 @@ public class ChatWindow extends JFrame {
*/
private void startSyncThread(int timeout) {
new Timer(timeout, (evt) -> {
if (currentChat != null) { localDB.setMessagesToRead(currentChat); }
new Thread(() -> {
// Synchronize