diff --git a/config/bridge.go b/config/bridge.go index c08f010..406fc55 100644 --- a/config/bridge.go +++ b/config/bridge.go @@ -66,6 +66,7 @@ type BridgeConfig struct { TagOnlyOnCreate bool `yaml:"tag_only_on_create"` MarkReadOnlyOnCreate bool `yaml:"mark_read_only_on_create"` EnableStatusBroadcast bool `yaml:"enable_status_broadcast"` + MuteStatusBroadcast bool `yaml:"mute_status_broadcast"` WhatsappThumbnail bool `yaml:"whatsapp_thumbnail"` AllowUserInvite bool `yaml:"allow_user_invite"` FederateRooms bool `yaml:"federate_rooms"` diff --git a/config/upgrade.go b/config/upgrade.go index 07fbe90..cad95d7 100644 --- a/config/upgrade.go +++ b/config/upgrade.go @@ -98,6 +98,7 @@ func (helper *UpgradeHelper) doUpgrade() { helper.Copy(Str|Null, "bridge", "pinned_tag") helper.Copy(Bool, "bridge", "tag_only_on_create") helper.Copy(Bool, "bridge", "enable_status_broadcast") + helper.Copy(Bool, "bridge", "mute_status_broadcast") helper.Copy(Bool, "bridge", "whatsapp_thumbnail") helper.Copy(Bool, "bridge", "allow_user_invite") helper.Copy(Str, "bridge", "command_prefix") diff --git a/example-config.yaml b/example-config.yaml index 1779be2..7a17eda 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -169,6 +169,9 @@ bridge: # Should WhatsApp status messages be bridged into a Matrix room? # Disabling this won't affect already created status broadcast rooms. enable_status_broadcast: true + # Should the status broadcast room be muted and moved into low priority by default? + # This is only applied when creating the room, the user can unmute/untag it later. + mute_status_broadcast: false # Should the bridge use thumbnails from WhatsApp? # They're disabled by default due to very low resolution. whatsapp_thumbnail: false diff --git a/user.go b/user.go index c7b2321..ce0ac4a 100644 --- a/user.go +++ b/user.go @@ -573,6 +573,12 @@ func (user *User) syncChatDoublePuppetDetails(portal *Portal, justCreated bool) return } intent := doublePuppet.CustomIntent() + if justCreated && user.bridge.Config.Bridge.MuteStatusBroadcast { + user.updateChatMute(intent, portal, time.Now().Add(365 * 24 * time.Hour)) + user.updateChatTag(intent, portal, user.bridge.Config.Bridge.ArchiveTag, true) + } else if !chat.Found { + return + } user.updateChatMute(intent, portal, chat.MutedUntil) user.updateChatTag(intent, portal, user.bridge.Config.Bridge.ArchiveTag, chat.Archived) user.updateChatTag(intent, portal, user.bridge.Config.Bridge.PinnedTag, chat.Pinned)