diff --git a/broker/config/wildfirechat.conf b/broker/config/wildfirechat.conf index 39fc4efa..9efa02e5 100755 --- a/broker/config/wildfirechat.conf +++ b/broker/config/wildfirechat.conf @@ -201,10 +201,15 @@ local.media.storage.root media # local.media.storage.remote_server_url https://example.com/media # 是否支持多端登陆,为true时支持任意平台任意多个客户端同时登录;为false时每个平台只支持一个端登录,但不同平台可以同时登录。 +# Android/iOS为移动平台,windows/mac/linux为pc平台,web为web平台,小程序为小程序平台。 server.multi_endpoint false # 多平台连接状态通知(仅当multi_endpoint为false时有效),true时移动端可以收到pc或web端登录的通知。 -server.multi_platform_notification false +server.multi_platform_notification true + +# 当pc或者web在线时,手机是否默认静音,默认为false。注意仅影响默认值,用户可以手动切换是否静音。 +# 如果这里改为true,客户端那边需要同步修改pc在线默认通知状态。 +server.mobile_default_silent_when_pc_online false #********************************************************************* # Push server configuration diff --git a/broker/src/main/java/io/moquette/BrokerConstants.java b/broker/src/main/java/io/moquette/BrokerConstants.java index 4a762187..dabbc649 100755 --- a/broker/src/main/java/io/moquette/BrokerConstants.java +++ b/broker/src/main/java/io/moquette/BrokerConstants.java @@ -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 MESSAGE_ROAMING = "message.roaming"; public static final String MESSAGE_Remote_History_Message = "message.remote_history_message"; diff --git a/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java b/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java index 776c161e..36f09c87 100755 --- a/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java +++ b/broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java @@ -133,6 +133,7 @@ public class MemoryMessagesStore implements IMessagesStore { private boolean mFriendNewWelcomeMessage = true; private boolean mMultiPlatformNotification = false; + private boolean mMobileDefaultSilentWhenPCOnline = false; private boolean mDisableStrangerChat = false; private long mChatroomParticipantIdleTime = 900000; @@ -183,6 +184,12 @@ public class MemoryMessagesStore implements IMessagesStore { printMissConfigLog(SERVER_MULTI_PLATFROM_NOTIFICATION, mMultiPlatformNotification + ""); } + try { + mMobileDefaultSilentWhenPCOnline = Boolean.parseBoolean(m_Server.getConfig().getProperty(SERVER_MOBILE_DEFAULT_SILENT_WHEN_PC_ONLINE, "false")); + } catch (Exception e) { + e.printStackTrace(); + } + try { mDisableSearch = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.FRIEND_Disable_Search)); } catch (Exception e) { @@ -3400,9 +3407,9 @@ public class MemoryMessagesStore implements IMessagesStore { public boolean getSilentWhenPcOnline(String userId) { WFCMessage.UserSettingEntry entry = getUserSetting(userId, UserSettingScope.kUserSettingMuteWhenPCOnline, null); if (entry != null && "1".equals(entry.getValue())) { - return true; + return !mMobileDefaultSilentWhenPCOnline; } else { - return false; + return mMobileDefaultSilentWhenPCOnline; } } private Date getTodayDate() { diff --git a/distribution/src/main/resources/wildfirechat.conf b/distribution/src/main/resources/wildfirechat.conf index 59831bf5..67a43a5a 100755 --- a/distribution/src/main/resources/wildfirechat.conf +++ b/distribution/src/main/resources/wildfirechat.conf @@ -198,10 +198,15 @@ local.media.storage.root ./media # local.media.storage.remote_server_url https://example.com/media # 是否支持多端登陆,为true时支持任意平台任意多个客户端同时登录;为false时每个平台只支持一个端登录,但不同平台可以同时登录。 +# Android/iOS为移动平台,windows/mac/linux为pc平台,web为web平台,小程序为小程序平台。 server.multi_endpoint false # 多平台连接状态通知(仅当multi_endpoint为false时有效),true时移动端可以收到pc或web端登录的通知。 -server.multi_platform_notification false +server.multi_platform_notification true + +# 当pc或者web在线时,手机是否默认静音,默认为false。注意仅影响默认值,用户可以手动切换是否静音。 +# 如果这里改为true,客户端那边需要同步修改pc在线默认通知状态。 +server.mobile_default_silent_when_pc_online false #********************************************************************* # Push server configuration