Fixed issue regarding the sender of a message not getting an MSCEvent

Added messageStatusChangeEvent sending to online sender if recipient
logs in and sender is online at the same time
This commit is contained in:
DieGurke 2020-06-10 23:23:35 +02:00 committed by kske
parent 4bf1fbbc59
commit 05822cf13d

View File

@ -62,6 +62,11 @@ public class LoginCredentialProcessor implements ObjectProcessor<LoginCredential
writeProxy.write(socketID, msg.toCommon()); writeProxy.write(socketID, msg.toCommon());
msg.setReceivedDate(new Date()); msg.setReceivedDate(new Date());
msg.setStatus(MessageStatus.RECEIVED); msg.setStatus(MessageStatus.RECEIVED);
if (connectionManager.isOnline(msg.getSender().getID())) {
var evt = new MessageStatusChangeEvent(msg.toCommon());
System.out.println("Sending messageStatusChangeEvent to sender " + evt);
writeProxy.write(connectionManager.getSocketId(msg.getSender().getID()), evt);
}
PersistenceManager.getInstance().updateMessage(msg); PersistenceManager.getInstance().updateMessage(msg);
} else { } else {
var evt = new MessageStatusChangeEvent(msg.toCommon()); var evt = new MessageStatusChangeEvent(msg.toCommon());