Replace HTML entities (slack). #215

This commit is contained in:
Wim 2017-07-09 14:26:35 +02:00
parent 1aaa992250
commit b75cf2c189

View File

@ -6,6 +6,7 @@ import (
"github.com/42wim/matterbridge/matterhook" "github.com/42wim/matterbridge/matterhook"
log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus"
"github.com/nlopes/slack" "github.com/nlopes/slack"
"html"
"regexp" "regexp"
"strings" "strings"
"time" "time"
@ -192,6 +193,7 @@ func (b *Bslack) handleSlack() {
texts := strings.Split(message.Text, "\n") texts := strings.Split(message.Text, "\n")
for _, text := range texts { for _, text := range texts {
text = b.replaceURL(text) text = b.replaceURL(text)
text = html.UnescapeString(text)
flog.Debugf("Sending message from %s on %s to gateway", message.Username, b.Account) flog.Debugf("Sending message from %s on %s to gateway", message.Username, b.Account)
b.Remote <- config.Message{Text: text, Username: message.Username, Channel: message.Channel, Account: b.Account, Avatar: b.getAvatar(message.Username), UserID: message.UserID} b.Remote <- config.Message{Text: text, Username: message.Username, Channel: message.Channel, Account: b.Account, Avatar: b.getAvatar(message.Username), UserID: message.UserID}
} }