添加配置,是否允许群主和群管理员不受限制撤回自己的发言
This commit is contained in:
@@ -169,6 +169,12 @@ chatroom.rejoin_when_active true
|
|||||||
## 当一个聊天室不存在时,如果有用户加入就自动创建
|
## 当一个聊天室不存在时,如果有用户加入就自动创建
|
||||||
chatroom.create_when_not_exist true
|
chatroom.create_when_not_exist true
|
||||||
|
|
||||||
|
## 是否允许群主不受限制地撤回自己发送的消息。false可以${message.recall_time_limit}撤回自己的消息;true可以撤回任意时间自己的消息。默认为true。
|
||||||
|
group.allow_owner_recall_self_msg true
|
||||||
|
|
||||||
|
## 是否允许群管理员不受限制地撤回自己发送的消息。false可以${message.recall_time_limit}撤回自己的消息;true可以撤回任意时间自己的消息。默认为false。
|
||||||
|
group.allow_manager_recall_self_msg false
|
||||||
|
|
||||||
## 是否允许客户端发送操作群的自定义群通知消息
|
## 是否允许客户端发送操作群的自定义群通知消息
|
||||||
group.allow_client_custom_operation_notification true
|
group.allow_client_custom_operation_notification true
|
||||||
|
|
||||||
|
|||||||
@@ -173,6 +173,8 @@ public final class BrokerConstants {
|
|||||||
public static final String CHATROOM_Create_When_Not_Exist = "chatroom.create_when_not_exist";
|
public static final String CHATROOM_Create_When_Not_Exist = "chatroom.create_when_not_exist";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String GROUP_Allow_Owner_Recall_Self_Msg = "group.allow_owner_recall_self_msg";
|
||||||
|
public static final String GROUP_Allow_Manager_Recall_Self_Msg = "group.allow_manager_recall_self_msg";
|
||||||
public static final String GROUP_Allow_Client_Custom_Operation_Notification = "group.allow_client_custom_operation_notification";
|
public static final String GROUP_Allow_Client_Custom_Operation_Notification = "group.allow_client_custom_operation_notification";
|
||||||
public static final String GROUP_Allow_Robot_Custom_Operation_Notification = "group.allow_robot_custom_operation_notificatio";
|
public static final String GROUP_Allow_Robot_Custom_Operation_Notification = "group.allow_robot_custom_operation_notificatio";
|
||||||
|
|
||||||
|
|||||||
@@ -180,6 +180,8 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
private String mChannelInfoUpdateCallback;
|
private String mChannelInfoUpdateCallback;
|
||||||
private String mChatroomInfoUpdateCallback;
|
private String mChatroomInfoUpdateCallback;
|
||||||
private String mChatroomMemberUpdateCallback;
|
private String mChatroomMemberUpdateCallback;
|
||||||
|
private boolean mGroupAllowOwnerRecallSelfMsg = false;
|
||||||
|
private boolean mGroupAllowManagerRecallSelfMsg = false;
|
||||||
private boolean mGroupAllowClientCustomOperationNotification;
|
private boolean mGroupAllowClientCustomOperationNotification;
|
||||||
private boolean mGroupAllowRobotCustomOperationNotification;
|
private boolean mGroupAllowRobotCustomOperationNotification;
|
||||||
private int mGroupVisibleQuitKickoffNotification;
|
private int mGroupVisibleQuitKickoffNotification;
|
||||||
@@ -468,6 +470,17 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mGroupAllowOwnerRecallSelfMsg = Boolean.parseBoolean(server.getConfig().getProperty(GROUP_Allow_Owner_Recall_Self_Msg, "true"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
mGroupAllowManagerRecallSelfMsg = Boolean.parseBoolean(server.getConfig().getProperty(GROUP_Allow_Manager_Recall_Self_Msg, "false"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mGroupAllowClientCustomOperationNotification = Boolean.parseBoolean(server.getConfig().getProperty(GROUP_Allow_Client_Custom_Operation_Notification));
|
mGroupAllowClientCustomOperationNotification = Boolean.parseBoolean(server.getConfig().getProperty(GROUP_Allow_Client_Custom_Operation_Notification));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -2232,7 +2245,28 @@ public class MemoryMessagesStore implements IMessagesStore {
|
|||||||
return ErrorCode.ERROR_CODE_RECALL_TIME_EXPIRED;
|
return ErrorCode.ERROR_CODE_RECALL_TIME_EXPIRED;
|
||||||
}
|
}
|
||||||
if (operatorId.equals(groupInfo.getOwner())) {
|
if (operatorId.equals(groupInfo.getOwner())) {
|
||||||
canRecall = true;
|
if(operatorId.equals(message.getFromUser())) {
|
||||||
|
if(mGroupAllowOwnerRecallSelfMsg) {
|
||||||
|
canRecall = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
canRecall = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(message.getFromUser().equals(operatorId) && mGroupAllowManagerRecallSelfMsg) {
|
||||||
|
MultiMap<String, WFCMessage.GroupMember> groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS);
|
||||||
|
Collection<WFCMessage.GroupMember> members = groupMembers.get(message.getConversation().getTarget());
|
||||||
|
if (members == null || members.size() == 0) {
|
||||||
|
members = loadGroupMemberFromDB(hzInstance, message.getConversation().getTarget());
|
||||||
|
}
|
||||||
|
for (WFCMessage.GroupMember member : members) {
|
||||||
|
if (member.getMemberId().equals(operatorId)) {
|
||||||
|
if (member.getType() == GroupMemberType_Manager || member.getType() == ProtoConstants.GroupMemberType.GroupMemberType_Owner) {
|
||||||
|
canRecall = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canRecall && !message.getFromUser().equals(operatorId)) {
|
if(!canRecall && !message.getFromUser().equals(operatorId)) {
|
||||||
|
|||||||
@@ -167,6 +167,12 @@ chatroom.rejoin_when_active true
|
|||||||
## 当一个聊天室不存在时,如果有用户加入就自动创建
|
## 当一个聊天室不存在时,如果有用户加入就自动创建
|
||||||
chatroom.create_when_not_exist true
|
chatroom.create_when_not_exist true
|
||||||
|
|
||||||
|
## 是否允许群主不受限制地撤回自己发送的消息。false可以${message.recall_time_limit}撤回自己的消息;true可以撤回任意时间自己的消息。默认为true。
|
||||||
|
group.allow_owner_recall_self_msg true
|
||||||
|
|
||||||
|
## 是否允许群管理员不受限制地撤回自己发送的消息。false可以${message.recall_time_limit}撤回自己的消息;true可以撤回任意时间自己的消息。默认为false。
|
||||||
|
group.allow_manager_recall_self_msg false
|
||||||
|
|
||||||
## 是否允许客户端发送操作群的自定义群通知消息
|
## 是否允许客户端发送操作群的自定义群通知消息
|
||||||
group.allow_client_custom_operation_notification true
|
group.allow_client_custom_operation_notification true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user