Merge branch 'f/user_status_change_event' of https://github.com/informatik-ag-ngl/envoy-server-standalone.git into f/user_status_change_event
This commit is contained in:
		| @@ -4,6 +4,7 @@ import java.io.IOException; | ||||
| import java.util.Date; | ||||
|  | ||||
| import envoy.data.Message; | ||||
| import envoy.event.MessageStatusChangeEvent; | ||||
| import envoy.server.ConnectionManager; | ||||
| import envoy.server.ObjectProcessor; | ||||
| import envoy.server.database.PersistenceManager; | ||||
| @@ -36,6 +37,7 @@ public class MessageProcessor implements ObjectProcessor<Message> { | ||||
| 			// Update the message status to RECEIVED | ||||
| 			message.setReceivedDate(new Date()); | ||||
| 			message.nextStatus(); | ||||
| 			writeProxy.write(connectionManager.getSocketId(message.getSenderId()), new MessageStatusChangeEvent(message)); | ||||
| 		} catch (IOException e) { | ||||
| 			System.err.println("Recipient online. Failed to send message" + message.getId()); | ||||
| 			e.printStackTrace(); | ||||
|   | ||||
| @@ -29,8 +29,7 @@ public class MessageStatusChangeProcessor implements ObjectProcessor<MessageStat | ||||
| 			// any other status than read is not supposed to be sent to the server | ||||
| 			if (input.get() != MessageStatus.READ) throw new EnvoyException("Message" + input.getId() + "has an invalid status"); | ||||
| 		} catch (EnvoyException e) { | ||||
| 			e.printStackTrace(); | ||||
| 			return; | ||||
| 			throw new IOException(e); | ||||
| 		} | ||||
| 		ConnectionManager	conMan	= ConnectionManager.getInstance(); | ||||
| 		PersistenceManager	perMan	= PersistenceManager.getPersistenceManager(); | ||||
| @@ -40,6 +39,7 @@ public class MessageStatusChangeProcessor implements ObjectProcessor<MessageStat | ||||
| 		msg.setReadDate(input.getDate()); | ||||
| 		perMan.updateMessage(msg); | ||||
|  | ||||
| 		if (conMan.isOnline(msg.getRecipient().getId())) writeProxy.write(conMan.getSocketId(msg.getRecipient().getId()), input); | ||||
| 		// Notifies the sender of the message about the status-update to READ | ||||
| 		if (conMan.isOnline(msg.getSender().getId())) writeProxy.write(conMan.getSocketId(msg.getSender().getId()), input); | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 delvh
					delvh