添加推送过期配置

This commit is contained in:
heavyrian2012
2023-09-13 11:16:54 +08:00
parent a183d30f89
commit 4e6188ee32
6 changed files with 24 additions and 1 deletions
+3
View File
@@ -123,6 +123,9 @@ 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 message.global_mute_exception_types 401,402,403,404,405,407,408,410,411
## 离线用户推送过期天数,0是永不过期,建议配置为7天。
message.push_expired_days 7
## 消息转发功能开启时,开关是否不转发server api接口消息。 ## 消息转发功能开启时,开关是否不转发server api接口消息。
## 当为true时,不转发server api发送的消息;当为false时,转发server api发送的消息。 ## 当为true时,不转发server api发送的消息;当为false时,转发server api发送的消息。
message.no_forward_admin_message false message.no_forward_admin_message false
@@ -153,6 +153,8 @@ public final class BrokerConstants {
public static final String MESSAGE_NO_Forward_Admin_Message = "message.no_forward_admin_message"; public static final String MESSAGE_NO_Forward_Admin_Message = "message.no_forward_admin_message";
public static final String MESSAGE_Push_Expired_Days = "message.push_expired_days";
public static final String MESSAGE_Forward_With_Client_Info = "message.forward_with_client_info"; public static final String MESSAGE_Forward_With_Client_Info = "message.forward_with_client_info";
public static final String ROBOT_Callback_With_Client_Info = "robot.callback_with_client_info"; public static final String ROBOT_Callback_With_Client_Info = "robot.callback_with_client_info";
public static final String CHANNEL_Callback_With_Client_Info = "channel.callback_with_client_info"; public static final String CHANNEL_Callback_With_Client_Info = "channel.callback_with_client_info";
@@ -145,6 +145,8 @@ public class MemoryMessagesStore implements IMessagesStore {
private long mFriendRequestExpiration = 7 * 24 * 60 * 60 * 1000; private long mFriendRequestExpiration = 7 * 24 * 60 * 60 * 1000;
private boolean mFriendRobotAutoAccept = true; private boolean mFriendRobotAutoAccept = true;
private long mPushExpiredTimes = 604800000L;
private boolean mMultiPlatformNotification = false; private boolean mMultiPlatformNotification = false;
private boolean mMobileDefaultSilentWhenPCOnline = true; private boolean mMobileDefaultSilentWhenPCOnline = true;
private boolean mDisableStrangerChat = false; private boolean mDisableStrangerChat = false;
@@ -306,6 +308,12 @@ public class MemoryMessagesStore implements IMessagesStore {
} catch (Exception e) { } catch (Exception e) {
} }
try {
mPushExpiredTimes = Long.parseLong(m_Server.getConfig().getProperty(BrokerConstants.MESSAGE_Push_Expired_Days, "7")) * 86400000L;
if(mPushExpiredTimes == 0) mPushExpiredTimes = Long.MAX_VALUE;
} catch (Exception e) {
}
try { try {
mChatroomRejoinWhenActive = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.CHATROOM_Rejoin_When_Active)); mChatroomRejoinWhenActive = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.CHATROOM_Rejoin_When_Active));
} catch (Exception e) { } catch (Exception e) {
@@ -4329,6 +4337,11 @@ public class MemoryMessagesStore implements IMessagesStore {
return mFriendRobotAutoAccept; return mFriendRobotAutoAccept;
} }
@Override
public long getPushExpiredTimes() {
return mPushExpiredTimes;
}
@Override @Override
public List<Integer> getClientForbiddenSendTypes() { public List<Integer> getClientForbiddenSendTypes() {
return mForbiddenClientSendTypes; return mForbiddenClientSendTypes;
@@ -244,6 +244,8 @@ public interface IMessagesStore {
boolean isRobotAutoAcceptFriendRequest(); boolean isRobotAutoAcceptFriendRequest();
long getPushExpiredTimes();
List<Integer> getClientForbiddenSendTypes(); List<Integer> getClientForbiddenSendTypes();
List<Integer> getBlackListExceptionTypes(); List<Integer> getBlackListExceptionTypes();
List<Integer> getGroupMuteExceptionTypes(); List<Integer> getGroupMuteExceptionTypes();
@@ -235,7 +235,7 @@ public class MessagesPublisher {
for (Session targetSession : sessions) { for (Session targetSession : sessions) {
//超过7天不活跃的用户忽略 //超过7天不活跃的用户忽略
if(System.currentTimeMillis() - targetSession.getLastActiveTime() > 7 * 24 * 60 * 60 * 1000) { if(System.currentTimeMillis() - targetSession.getLastActiveTime() > m_messagesStore.getPushExpiredTimes()) {
continue; continue;
} }
@@ -121,6 +121,9 @@ 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 message.global_mute_exception_types 401,402,403,404,405,407,408,410,411
## 离线用户推送过期天数,0是永不过期,建议配置为7天。
message.push_expired_days 7
## 消息转发功能开启时,开关是否不转发server api接口消息。 ## 消息转发功能开启时,开关是否不转发server api接口消息。
## 当为true时,不转发server api发送的消息;当为false时,转发server api发送的消息。 ## 当为true时,不转发server api发送的消息;当为false时,转发server api发送的消息。
message.no_forward_admin_message false message.no_forward_admin_message false