diff --git a/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java index 92e38dc22..f228f1347 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java @@ -99,14 +99,23 @@ public class ChatLogic { return; } FriendManager friendManager = user.getFriendManager(); - boolean result = true; - long nowTime = System.currentTimeMillis(); + long nowTime = System.currentTimeMillis(); + String tmp = SensitivewordFilter.replaceSensitiveWord(message, 1, "*"); + + + if(!tmp.equals(message)){ + ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,tmp,nowTime,-1); + ChatProto.SendChatInfoResponse response = ChatProto.SendChatInfoResponse.newBuilder().setChatInfo(chatInfo).build(); + MessageUtil.sendMessage(iSession,1,msgId,response,true); + return; + } + boolean result = true; switch (chatType){ case 1: //0|content需要解字符串 String s = message; - String[] strs = message.split("\\|",3); + String[] strs = message.split("|",3); if(strs.length==3){ message = strs[2]; } @@ -121,13 +130,11 @@ public class ChatLogic { default: break; } - if (!result) { - String s = SensitivewordFilter.replaceSensitiveWord(message, 1, "*"); -// MessageUtil.sendErrorResponse(iSession, 0, msgId, "包含敏感字"); - ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,s,nowTime,-1); + if(!result){ + ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,tmp,nowTime,-1); ChatProto.SendChatInfoResponse response = ChatProto.SendChatInfoResponse.newBuilder().setChatInfo(chatInfo).build(); MessageUtil.sendMessage(iSession,1,msgId,response,true); - return ; + return; } switch (chatType){