From 1a40b0c1e9dd9772d760a68f2998b3bcb0f8a413 Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 18 Sep 2017 23:51:27 +0200 Subject: Relay attachments from mattermost to slack (slack). Closes #260 --- gateway/gateway.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gateway') 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 } -- cgit v1.2.3