mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-29 07:29:29 +01:00
Add KeepQuotedReply option for matrix to fix regression (#1823)
Matrix quotes replies and as of matterbridge 1.24.0 we strip those as this causes
issues with bridges support threading and have PreserveThreading enabled.
Introduced via 9a8ce9b17e
But if you for example use mattermost or discord with webhooks you'll need to enable
this if you want something that looks like a reply from matrix.
See issues:
- https://github.com/42wim/matterbridge/issues/1819
- https://github.com/42wim/matterbridge/issues/1780
This commit is contained in:
parent
81e6f75aa4
commit
2fa96ec0ed
@ -272,8 +272,6 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) {
|
|||||||
// Handle prefix hint for unthreaded messages.
|
// Handle prefix hint for unthreaded messages.
|
||||||
if msg.ParentNotFound() {
|
if msg.ParentNotFound() {
|
||||||
msg.ParentID = ""
|
msg.ParentID = ""
|
||||||
msg.Text = strings.TrimPrefix(msg.Text, "\n")
|
|
||||||
msg.Text = fmt.Sprintf("> %s %s", msg.Username, msg.Text)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use webhook to send the message
|
// Use webhook to send the message
|
||||||
|
@ -428,6 +428,8 @@ func (b *Bmatrix) handleReply(ev *matrix.Event, rmsg config.Message) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body := rmsg.Text
|
body := rmsg.Text
|
||||||
|
|
||||||
|
if !b.GetBool("keepquotedreply") {
|
||||||
for strings.HasPrefix(body, "> ") {
|
for strings.HasPrefix(body, "> ") {
|
||||||
lineIdx := strings.IndexRune(body, '\n')
|
lineIdx := strings.IndexRune(body, '\n')
|
||||||
if lineIdx == -1 {
|
if lineIdx == -1 {
|
||||||
@ -436,6 +438,7 @@ func (b *Bmatrix) handleReply(ev *matrix.Event, rmsg config.Message) bool {
|
|||||||
body = body[(lineIdx + 1):]
|
body = body[(lineIdx + 1):]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rmsg.Text = body
|
rmsg.Text = body
|
||||||
rmsg.ParentID = relation.InReplyTo.EventID
|
rmsg.ParentID = relation.InReplyTo.EventID
|
||||||
|
@ -183,6 +183,7 @@ func (b *Bmattermost) sendWebhook(msg config.Message) (string, error) {
|
|||||||
if b.GetBool("PrefixMessagesWithNick") {
|
if b.GetBool("PrefixMessagesWithNick") {
|
||||||
msg.Text = msg.Username + msg.Text
|
msg.Text = msg.Username + msg.Text
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.Extra != nil {
|
if msg.Extra != nil {
|
||||||
// this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE
|
// this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE
|
||||||
for _, rmsg := range helper.HandleExtra(&msg, b.General) {
|
for _, rmsg := range helper.HandleExtra(&msg, b.General) {
|
||||||
|
@ -1328,6 +1328,15 @@ HTMLDisable=false
|
|||||||
# UseUserName shows the username instead of the server nickname
|
# UseUserName shows the username instead of the server nickname
|
||||||
UseUserName=false
|
UseUserName=false
|
||||||
|
|
||||||
|
# Matrix quotes replies and as of matterbridge 1.24.0 we strip those as this causes
|
||||||
|
# issues with bridges support threading and have PreserveThreading enabled.
|
||||||
|
# But if you for example use mattermost or discord with webhooks you'll need to enable
|
||||||
|
# this (and keep PreserveThreading disabled) if you want something that looks like a reply from matrix.
|
||||||
|
# See issues:
|
||||||
|
# - https://github.com/42wim/matterbridge/issues/1819
|
||||||
|
# - https://github.com/42wim/matterbridge/issues/1780
|
||||||
|
KeepQuotedReply=false
|
||||||
|
|
||||||
#Nicks you want to ignore.
|
#Nicks you want to ignore.
|
||||||
#Regular expressions supported
|
#Regular expressions supported
|
||||||
#Messages from those users will not be sent to other bridges.
|
#Messages from those users will not be sent to other bridges.
|
||||||
|
Loading…
Reference in New Issue
Block a user