Fixed invalid MessageStatusChangeEvent sending
The sender got a messageStatusChangeEvent even if the status was still sent from the server and couldn't process it. The server does not send this unnecessary event even more
This commit is contained in:
parent
47e03dc4f4
commit
693ef0875d
@ -6,6 +6,7 @@ import java.util.Date;
|
|||||||
import javax.persistence.EntityExistsException;
|
import javax.persistence.EntityExistsException;
|
||||||
|
|
||||||
import envoy.data.Message;
|
import envoy.data.Message;
|
||||||
|
import envoy.data.Message.MessageStatus;
|
||||||
import envoy.event.MessageStatusChangeEvent;
|
import envoy.event.MessageStatusChangeEvent;
|
||||||
import envoy.server.data.PersistenceManager;
|
import envoy.server.data.PersistenceManager;
|
||||||
import envoy.server.net.ConnectionManager;
|
import envoy.server.net.ConnectionManager;
|
||||||
@ -30,12 +31,14 @@ public class MessageProcessor implements ObjectProcessor<Message> {
|
|||||||
ConnectionManager connectionManager = ConnectionManager.getInstance();
|
ConnectionManager connectionManager = ConnectionManager.getInstance();
|
||||||
|
|
||||||
sendToUser(connectionManager, message, writeProxy);
|
sendToUser(connectionManager, message, writeProxy);
|
||||||
// Sending a messageStatusChangeEvent to the sender
|
if (message.getStatus() != MessageStatus.SENT) {
|
||||||
try {
|
// Sending a messageStatusChangeEvent to the sender
|
||||||
writeProxy.write(socketID, new MessageStatusChangeEvent(message));
|
try {
|
||||||
} catch (IOException e) {
|
writeProxy.write(socketID, new MessageStatusChangeEvent(message));
|
||||||
System.err.println("Could not send messageStatusChangeEvent to the sender of this message with ID: " + message.getID());
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.err.println("Could not send messageStatusChangeEvent to the sender of this message with ID: " + message.getID());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
PersistenceManager.getInstance().addMessage(new envoy.server.data.Message(message));
|
PersistenceManager.getInstance().addMessage(new envoy.server.data.Message(message));
|
||||||
|
Reference in New Issue
Block a user