diff options
author | Wim <wim@42.be> | 2017-04-07 22:27:36 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2017-04-07 22:27:36 +0200 |
commit | bd38319d8352e48eb0e29c5e30f094e5430d63e8 (patch) | |
tree | a35b3d1bad7019476169ca4e39a44162e5393e00 | |
parent | 33dffd5ea84890c85771a8ab759750192501f041 (diff) | |
download | matterbridge-msglm-bd38319d8352e48eb0e29c5e30f094e5430d63e8.tar.gz matterbridge-msglm-bd38319d8352e48eb0e29c5e30f094e5430d63e8.tar.bz2 matterbridge-msglm-bd38319d8352e48eb0e29c5e30f094e5430d63e8.zip |
Add support for showing/hiding join/leave messages from mattermost. Closes #147
-rw-r--r-- | bridge/mattermost/mattermost.go | 8 | ||||
-rw-r--r-- | matterbridge.toml.sample | 30 | ||||
-rw-r--r-- | matterclient/matterclient.go | 2 |
3 files changed, 30 insertions, 10 deletions
diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index dec8fcb4..439ce9c9 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -131,6 +131,14 @@ func (b *Bmattermost) handleMatter() { func (b *Bmattermost) handleMatterClient(mchan chan *MMMessage) { for message := range b.mc.MessageChan { + flog.Debugf("%#v", message.Raw.Data) + if message.Type == "system_join_leave" || + message.Type == "system_join_channel" || + message.Type == "system_leave_channel" { + flog.Debugf("Sending JOIN_LEAVE event from %s to gateway", b.Account) + b.Remote <- config.Message{Username: "system", Text: message.Text, Channel: message.Channel, Account: b.Account, Event: config.EVENT_JOIN_LEAVE} + continue + } // do not post our own messages back to irc // only listen to message from our team if message.Raw.Event == "posted" && b.mc.User.Username != message.Username && message.Raw.Data["team_id"].(string) == b.TeamId { diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index 40fccea3..d1dc0f41 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -64,7 +64,8 @@ IgnoreNicks="ircspammer1 ircspammer2" #OPTIONAL (default empty) RemoteNickFormat="[{PROTOCOL}] <{NICK}> " -#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment) +#Enable to show users joins/parts from other bridges +#Only works hiding/show messages from irc and mattermost bridge for now #OPTIONAL (default false) ShowJoinPart=false @@ -114,7 +115,8 @@ IgnoreNicks="ircspammer1 ircspammer2" #OPTIONAL (default empty) RemoteNickFormat="[{PROTOCOL}] <{NICK}> " -#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment) +#Enable to show users joins/parts from other bridges +#Only works hiding/show messages from irc and mattermost bridge for now #OPTIONAL (default false) ShowJoinPart=false @@ -157,7 +159,8 @@ IgnoreNicks="spammer1 spammer2" #OPTIONAL (default empty) RemoteNickFormat="[{PROTOCOL}/{BRIDGE}] <{NICK}> " -#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment) +#Enable to show users joins/parts from other bridges +#Only works hiding/show messages from irc and mattermost bridge for now #OPTIONAL (default false) ShowJoinPart=false @@ -250,7 +253,8 @@ IgnoreNicks="ircspammer1 ircspammer2" #OPTIONAL (default empty) RemoteNickFormat="[{PROTOCOL}] <{NICK}> " -#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment) +#Enable to show users joins/parts from other bridges +#Only works hiding/show messages from irc and mattermost bridge for now #OPTIONAL (default false) ShowJoinPart=false @@ -282,7 +286,8 @@ IgnoreNicks="ircspammer1 ircspammer2" #OPTIONAL (default empty) RemoteNickFormat="[{PROTOCOL}] <{NICK}> " -#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment) +#Enable to show users joins/parts from other bridges +#Only works hiding/show messages from irc and mattermost bridge for now #OPTIONAL (default false) ShowJoinPart=false @@ -362,7 +367,8 @@ IgnoreNicks="ircspammer1 ircspammer2" #OPTIONAL (default empty) RemoteNickFormat="[{PROTOCOL}] <{NICK}> " -#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment) +#Enable to show users joins/parts from other bridges +#Only works hiding/show messages from irc and mattermost bridge for now #OPTIONAL (default false) ShowJoinPart=false @@ -397,7 +403,8 @@ IgnoreNicks="ircspammer1 ircspammer2" #OPTIONAL (default empty) RemoteNickFormat="[{PROTOCOL}] <{NICK}> " -#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment) +#Enable to show users joins/parts from other bridges +#Only works hiding/show messages from irc and mattermost bridge for now #OPTIONAL (default false) ShowJoinPart=false @@ -432,7 +439,8 @@ IgnoreNicks="spammer1 spammer2" #OPTIONAL (default empty) RemoteNickFormat="[{PROTOCOL}] <{NICK}> " -#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment) +#Enable to show users joins/parts from other bridges +#Only works hiding/show messages from irc and mattermost bridge for now #OPTIONAL (default false) ShowJoinPart=false @@ -489,7 +497,8 @@ IgnoreNicks="ircspammer1 ircspammer2" #OPTIONAL (default empty) RemoteNickFormat="[{PROTOCOL}] <{NICK}> " -#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment) +#Enable to show users joins/parts from other bridges +#Only works hiding/show messages from irc and mattermost bridge for now #OPTIONAL (default false) ShowJoinPart=false @@ -532,7 +541,8 @@ IgnoreNicks="spammer1 spammer2" #OPTIONAL (default empty) RemoteNickFormat="[{PROTOCOL}] <{NICK}> " -#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment) +#Enable to show users joins/parts from other bridges +#Only works hiding/show messages from irc and mattermost bridge for now #OPTIONAL (default false) ShowJoinPart=false diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index beae8070..d2bfbae7 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -34,6 +34,7 @@ type Message struct { Channel string Username string Text string + Type string } type Team struct { @@ -266,6 +267,7 @@ func (m *MMClient) parseActionPost(rmsg *Message) { } rmsg.Username = m.GetUser(data.UserId).Username rmsg.Channel = m.GetChannelName(data.ChannelId) + rmsg.Type = data.Type rmsg.Team = m.GetTeamName(rmsg.Raw.Data["team_id"].(string)) // direct message if rmsg.Raw.Data["channel_type"] == "D" { |