diff options
author | Wim <wim@42.be> | 2017-09-10 18:19:33 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2017-09-10 18:19:33 +0200 |
commit | 90a61f15cc93ddca78f598dc6856c759a91bd96a (patch) | |
tree | c87ca65e67942b9d5af62d2b04ed1ef2c1f27f29 | |
parent | 86cd7f1ba617b79a374387e52df47b81b876cf09 (diff) | |
download | matterbridge-msglm-90a61f15cc93ddca78f598dc6856c759a91bd96a.tar.gz matterbridge-msglm-90a61f15cc93ddca78f598dc6856c759a91bd96a.tar.bz2 matterbridge-msglm-90a61f15cc93ddca78f598dc6856c759a91bd96a.zip |
Do not break messages on newline (slack). Closes #258
-rw-r--r-- | bridge/slack/slack.go | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 68ff8f8b..c7205464 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -234,25 +234,23 @@ func (b *Bslack) handleSlack() { if message.Text == "" || message.Username == "" { continue } - texts := strings.Split(message.Text, "\n") - for _, text := range texts { - text = b.replaceURL(text) - text = html.UnescapeString(text) - flog.Debugf("Sending message from %s on %s to gateway", message.Username, b.Account) - msg := config.Message{Text: text, Username: message.Username, Channel: message.Channel, Account: b.Account, Avatar: b.getAvatar(message.Username), UserID: message.UserID, ID: "slack " + message.Raw.Timestamp} - if message.Raw.SubType == "me_message" { - msg.Event = config.EVENT_USER_ACTION - } - if message.Raw.SubType == "channel_leave" || message.Raw.SubType == "channel_join" { - msg.Username = "system" - msg.Event = config.EVENT_JOIN_LEAVE - } - // edited messages have a submessage, use this timestamp - if message.Raw.SubMessage != nil { - msg.ID = "slack " + message.Raw.SubMessage.Timestamp - } - b.Remote <- msg + text := message.Text + text = b.replaceURL(text) + text = html.UnescapeString(text) + flog.Debugf("Sending message from %s on %s to gateway", message.Username, b.Account) + msg := config.Message{Text: text, Username: message.Username, Channel: message.Channel, Account: b.Account, Avatar: b.getAvatar(message.Username), UserID: message.UserID, ID: "slack " + message.Raw.Timestamp} + if message.Raw.SubType == "me_message" { + msg.Event = config.EVENT_USER_ACTION + } + if message.Raw.SubType == "channel_leave" || message.Raw.SubType == "channel_join" { + msg.Username = "system" + msg.Event = config.EVENT_JOIN_LEAVE + } + // edited messages have a submessage, use this timestamp + if message.Raw.SubMessage != nil { + msg.ID = "slack " + message.Raw.SubMessage.Timestamp } + b.Remote <- msg } } |