commit 2de6c46ab64deda988fa639de0f3f85f68b841cf
Author: Wim <wim@42.be>
Date: Sun Nov 11 21:56:12 2018 +0000
diff --git a/gateway/gateway.go b/gateway/gateway.go
index 442e27f..728ed70 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -3216 +32112 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
msg.ParentID = canonicalParentMsgID
}
+ // if we are using mattermost plugin account, send messages to MattermostPlugin channel
+ // that can be picked up by the mattermost matterbridge plugin
+ if dest.Account == "mattermost.plugin" {
+ gw.Router.MattermostPlugin <- msg
+ }
+
mID, err := dest.Send(msg)
if err != nil {
flog.Error(err)
diff --git a/gateway/router.go b/gateway/router.go
index 1ea3f94..030b7b1 100644
--- a/gateway/router.go
+++ b/gateway/router.go
@@ -1113 +1114 @@ import (
)
type Router struct {
- Gateways map[string]*Gateway
- Message chan config.Message
+ Gateways map[string]*Gateway
+ Message chan config.Message
+ MattermostPlugin chan config.Message
*config.Config
}
func NewRouter(cfg *config.Config) (*Router, error) {
- r := &Router{Message: make(chan config.Message), Gateways: make(map[string]*Gateway), Config: cfg}
+ r := &Router{Message: make(chan config.Message), MattermostPlugin: make(chan config.Message), Gateways: make(map[string]*Gateway), Config: cfg}
sgw := samechannelgateway.New(cfg)
gwconfigs := sgw.GetConfig()