From e69ced4081e359243c82171427d7f1a50dc20e2a Mon Sep 17 00:00:00 2001 From: schrom01 Date: Wed, 13 Apr 2022 17:24:22 +0200 Subject: [PATCH 1/2] fixed Problem "private Messages are visible for sender" #28 --- .../ch/zhaw/pm2/multichat/server/ServerConnectionHandler.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/main/java/ch/zhaw/pm2/multichat/server/ServerConnectionHandler.java b/server/src/main/java/ch/zhaw/pm2/multichat/server/ServerConnectionHandler.java index 7dd9c82..5615590 100644 --- a/server/src/main/java/ch/zhaw/pm2/multichat/server/ServerConnectionHandler.java +++ b/server/src/main/java/ch/zhaw/pm2/multichat/server/ServerConnectionHandler.java @@ -149,6 +149,9 @@ public class ServerConnectionHandler implements Runnable{ ServerConnectionHandler handler = connectionRegistry.get(reciever); if (handler != null) { handler.sendData(sender, reciever, type, payload); + if(!reciever.equals(sender)){ + sendData(sender, reciever, type, payload); + } } else { this.sendData(USER_NONE, userName, DATA_TYPE_ERROR, "Unknown User: " + reciever); } From b9ffb2b13323e6c99254e0deff73982b90074982 Mon Sep 17 00:00:00 2001 From: Roman Schenk Date: Wed, 13 Apr 2022 17:35:07 +0200 Subject: [PATCH 2/2] Update ServerConnectionHandler.java added Commment for documentation. --- .../ch/zhaw/pm2/multichat/server/ServerConnectionHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/ch/zhaw/pm2/multichat/server/ServerConnectionHandler.java b/server/src/main/java/ch/zhaw/pm2/multichat/server/ServerConnectionHandler.java index 5615590..26ff699 100644 --- a/server/src/main/java/ch/zhaw/pm2/multichat/server/ServerConnectionHandler.java +++ b/server/src/main/java/ch/zhaw/pm2/multichat/server/ServerConnectionHandler.java @@ -150,7 +150,7 @@ public class ServerConnectionHandler implements Runnable{ if (handler != null) { handler.sendData(sender, reciever, type, payload); if(!reciever.equals(sender)){ - sendData(sender, reciever, type, payload); + sendData(sender, reciever, type, payload); //send message to sender if it's a direct message and sender is not receiver. } } else { this.sendData(USER_NONE, userName, DATA_TYPE_ERROR, "Unknown User: " + reciever);