From 545377742c268f1193246a4005c07b0d7a516eaa Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 23 Oct 2016 21:16:14 +0200 Subject: Drop messages not from our mattermost team. Fixes #49 --- bridge/mattermost/mattermost.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bridge/mattermost') diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index ce506638..2a9749d2 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -31,6 +31,7 @@ type Bmattermost struct { name string origin string protocol string + TeamId string } var flog *log.Entry @@ -75,6 +76,7 @@ func (b *Bmattermost) Connect() error { go b.mc.WsReceiver() } go b.handleMatter() + b.TeamId = b.mc.GetTeamId() return nil } @@ -153,7 +155,8 @@ func (b *Bmattermost) handleMatter() { func (b *Bmattermost) handleMatterClient(mchan chan *MMMessage) { for message := range b.mc.MessageChan { // do not post our own messages back to irc - if message.Raw.Event == "posted" && b.mc.User.Username != message.Username { + // only listen to message from our team + if message.Raw.Event == "posted" && b.mc.User.Username != message.Username && message.Raw.TeamId == b.TeamId { flog.Debugf("Receiving from matterclient %#v", message) m := &MMMessage{} m.Username = message.Username -- cgit v1.2.3