Add option to disable bridging Matrix leave events

This commit is contained in:
Tulir Asokan 2021-02-10 22:15:23 +02:00
parent ba0ec021ba
commit 9f4283b4e0
3 changed files with 5 additions and 1 deletions

View file

@ -60,6 +60,7 @@ type BridgeConfig struct {
RecoverHistory bool `yaml:"recovery_history_backfill"`
ChatMetaSync bool `yaml:"chat_meta_sync"`
UserAvatarSync bool `yaml:"user_avatar_sync"`
BridgeMatrixLeave bool `yaml:"bridge_matrix_leave"`
SyncChatMaxAge uint64 `yaml:"sync_max_chat_age"`
SyncWithCustomPuppets bool `yaml:"sync_with_custom_puppets"`
@ -120,6 +121,7 @@ func (bc *BridgeConfig) setDefaults() {
bc.RecoverHistory = true
bc.ChatMetaSync = true
bc.UserAvatarSync = true
bc.BridgeMatrixLeave = true
bc.SyncChatMaxAge = 259200
bc.SyncWithCustomPuppets = true

View file

@ -141,6 +141,8 @@ bridge:
# Whether or not puppet avatars should be fetched from the server even if an avatar is already set.
# If you get 599 errors often, you should try disabling this.
user_avatar_sync: true
# Whether or not Matrix users leaving groups should be bridged to WhatsApp
bridge_matrix_leave: true
# Maximum number of seconds since last message in chat to skip
# syncing the chat in any case. This setting will take priority
# over both recovery_chat_sync_limit and initial_chat_sync_count.

View file

@ -2271,7 +2271,7 @@ func (portal *Portal) HandleMatrixLeave(sender *User) {
portal.Delete()
portal.Cleanup(false)
return
} else {
} else if portal.bridge.Config.Bridge.BridgeMatrixLeave {
// TODO should we somehow deduplicate this call if this leave was sent by the bridge?
resp, err := sender.Conn.LeaveGroup(portal.Key.JID)
if err != nil {