Propagating message received update to sender
This commit is contained in:
		| @@ -4,6 +4,7 @@ import java.io.IOException; | |||||||
| import java.util.Date; | import java.util.Date; | ||||||
|  |  | ||||||
| import envoy.data.Message; | import envoy.data.Message; | ||||||
|  | import envoy.event.MessageStatusChangeEvent; | ||||||
| import envoy.server.ConnectionManager; | import envoy.server.ConnectionManager; | ||||||
| import envoy.server.ObjectProcessor; | import envoy.server.ObjectProcessor; | ||||||
| import envoy.server.database.PersistenceManager; | import envoy.server.database.PersistenceManager; | ||||||
| @@ -36,6 +37,7 @@ public class MessageProcessor implements ObjectProcessor<Message> { | |||||||
| 			// Update the message status to RECEIVED | 			// Update the message status to RECEIVED | ||||||
| 			message.setReceivedDate(new Date()); | 			message.setReceivedDate(new Date()); | ||||||
| 			message.nextStatus(); | 			message.nextStatus(); | ||||||
|  | 			writeProxy.write(connectionManager.getSocketId(message.getSenderId()), new MessageStatusChangeEvent(message)); | ||||||
| 		} catch (IOException e) { | 		} catch (IOException e) { | ||||||
| 			System.err.println("Recipient online. Failed to send message" + message.getId()); | 			System.err.println("Recipient online. Failed to send message" + message.getId()); | ||||||
| 			e.printStackTrace(); | 			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 | 			// 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"); | 			if (input.get() != MessageStatus.READ) throw new EnvoyException("Message" + input.getId() + "has an invalid status"); | ||||||
| 		} catch (EnvoyException e) { | 		} catch (EnvoyException e) { | ||||||
| 			e.printStackTrace(); | 			throw new IOException(e); | ||||||
| 			return; |  | ||||||
| 		} | 		} | ||||||
| 		ConnectionManager	conMan	= ConnectionManager.getInstance(); | 		ConnectionManager	conMan	= ConnectionManager.getInstance(); | ||||||
| 		PersistenceManager	perMan	= PersistenceManager.getPersistenceManager(); | 		PersistenceManager	perMan	= PersistenceManager.getPersistenceManager(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user