ソースを参照

Make showing identity change notices configurable

Tulir Asokan 3 年 前
コミット
cae2b8afa1
4 ファイル変更9 行追加5 行削除
  1. 5 4
      config/bridge.go
  2. 1 0
      config/upgrade.go
  3. 2 0
      example-config.yaml
  4. 1 1
      user.go

+ 5 - 4
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"`

+ 1 - 0
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")

+ 2 - 0
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
 

+ 1 - 1
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,