summaryrefslogtreecommitdiffstats
path: root/gateway
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-07-09 13:59:50 +0200
committerWim <wim@42.be>2017-07-09 14:00:28 +0200
commit6256c066f11466784fd35f45549ac643dcec790f (patch)
tree02959a047574008dfb6963e9fc7dcd17fb670073 /gateway
parent870b89a8f031903ac53780ec4f09a36532998df6 (diff)
downloadmatterbridge-msglm-6256c066f11466784fd35f45549ac643dcec790f.tar.gz
matterbridge-msglm-6256c066f11466784fd35f45549ac643dcec790f.tar.bz2
matterbridge-msglm-6256c066f11466784fd35f45549ac643dcec790f.zip
Replace :emoji: with unicode chars. #215
Add vendor github.com/peterhellberg/emojilib
Diffstat (limited to 'gateway')
-rw-r--r--gateway/gateway.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go
index be09ac76..03d6aa92 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -5,6 +5,7 @@ import (
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
log "github.com/Sirupsen/logrus"
+ "github.com/peterhellberg/emojilib"
// "github.com/davecgh/go-spew/spew"
"regexp"
"strings"
@@ -116,6 +117,7 @@ func (gw *Gateway) handleReceive() {
}
if !gw.ignoreMessage(&msg) {
msg.Timestamp = time.Now()
+ gw.modifyMessage(&msg)
for _, br := range gw.Bridges {
gw.handleMessage(msg, br)
}
@@ -296,6 +298,11 @@ func (gw *Gateway) modifyAvatar(msg *config.Message, dest *bridge.Bridge) {
}
}
+func (gw *Gateway) modifyMessage(msg *config.Message) {
+ // replace :emoji: to unicode
+ msg.Text = emojilib.Replace(msg.Text)
+}
+
func getChannelID(msg config.Message) string {
return msg.Channel + msg.Account
}