4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 07:29:24 +00:00

Relay attachments from mattermost to slack (slack). Closes #260

This commit is contained in:
Wim
2017-09-18 23:51:27 +02:00
parent 27d886826c
commit 1a40b0c1e9
4 changed files with 51 additions and 2 deletions

View File

@ -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
}