聊天不校验特殊字符
parent
99d2828a6c
commit
5b389f9b09
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.chat.logic;
|
|||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.chat.messge.MessageCache;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
|
|
@ -88,7 +89,7 @@ public class ChatLogic {
|
|||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
FriendManager friendManager = user.getFriendManager();
|
||||
boolean result = ShieldedWordUtils.checkName(message);
|
||||
boolean result = ShieldedWordUtils.checkName(message,false);
|
||||
if (!result) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "包含敏感字");
|
||||
return ;
|
||||
|
|
|
|||
|
|
@ -92,9 +92,9 @@ public class KtEventUtils {
|
|||
|
||||
}
|
||||
|
||||
/* KTParam ktParam = ParamBuilder.paramBuild(user, eventType, paramEventBean);
|
||||
KTParam ktParam = ParamBuilder.paramBuild(user, eventType, paramEventBean);
|
||||
DataMessageUtils.addLogQueue(ktParam);
|
||||
LOGGER.info("ktparm -- > {}",gson.toJson(ktParam));*/
|
||||
LOGGER.info("ktparm -- > {}",gson.toJson(ktParam));
|
||||
}
|
||||
public static ParamEnvironmentBean enviromentBuild(int uid){
|
||||
return KTEnvironmentUtil.getUserEnviromentInfoById(uid);
|
||||
|
|
|
|||
|
|
@ -454,7 +454,7 @@ public class FriendLogic {
|
|||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
FriendManager friendManager = user.getFriendManager();
|
||||
List<Integer> friends = friendManager.getFriends();
|
||||
boolean result = ShieldedWordUtils.checkName( name);
|
||||
boolean result = ShieldedWordUtils.checkName( name,true);
|
||||
if (!result) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "名字不合法");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public class PlayerLogic {
|
|||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "");
|
||||
return true;
|
||||
}
|
||||
boolean result = ShieldedWordUtils.checkName( name);
|
||||
boolean result = ShieldedWordUtils.checkName( name,true);
|
||||
if (!result) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "");
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -5,11 +5,15 @@ import java.util.regex.Pattern;
|
|||
|
||||
public class ShieldedWordUtils {
|
||||
|
||||
public static boolean checkName(String name){
|
||||
boolean result = validateUserName(name);
|
||||
if(!result){
|
||||
return false;
|
||||
public static boolean checkName(String name,boolean validateSpecStr){
|
||||
boolean result = true;
|
||||
if(validateSpecStr){
|
||||
result = validateUserName(name);
|
||||
if(!result){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
result = isContaintSensitiveWord(name);
|
||||
if(result){
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue