matterbridge
matterbridge copied to clipboard
IRC MessageLength setting has no effect
Describe the bug
IRC messages are truncated somewhere but not according to the MessageLength setting and the <message clipped>
string is not appended.
To Reproduce
- Set MessageLength or use the default 400
- Send a long message from another chat and observe the relayed message on the IRC end
Expected behavior
The message should be truncated by MessageLength and the message should end in <message clipped>
.
Screenshots/debug logs
Log from my test (with MessageLength=100):
Environment (please complete the following information):
- OS: linux
- Matterbridge version: 1.22.3 e45bbe45
Additional context
[irc.liberachat]
Nick="x"
NickServNick="x"
NickServPassword="x"
Server="irc.libera.chat:6697"
UseTLS=true
UseSASL=true
SkipTLSVerify=false
RemoteNickFormat="[轉自{PROTOCOL}] <{NICK}> "
ShowJoinPart=true
MessageLength=100
MessageSplit=false
[matrix.x]
Server="x"
Login="x"
Password="x"
RemoteNickFormat="[轉自{PROTOCOL}] <{NICK}> "
NoHomeServerSuffix=false
ShowJoinPart=true
[[gateway]]
name="x"
enable=true
[[gateway.inout]]
account="irc.liberachat"
channel="##x"
[[gateway.inout]]
account="matrix.x"
channel="#x:x.x"
MessageSplit=false
This is not explained in the Wiki but MessageLength
is only used when MessageSplit
is used as well (bridge/irc/irc.go#L169-L173):
if b.GetBool("MessageSplit") {
msgLines = helper.GetSubLines(msg.Text, b.MessageLength, b.GetString("MessageClipped"))
} else {
msgLines = helper.GetSubLines(msg.Text, 0, b.GetString("MessageClipped"))
}
MessageLength
is only used whenMessageSplit
is used as well
However the wiki docs on MessageSplit
states that
Split messages on MessageLength instead of showing the
implying that, when it is enabled, the "
Besides, the original intention of the MessageLength
option as implemented for https://github.com/42wim/matterbridge/issues/179 is clearly used to long truncate messages, not just for splitting them.
Also if MessageLength
could account for the size of the nickname as well, I think it would make things easier.