mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-13 01:20:25 +00:00
Add support for mattermost matterbridge plugin
This commit is contained in:
parent
2f042ad915
commit
730ccdd456
@ -321,6 +321,12 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
|
|||||||
msg.ParentID = canonicalParentMsgID
|
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)
|
mID, err := dest.Send(msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
flog.Error(err)
|
flog.Error(err)
|
||||||
|
@ -11,13 +11,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Router struct {
|
type Router struct {
|
||||||
Gateways map[string]*Gateway
|
Gateways map[string]*Gateway
|
||||||
Message chan config.Message
|
Message chan config.Message
|
||||||
|
MattermostPlugin chan config.Message
|
||||||
*config.Config
|
*config.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRouter(cfg *config.Config) (*Router, error) {
|
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)
|
sgw := samechannelgateway.New(cfg)
|
||||||
gwconfigs := sgw.GetConfig()
|
gwconfigs := sgw.GetConfig()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user