From ce9f2cbafea4d093c3c9ebea0c8e09c573712cc7 Mon Sep 17 00:00:00 2001 From: heavyrain2012 Date: Thu, 22 Jul 2021 19:38:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=80=E5=85=B3=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E5=AE=9A=E6=89=8B=E6=9C=BA=E6=98=AF=E5=90=A6=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E9=9D=99=E9=9F=B3=E5=BD=93pc=E6=88=96web=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- broker/config/wildfirechat.conf | 7 ++++++- broker/src/main/java/io/moquette/BrokerConstants.java | 1 + .../io/moquette/persistence/MemoryMessagesStore.java | 11 +++++++++-- distribution/src/main/resources/wildfirechat.conf | 7 ++++++- 4 files changed, 22 insertions(+), 4 deletions(-) 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