禁止发送消息给被封禁用户

This commit is contained in:
imhao183
2019-12-26 21:18:34 +08:00
parent 91b209d0fa
commit 11375133ba
4 changed files with 15 additions and 3 deletions
@@ -52,7 +52,7 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
return ErrorCode.INVALID_PARAMETER;
}
int userStatus = m_messagesStore.getUserStatus(fromUser);
if (userStatus == 1 || userStatus == 2) {
if (userStatus == ProtoConstants.UserStatus.Muted || userStatus == ProtoConstants.UserStatus.Forbidden) {
return ErrorCode.ERROR_CODE_FORBIDDEN_SEND_MSG;
}
@@ -61,6 +61,11 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) {
return errorCode;
}
userStatus = m_messagesStore.getUserStatus(message.getConversation().getTarget());
if (userStatus == ProtoConstants.UserStatus.Forbidden) {
return ErrorCode.ERROR_CODE_USER_FORBIDDEN;
}
}
if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Group ) {