forked from MirrorHub/mautrix-whatsapp
Add option to disable bridging Matrix leave events
This commit is contained in:
parent
ba0ec021ba
commit
9f4283b4e0
3 changed files with 5 additions and 1 deletions
|
@ -60,6 +60,7 @@ type BridgeConfig struct {
|
||||||
RecoverHistory bool `yaml:"recovery_history_backfill"`
|
RecoverHistory bool `yaml:"recovery_history_backfill"`
|
||||||
ChatMetaSync bool `yaml:"chat_meta_sync"`
|
ChatMetaSync bool `yaml:"chat_meta_sync"`
|
||||||
UserAvatarSync bool `yaml:"user_avatar_sync"`
|
UserAvatarSync bool `yaml:"user_avatar_sync"`
|
||||||
|
BridgeMatrixLeave bool `yaml:"bridge_matrix_leave"`
|
||||||
SyncChatMaxAge uint64 `yaml:"sync_max_chat_age"`
|
SyncChatMaxAge uint64 `yaml:"sync_max_chat_age"`
|
||||||
|
|
||||||
SyncWithCustomPuppets bool `yaml:"sync_with_custom_puppets"`
|
SyncWithCustomPuppets bool `yaml:"sync_with_custom_puppets"`
|
||||||
|
@ -120,6 +121,7 @@ func (bc *BridgeConfig) setDefaults() {
|
||||||
bc.RecoverHistory = true
|
bc.RecoverHistory = true
|
||||||
bc.ChatMetaSync = true
|
bc.ChatMetaSync = true
|
||||||
bc.UserAvatarSync = true
|
bc.UserAvatarSync = true
|
||||||
|
bc.BridgeMatrixLeave = true
|
||||||
bc.SyncChatMaxAge = 259200
|
bc.SyncChatMaxAge = 259200
|
||||||
|
|
||||||
bc.SyncWithCustomPuppets = true
|
bc.SyncWithCustomPuppets = true
|
||||||
|
|
|
@ -141,6 +141,8 @@ bridge:
|
||||||
# Whether or not puppet avatars should be fetched from the server even if an avatar is already set.
|
# 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.
|
# If you get 599 errors often, you should try disabling this.
|
||||||
user_avatar_sync: true
|
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
|
# Maximum number of seconds since last message in chat to skip
|
||||||
# syncing the chat in any case. This setting will take priority
|
# syncing the chat in any case. This setting will take priority
|
||||||
# over both recovery_chat_sync_limit and initial_chat_sync_count.
|
# over both recovery_chat_sync_limit and initial_chat_sync_count.
|
||||||
|
|
|
@ -2271,7 +2271,7 @@ func (portal *Portal) HandleMatrixLeave(sender *User) {
|
||||||
portal.Delete()
|
portal.Delete()
|
||||||
portal.Cleanup(false)
|
portal.Cleanup(false)
|
||||||
return
|
return
|
||||||
} else {
|
} else if portal.bridge.Config.Bridge.BridgeMatrixLeave {
|
||||||
// TODO should we somehow deduplicate this call if this leave was sent by the bridge?
|
// TODO should we somehow deduplicate this call if this leave was sent by the bridge?
|
||||||
resp, err := sender.Conn.LeaveGroup(portal.Key.JID)
|
resp, err := sender.Conn.LeaveGroup(portal.Key.JID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue