From e0cbb69a4fa14f5f38417b19904a8b412deb2458 Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 24 Nov 2017 23:27:13 +0100 Subject: Add MessageSplit option to split messages on MessageLength (irc). Closes #281 --- bridge/irc/irc.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bridge/irc') diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index 2d56bbc6..4fd5a8a2 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -5,6 +5,7 @@ import ( "crypto/tls" "fmt" "github.com/42wim/matterbridge/bridge/config" + "github.com/42wim/matterbridge/bridge/helper" log "github.com/Sirupsen/logrus" "github.com/lrstanley/girc" "github.com/paulrosania/go-charset/charset" @@ -191,6 +192,10 @@ func (b *Birc) Send(msg config.Message) (string, error) { } } + // split long messages on messageLength, to avoid clipped messages #281 + if b.Config.MessageSplit { + msg.Text = helper.SplitStringLength(msg.Text, b.Config.MessageLength) + } for _, text := range strings.Split(msg.Text, "\n") { if len(text) > b.Config.MessageLength { text = text[:b.Config.MessageLength] + " " -- cgit v1.2.3