Fixed Problem "Empty Messages can be sent" if receiver != *

This commit is contained in:
schrom01 2022-04-12 14:26:26 +02:00
parent 56200b749d
commit 1a188f6bbd
1 changed files with 4 additions and 1 deletions

View File

@ -202,9 +202,12 @@ public class ClientConnectionHandler implements Runnable {
if (state != CONNECTED) throw new ChatProtocolException("Illegal state for message: " + state);
Matcher matcher = messagePattern.matcher(messageString);
if (messageString != "" && matcher.find()) {
if (matcher.find()) {
String receiver = matcher.group(1);
String message = matcher.group(2);
if(message.length() < 1){
return false;
}
if (receiver == null || receiver.isBlank()) receiver = ClientConnectionHandler.USER_ALL;
this.sendData(userName, receiver, DATA_TYPE_MESSAGE,message);
return true;