From cae2b8afa1f2bf8e6f867758decb350d479ff164 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 9 Nov 2021 22:57:36 +0200 Subject: [PATCH] Make showing identity change notices configurable --- config/bridge.go | 9 +++++---- config/upgrade.go | 1 + example-config.yaml | 2 ++ user.go | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/config/bridge.go b/config/bridge.go index f8052ba..c08f010 100644 --- a/config/bridge.go +++ b/config/bridge.go @@ -32,10 +32,11 @@ type BridgeConfig struct { UsernameTemplate string `yaml:"username_template"` DisplaynameTemplate string `yaml:"displayname_template"` - DeliveryReceipts bool `yaml:"delivery_receipts"` - PortalMessageBuffer int `yaml:"portal_message_buffer"` - CallStartNotices bool `yaml:"call_start_notices"` - ReactionNotices bool `yaml:"reaction_notices"` + DeliveryReceipts bool `yaml:"delivery_receipts"` + PortalMessageBuffer int `yaml:"portal_message_buffer"` + CallStartNotices bool `yaml:"call_start_notices"` + IdentityChangeNotices bool `yaml:"identity_change_notices"` + ReactionNotices bool `yaml:"reaction_notices"` HistorySync struct { CreatePortals bool `yaml:"create_portals"` diff --git a/config/upgrade.go b/config/upgrade.go index 45b3124..07fbe90 100644 --- a/config/upgrade.go +++ b/config/upgrade.go @@ -68,6 +68,7 @@ func (helper *UpgradeHelper) doUpgrade() { helper.Copy(Bool, "bridge", "delivery_receipts") helper.Copy(Int, "bridge", "portal_message_buffer") helper.Copy(Bool, "bridge", "call_start_notices") + helper.Copy(Bool, "bridge", "identity_change_notices") helper.Copy(Bool, "bridge", "reaction_notices") helper.Copy(Bool, "bridge", "history_sync", "create_portals") helper.Copy(Int, "bridge", "history_sync", "max_age") diff --git a/example-config.yaml b/example-config.yaml index 632f82b..1779be2 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -92,6 +92,8 @@ bridge: delivery_receipts: false # Should incoming calls send a message to the Matrix room? call_start_notices: true + # Should another user's cryptographic identity changing send a message to Matrix? + identity_change_notices: false # Should a "reactions not yet supported" warning be sent to the Matrix room when a user reacts to a message? reaction_notices: true diff --git a/user.go b/user.go index 9671880..50871d3 100644 --- a/user.go +++ b/user.go @@ -439,7 +439,7 @@ func (user *User) HandleEvent(event interface{}) { case *events.IdentityChange: puppet := user.bridge.GetPuppetByJID(v.JID) portal := user.GetPortalByJID(v.JID) - if len(portal.MXID) > 0 { + if len(portal.MXID) > 0 && user.bridge.Config.Bridge.IdentityChangeNotices { portal.messages <- PortalMessage{ fake: &fakeMessage{ Sender: v.JID,