Fix double status increment on cached message relay

This commit is contained in:
Kai S. K. Engelbart 2020-06-26 09:28:48 +02:00
parent 35f4ca2a1a
commit 66eddab143
3 changed files with 6 additions and 5 deletions

View File

@ -10,8 +10,8 @@ import java.util.logging.Logger;
import envoy.util.EnvoyLog; import envoy.util.EnvoyLog;
/** /**
* Stores elements in a queue to process them later.<br> * Stores elements in a queue to process them later.
* <br> * <p>
* Project: <strong>envoy-client</strong><br> * Project: <strong>envoy-client</strong><br>
* File: <strong>Cache.java</strong><br> * File: <strong>Cache.java</strong><br>
* Created: <strong>6 Feb 2020</strong><br> * Created: <strong>6 Feb 2020</strong><br>
@ -40,6 +40,9 @@ public class Cache<T> implements Consumer<T>, Serializable {
elements.offer(element); elements.offer(element);
} }
@Override
public String toString() { return String.format("Cache[elements=" + elements + "]"); }
/** /**
* Sets the processor to which cached elements are relayed. * Sets the processor to which cached elements are relayed.
* *

View File

@ -47,9 +47,6 @@ public class WriteProxy {
try { try {
logger.log(Level.FINER, "Sending cached " + msg); logger.log(Level.FINER, "Sending cached " + msg);
client.sendMessage(msg); client.sendMessage(msg);
// Update message state to SENT in localDB
localDB.getMessage(msg.getID()).ifPresent(Message::nextStatus);
} catch (final IOException e) { } catch (final IOException e) {
logger.log(Level.SEVERE, "Could not send cached message: ", e); logger.log(Level.SEVERE, "Could not send cached message: ", e);
} }

View File

@ -164,6 +164,7 @@ public final class ChatScene {
private void userListClicked() { private void userListClicked() {
final Contact user = userList.getSelectionModel().getSelectedItem(); final Contact user = userList.getSelectionModel().getSelectedItem();
if (user != null && (currentChat == null || !user.equals(currentChat.getRecipient()))) { if (user != null && (currentChat == null || !user.equals(currentChat.getRecipient()))) {
logger.log(Level.FINEST, "Loading chat with " + user);
contactLabel.setText(user.getName()); contactLabel.setText(user.getName());
// LEON: JFC <===> JAVA FRIED CHICKEN <=/=> Java Foundation Classes // LEON: JFC <===> JAVA FRIED CHICKEN <=/=> Java Foundation Classes