diff --git a/config/bridge.go b/config/bridge.go index 03edf5a..42515e3 100644 --- a/config/bridge.go +++ b/config/bridge.go @@ -89,6 +89,7 @@ type BridgeConfig struct { MarkReadOnlyOnCreate bool `yaml:"mark_read_only_on_create"` EnableStatusBroadcast bool `yaml:"enable_status_broadcast"` MuteStatusBroadcast bool `yaml:"mute_status_broadcast"` + StatusBroadcastTag string `yaml:"status_broadcast_tag"` 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 0b4bedd..0b6927c 100644 --- a/config/upgrade.go +++ b/config/upgrade.go @@ -115,6 +115,7 @@ func (helper *UpgradeHelper) doUpgrade() { helper.Copy(Bool, "bridge", "tag_only_on_create") helper.Copy(Bool, "bridge", "enable_status_broadcast") helper.Copy(Bool, "bridge", "mute_status_broadcast") + helper.Copy(Str|Null, "bridge", "status_broadcast_tag") 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 beb58aa..22f88b4 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -263,8 +263,10 @@ bridge: # 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. + # This is only applied when creating the room, the user can unmute it later. mute_status_broadcast: true + # Tag to apply to the status broadcast room. + status_broadcast_tag: m.lowpriority # 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 1eab6c7..41e5c64 100644 --- a/user.go +++ b/user.go @@ -835,9 +835,13 @@ func (user *User) syncChatDoublePuppetDetails(portal *Portal, justCreated bool) return } intent := doublePuppet.CustomIntent() - if portal.Key.JID == types.StatusBroadcastJID && 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) + if portal.Key.JID == types.StatusBroadcastJID && justCreated { + if user.bridge.Config.Bridge.MuteStatusBroadcast { + user.updateChatMute(intent, portal, time.Now().Add(365*24*time.Hour)) + } + if len(user.bridge.Config.Bridge.StatusBroadcastTag) > 0 { + user.updateChatTag(intent, portal, user.bridge.Config.Bridge.StatusBroadcastTag, true) + } return } else if !chat.Found { return