Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bridgev2/bridgeconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type BridgeConfig struct {
UnknownErrorAutoReconnect time.Duration `yaml:"unknown_error_auto_reconnect"`
UnknownErrorMaxAutoReconnects int `yaml:"unknown_error_max_auto_reconnects"`
BridgeMatrixLeave bool `yaml:"bridge_matrix_leave"`
BridgeRemoteLeave bool `yaml:"bridge_remote_leave"`
BridgeNotices bool `yaml:"bridge_notices"`
TagOnlyOnCreate bool `yaml:"tag_only_on_create"`
OnlyBridgeTags []event.RoomTag `yaml:"only_bridge_tags"`
Expand Down
1 change: 1 addition & 0 deletions bridgev2/bridgeconfig/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func doUpgrade(helper up.Helper) {
helper.Copy(up.Str|up.Int|up.Null, "bridge", "unknown_error_auto_reconnect")
helper.Copy(up.Int, "bridge", "unknown_error_max_auto_reconnects")
helper.Copy(up.Bool, "bridge", "bridge_matrix_leave")
helper.Copy(up.Bool, "bridge", "bridge_remote_leave")
helper.Copy(up.Bool, "bridge", "bridge_notices")
helper.Copy(up.Bool, "bridge", "tag_only_on_create")
helper.Copy(up.List, "bridge", "only_bridge_tags")
Expand Down
6 changes: 6 additions & 0 deletions bridgev2/matrix/mxmain/example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ bridge:

# Should leaving Matrix rooms be bridged as leaving groups on the remote network?
bridge_matrix_leave: false
# Should leaving a group on the remote network kick the user out of the
# corresponding Matrix room? When `true`, a remote leave is propagated to
# Matrix the same as any other membership change. When `false`, the leave
# is dropped so the user keeps access to history and stays in the Matrix
# room.
bridge_remote_leave: true
# Should `m.notice` messages be bridged?
bridge_notices: false
# Should room tags only be synced when creating the portal? Tags mean things like favorite/pin and archive/low priority.
Expand Down
10 changes: 10 additions & 0 deletions bridgev2/portal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4618,6 +4618,16 @@ func (portal *Portal) syncParticipants(
if member.Membership == "" {
member.Membership = event.MembershipJoin
}
// Symmetric with bridge_matrix_leave: when bridge_remote_leave is
// disabled, dropping the leave from the remote network keeps the
// user in the Matrix room with their existing history.
if !portal.Bridge.Config.BridgeRemoteLeave && member.Membership == event.MembershipLeave {
log.Debug().
Stringer("user_id", extraUserID).
Msg("Dropping remote leave: bridge_remote_leave is disabled")
delete(currentMembers, extraUserID)
return false
}
if member.PowerLevel != nil {
powerChanged = currentPower.EnsureUserLevelAs(portal.Bridge.Bot.GetMXID(), extraUserID, *member.PowerLevel) || powerChanged
}
Expand Down