添加默认敏感词
This commit is contained in:
@@ -111,7 +111,7 @@ mongodb.data_expire_days 1096
|
|||||||
#*********************************************************************
|
#*********************************************************************
|
||||||
# Sensitive configuration
|
# Sensitive configuration
|
||||||
#*********************************************************************
|
#*********************************************************************
|
||||||
##文本敏感词过滤处理方法,0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成***
|
##文本敏感词过滤处理方法,0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成***;3 记录并继续发送
|
||||||
sensitive.filter.type 0
|
sensitive.filter.type 0
|
||||||
|
|
||||||
#*********************************************************************
|
#*********************************************************************
|
||||||
|
|||||||
+4038
File diff suppressed because it is too large
Load Diff
@@ -95,13 +95,15 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
|||||||
errorCode = ErrorCode.ERROR_CODE_SENSITIVE_MATCHED;
|
errorCode = ErrorCode.ERROR_CODE_SENSITIVE_MATCHED;
|
||||||
} else if(mSensitiveType == 1) {
|
} else if(mSensitiveType == 1) {
|
||||||
ignoreMsg = true;
|
ignoreMsg = true;
|
||||||
} else {
|
} else if(mSensitiveType == 2) {
|
||||||
String text = message.getContent().getSearchableContent();
|
String text = message.getContent().getSearchableContent();
|
||||||
for (String word : matched) {
|
for (String word : matched) {
|
||||||
text = text.replace(word, "***");
|
text = text.replace(word, "***");
|
||||||
}
|
}
|
||||||
|
|
||||||
message = message.toBuilder().setContent(message.getContent().toBuilder().setSearchableContent(text).build()).build();
|
message = message.toBuilder().setContent(message.getContent().toBuilder().setSearchableContent(text).build()).build();
|
||||||
|
} else if(mSensitiveType == 3) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user