mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-11-05 22:38:54 +01:00
Add option to disable reply fallbacks
This commit is contained in:
parent
a7068cd75b
commit
172ce83318
4 changed files with 9 additions and 1 deletions
|
@ -118,6 +118,7 @@ type BridgeConfig struct {
|
||||||
CaptionInMessage bool `yaml:"caption_in_message"`
|
CaptionInMessage bool `yaml:"caption_in_message"`
|
||||||
ExtEvPolls bool `yaml:"extev_polls"`
|
ExtEvPolls bool `yaml:"extev_polls"`
|
||||||
CrossRoomReplies bool `yaml:"cross_room_replies"`
|
CrossRoomReplies bool `yaml:"cross_room_replies"`
|
||||||
|
DisableReplyFallbacks bool `yaml:"disable_reply_fallbacks"`
|
||||||
|
|
||||||
MessageHandlingTimeout struct {
|
MessageHandlingTimeout struct {
|
||||||
ErrorAfterStr string `yaml:"error_after"`
|
ErrorAfterStr string `yaml:"error_after"`
|
||||||
|
|
|
@ -115,6 +115,7 @@ func DoUpgrade(helper *up.Helper) {
|
||||||
helper.Copy(up.Bool, "bridge", "extev_polls")
|
helper.Copy(up.Bool, "bridge", "extev_polls")
|
||||||
}
|
}
|
||||||
helper.Copy(up.Bool, "bridge", "cross_room_replies")
|
helper.Copy(up.Bool, "bridge", "cross_room_replies")
|
||||||
|
helper.Copy(up.Bool, "bridge", "disable_reply_fallbacks")
|
||||||
helper.Copy(up.Str|up.Null, "bridge", "message_handling_timeout", "error_after")
|
helper.Copy(up.Str|up.Null, "bridge", "message_handling_timeout", "error_after")
|
||||||
helper.Copy(up.Str|up.Null, "bridge", "message_handling_timeout", "deadline")
|
helper.Copy(up.Str|up.Null, "bridge", "message_handling_timeout", "deadline")
|
||||||
|
|
||||||
|
|
|
@ -313,6 +313,9 @@ bridge:
|
||||||
extev_polls: false
|
extev_polls: false
|
||||||
# Should cross-chat replies from WhatsApp be bridged? Most servers and clients don't support this.
|
# Should cross-chat replies from WhatsApp be bridged? Most servers and clients don't support this.
|
||||||
cross_room_replies: false
|
cross_room_replies: false
|
||||||
|
# Disable generating reply fallbacks? Some extremely bad clients still rely on them,
|
||||||
|
# but they're being phased out and will be completely removed in the future.
|
||||||
|
disable_reply_fallbacks: false
|
||||||
# Maximum time for handling Matrix events. Duration strings formatted for https://pkg.go.dev/time#ParseDuration
|
# Maximum time for handling Matrix events. Duration strings formatted for https://pkg.go.dev/time#ParseDuration
|
||||||
# Null means there's no enforced timeout.
|
# Null means there's no enforced timeout.
|
||||||
message_handling_timeout:
|
message_handling_timeout:
|
||||||
|
|
|
@ -1912,10 +1912,13 @@ func (portal *Portal) SetReply(content *event.MessageEventContent, replyTo *Repl
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
content.RelatesTo = (&event.RelatesTo{}).SetReplyTo(message.MXID)
|
||||||
|
if portal.bridge.Config.Bridge.DisableReplyFallbacks {
|
||||||
|
return true
|
||||||
|
}
|
||||||
evt, err := targetPortal.MainIntent().GetEvent(targetPortal.MXID, message.MXID)
|
evt, err := targetPortal.MainIntent().GetEvent(targetPortal.MXID, message.MXID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
portal.log.Warnln("Failed to get reply target:", err)
|
portal.log.Warnln("Failed to get reply target:", err)
|
||||||
content.RelatesTo = (&event.RelatesTo{}).SetReplyTo(message.MXID)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
_ = evt.Content.ParseRaw(evt.Type)
|
_ = evt.Content.ParseRaw(evt.Type)
|
||||||
|
|
Loading…
Reference in a new issue