diff options
author | Wim <wim@42.be> | 2017-09-18 23:51:27 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2017-09-18 23:51:27 +0200 |
commit | 1a40b0c1e9dd9772d760a68f2998b3bcb0f8a413 (patch) | |
tree | 794e03cd33a9ed1c4aded7040f81bd7803ec8e7b /gateway | |
parent | 27d886826cd124feded6d7856847687568a395d0 (diff) | |
download | matterbridge-msglm-1a40b0c1e9dd9772d760a68f2998b3bcb0f8a413.tar.gz matterbridge-msglm-1a40b0c1e9dd9772d760a68f2998b3bcb0f8a413.tar.bz2 matterbridge-msglm-1a40b0c1e9dd9772d760a68f2998b3bcb0f8a413.zip |
Relay attachments from mattermost to slack (slack). Closes #260
Diffstat (limited to 'gateway')
-rw-r--r-- | gateway/gateway.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go index d09741fa..7c1f3bd9 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -147,6 +147,17 @@ func (gw *Gateway) getDestChannel(msg *config.Message, dest bridge.Bridge) []con func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrMsgID { var brMsgIDs []*BrMsgID + + // TODO refactor + // only slack now, check will have to be done in the different bridges. + // we need to check if we can't use fallback or text in other bridges + if msg.Extra != nil { + if dest.Protocol != "slack" { + if msg.Text == "" { + return brMsgIDs + } + } + } // only relay join/part when configged if msg.Event == config.EVENT_JOIN_LEAVE && !gw.Bridges[dest.Account].Config.ShowJoinPart { return brMsgIDs @@ -199,6 +210,10 @@ func (gw *Gateway) ignoreMessage(msg *config.Message) bool { return true } if msg.Text == "" { + // we have an attachment + if msg.Extra != nil { + return false + } log.Debugf("ignoring empty message %#v from %s", msg, msg.Account) return true } |