添加开关
1,是否不转发管理员消息 2,客户端是否支持kickoff事件
This commit is contained in:
@@ -100,6 +100,11 @@ message.group_mute_exception_types 401,402,403,404,405,407,408,410,411
|
||||
## 用户被全局禁言时允许发送的消息类型
|
||||
message.global_mute_exception_types 401,402,403,404,405,407,408,410,411
|
||||
|
||||
## 消息转发功能开启时,开关是否不转发server api接口消息。
|
||||
## 当为true时,不转发server api发送的消息;当为false时,转发server api发送的消息。
|
||||
message.no_forward_admin_message false
|
||||
|
||||
|
||||
##禁止搜索用户
|
||||
friend.disable_search false
|
||||
|
||||
@@ -215,6 +220,10 @@ server.multi_platform_notification true
|
||||
# 如果这里改为false,客户端那边需要同步修改pc在线默认通知状态,方法是client的setDefaultSilentWhenPcOnline函数。
|
||||
server.mobile_default_silent_when_pc_online true
|
||||
|
||||
## 客户端是否支持kickoff事件。当客户端被其他端登录踢出时,如果此开关为false时,客户端协议栈上报secret_mismatch。如果此开关为ture时,客户端协议栈上报kicked_off。
|
||||
## 客户端被踢时上报kicked_off是在2021.9.15之后才加上的。如果客户端协议栈全部为此日期之后的版本才可以打开此开关。
|
||||
server.client_support_kickoff_event false
|
||||
|
||||
#*********************************************************************
|
||||
# Push server configuration
|
||||
#*********************************************************************
|
||||
|
||||
@@ -132,6 +132,7 @@ public final class BrokerConstants {
|
||||
public static final String SERVER_MULTI_ENDPOINT = "server.multi_endpoint";
|
||||
public static final String SERVER_MULTI_PLATFROM_NOTIFICATION = "server.multi_platform_notification";
|
||||
public static final String SERVER_MOBILE_DEFAULT_SILENT_WHEN_PC_ONLINE = "server.mobile_default_silent_when_pc_online";
|
||||
public static final String SERVER_CLIENT_SUPPORT_KICKOFF_EVENT = "server.client_support_kickoff_event";
|
||||
|
||||
public static final String MESSAGE_ROAMING = "message.roaming";
|
||||
public static final String MESSAGE_Remote_History_Message = "message.remote_history_message";
|
||||
@@ -142,6 +143,8 @@ public final class BrokerConstants {
|
||||
|
||||
public static final String MESSAGE_Blacklist_Strategy = "message.blacklist.strategy";
|
||||
|
||||
public static final String MESSAGE_NO_Forward_Admin_Message = "message.no_forward_admin_message";
|
||||
|
||||
public static final String FRIEND_Disable_Search = "friend.disable_search";
|
||||
public static final String FRIEND_Disable_NickName_Search = "friend.disable_nick_name_search";
|
||||
public static final String FRIEND_Disable_Friend_Request = "friend.disable_friend_request";
|
||||
|
||||
@@ -34,6 +34,7 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
||||
private String mForwardUrl = null;
|
||||
private Set<Integer> mForwardMessageTypes = new HashSet<>();
|
||||
private int mBlacklistStrategy = 0; //黑名单中时,0失败,1吞掉。
|
||||
private boolean mNoForwardAdminMessage = false;
|
||||
|
||||
private String mRemoteSensitiveServerUrl = null;
|
||||
private Set<Integer> mRemoteSensitiveMessageTypes;
|
||||
@@ -86,6 +87,13 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
||||
Utility.printExecption(LOG, e);
|
||||
}
|
||||
|
||||
try {
|
||||
mNoForwardAdminMessage = Boolean.parseBoolean(mServer.getConfig().getProperty(BrokerConstants.MESSAGE_NO_Forward_Admin_Message, "false"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Utility.printExecption(LOG, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -161,7 +169,7 @@ public class SendMessageHandler extends IMHandler<WFCMessage.Message> {
|
||||
}
|
||||
message = message.toBuilder().setFromUser(fromUser).setMessageId(messageId).setServerTimestamp(timestamp).build();
|
||||
|
||||
if (mForwardUrl != null && (mForwardMessageTypes.isEmpty() || mForwardMessageTypes.contains(message.getContent().getType()))) {
|
||||
if (mForwardUrl != null && (mForwardMessageTypes.isEmpty() || mForwardMessageTypes.contains(message.getContent().getType())) && !(isAdmin && mNoForwardAdminMessage)) {
|
||||
publisher.forwardMessage(message, mForwardUrl);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public class MemorySessionStore implements ISessionsStore {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MemorySessionStore.class);
|
||||
|
||||
private boolean supportMultiEndpoint = false;
|
||||
private boolean clientSupportKickoff = false;
|
||||
|
||||
public static class Session implements Comparable<Session>{
|
||||
final String clientID;
|
||||
@@ -280,7 +281,14 @@ public class MemorySessionStore implements ISessionsStore {
|
||||
this.databaseStore = databaseStore;
|
||||
|
||||
try {
|
||||
supportMultiEndpoint = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.SERVER_MULTI_ENDPOINT));
|
||||
supportMultiEndpoint = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.SERVER_MULTI_ENDPOINT, "false"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Utility.printExecption(LOG, e);
|
||||
}
|
||||
|
||||
try {
|
||||
clientSupportKickoff = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.SERVER_CLIENT_SUPPORT_KICKOFF_EVENT, "false"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Utility.printExecption(LOG, e);
|
||||
@@ -456,20 +464,32 @@ public class MemorySessionStore implements ISessionsStore {
|
||||
|
||||
if (session != null && session.getDeleted() == 0) {
|
||||
LOG.error("already exists a session for client <{}>, bad condition", clientID);
|
||||
throw new IllegalArgumentException("Can't create a session with the ID of an already existing" + clientID);
|
||||
return ErrorCode.ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
if (session != null && session.getDeleted() > 0) {
|
||||
return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH;
|
||||
if(clientSupportKickoff) {
|
||||
return ErrorCode.ERROR_CODE_KICKED_OFF;
|
||||
} else {
|
||||
return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
ClientSession clientSession = new ClientSession(clientID, this);
|
||||
session = databaseStore.getSession(username, clientID, clientSession);
|
||||
|
||||
if (session == null || session.getDeleted() > 0) {
|
||||
if (session == null) {
|
||||
return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH;
|
||||
}
|
||||
|
||||
if(session.getDeleted() > 0) {
|
||||
if(clientSupportKickoff) {
|
||||
return ErrorCode.ERROR_CODE_KICKED_OFF;
|
||||
} else {
|
||||
return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH;
|
||||
}
|
||||
}
|
||||
|
||||
sessions.put(clientID, session);
|
||||
ConcurrentSkipListSet<String> sessionSet = getUserSessionSet(username);
|
||||
sessionSet.add(clientID);
|
||||
|
||||
@@ -94,6 +94,12 @@ message.blacklist_exception_types 401,402,403,404,405,407,408,410,411
|
||||
message.group_mute_exception_types 401,402,403,404,405,407,408,410,411
|
||||
## 用户被全局禁言时允许发送的消息类型
|
||||
message.global_mute_exception_types 401,402,403,404,405,407,408,410,411
|
||||
|
||||
## 消息转发功能开启时,开关是否不转发server api接口消息。
|
||||
## 当为true时,不转发server api发送的消息;当为false时,转发server api发送的消息。
|
||||
message.no_forward_admin_message false
|
||||
|
||||
|
||||
##禁止搜索用户
|
||||
friend.disable_search false
|
||||
|
||||
@@ -212,6 +218,10 @@ server.multi_platform_notification true
|
||||
# 如果这里改为false,客户端那边需要同步修改pc在线默认通知状态,方法是client的setDefaultSilentWhenPcOnline函数。
|
||||
server.mobile_default_silent_when_pc_online true
|
||||
|
||||
## 客户端是否支持kickoff事件。当客户端被其他端登录踢出时,如果此开关为false时,客户端协议栈上报secret_mismatch。如果此开关为ture时,客户端协议栈上报kicked_off。
|
||||
## 客户端被踢时上报kicked_off是在2021.9.15之后才加上的。如果客户端协议栈全部为此日期之后的版本才可以打开此开关。
|
||||
server.client_support_kickoff_event false
|
||||
|
||||
#*********************************************************************
|
||||
# Push server configuration
|
||||
#*********************************************************************
|
||||
|
||||
Reference in New Issue
Block a user