Make showing identity change notices configurable

This commit is contained in:
Tulir Asokan 2021-11-09 22:57:36 +02:00
parent a8beec8754
commit cae2b8afa1
4 changed files with 9 additions and 5 deletions

View file

@ -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"`

View file

@ -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")

View file

@ -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

View file

@ -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,