mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-22 07:00:27 +00:00
Fix ShowJoinPart from irc bridge. Closes #72
This commit is contained in:
parent
1f36904588
commit
449ed31e25
@ -8,12 +8,17 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
EVENT_JOIN_LEAVE = "join_leave"
|
||||||
|
)
|
||||||
|
|
||||||
type Message struct {
|
type Message struct {
|
||||||
Text string
|
Text string
|
||||||
Channel string
|
Channel string
|
||||||
Username string
|
Username string
|
||||||
Avatar string
|
Avatar string
|
||||||
Account string
|
Account string
|
||||||
|
Event string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Protocol struct {
|
type Protocol struct {
|
||||||
|
@ -156,11 +156,24 @@ func (b *Birc) handleNewConnection(event *irc.Event) {
|
|||||||
i.SendRaw("PONG :" + e.Message())
|
i.SendRaw("PONG :" + e.Message())
|
||||||
flog.Debugf("PING/PONG")
|
flog.Debugf("PING/PONG")
|
||||||
})
|
})
|
||||||
|
i.AddCallback("JOIN", b.handleJoinPart)
|
||||||
|
i.AddCallback("PART", b.handleJoinPart)
|
||||||
|
i.AddCallback("QUIT", b.handleJoinPart)
|
||||||
i.AddCallback("*", b.handleOther)
|
i.AddCallback("*", b.handleOther)
|
||||||
// we are now fully connected
|
// we are now fully connected
|
||||||
b.connected <- struct{}{}
|
b.connected <- struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Birc) handleJoinPart(event *irc.Event) {
|
||||||
|
flog.Debugf("Sending JOIN_LEAVE event from %s to gateway", b.Account)
|
||||||
|
channel := event.Arguments[0]
|
||||||
|
if event.Code == "QUIT" {
|
||||||
|
channel = ""
|
||||||
|
}
|
||||||
|
b.Remote <- config.Message{Username: "system", Text: event.Nick + " " + strings.ToLower(event.Code) + "s", Channel: channel, Account: b.Account, Event: config.EVENT_JOIN_LEAVE}
|
||||||
|
flog.Debugf("handle %#v", event)
|
||||||
|
}
|
||||||
|
|
||||||
func (b *Birc) handleNotice(event *irc.Event) {
|
func (b *Birc) handleNotice(event *irc.Event) {
|
||||||
if strings.Contains(event.Message(), "This nickname is registered") && event.Nick == b.Config.NickServNick {
|
if strings.Contains(event.Message(), "This nickname is registered") && event.Nick == b.Config.NickServNick {
|
||||||
b.i.Privmsg(b.Config.NickServNick, "IDENTIFY "+b.Config.NickServPassword)
|
b.i.Privmsg(b.Config.NickServNick, "IDENTIFY "+b.Config.NickServPassword)
|
||||||
|
12
changelog.md
12
changelog.md
@ -1,9 +1,17 @@
|
|||||||
# v0.8
|
# v0.9.0-dev
|
||||||
|
## General
|
||||||
|
* discord: add "Bot " tag to discord tokens automatically
|
||||||
|
|
||||||
|
## Bugfix
|
||||||
|
* general: fix ShowJoinPart for messages from irc bridge #72
|
||||||
|
* irc: fix !users command #78
|
||||||
|
|
||||||
|
# v0.8.0
|
||||||
Release because of breaking mattermost API changes
|
Release because of breaking mattermost API changes
|
||||||
## New features
|
## New features
|
||||||
* Supports mattermost v3.5.0
|
* Supports mattermost v3.5.0
|
||||||
|
|
||||||
# v0.7
|
# v0.7.0
|
||||||
## Breaking config changes from 0.6 to 0.7
|
## Breaking config changes from 0.6 to 0.7
|
||||||
Matterbridge now uses TOML configuration (https://github.com/toml-lang/toml)
|
Matterbridge now uses TOML configuration (https://github.com/toml-lang/toml)
|
||||||
See matterbridge.toml.sample for an example
|
See matterbridge.toml.sample for an example
|
||||||
|
@ -106,6 +106,10 @@ func (gw *Gateway) mapIgnores() {
|
|||||||
|
|
||||||
func (gw *Gateway) getDestChannel(msg *config.Message, dest string) []string {
|
func (gw *Gateway) getDestChannel(msg *config.Message, dest string) []string {
|
||||||
channels := gw.ChannelsIn[msg.Account]
|
channels := gw.ChannelsIn[msg.Account]
|
||||||
|
// broadcast to every out channel (irc QUIT)
|
||||||
|
if msg.Event == config.EVENT_JOIN_LEAVE && msg.Channel == "" {
|
||||||
|
return gw.ChannelsOut[dest]
|
||||||
|
}
|
||||||
for _, channel := range channels {
|
for _, channel := range channels {
|
||||||
if channel == msg.Channel {
|
if channel == msg.Channel {
|
||||||
return gw.ChannelsOut[dest]
|
return gw.ChannelsOut[dest]
|
||||||
@ -118,6 +122,10 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) {
|
|||||||
if gw.ignoreMessage(&msg) {
|
if gw.ignoreMessage(&msg) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// only relay join/part when configged
|
||||||
|
if msg.Event == config.EVENT_JOIN_LEAVE && !gw.Bridges[dest.Account].Config.ShowJoinPart {
|
||||||
|
return
|
||||||
|
}
|
||||||
originchannel := msg.Channel
|
originchannel := msg.Channel
|
||||||
channels := gw.getDestChannel(&msg, dest.Account)
|
channels := gw.getDestChannel(&msg, dest.Account)
|
||||||
for _, channel := range channels {
|
for _, channel := range channels {
|
||||||
|
@ -37,18 +37,6 @@ Nick="matterbot"
|
|||||||
NickServNick="nickserv"
|
NickServNick="nickserv"
|
||||||
NickServPassword="secret"
|
NickServPassword="secret"
|
||||||
|
|
||||||
#RemoteNickFormat defines how remote users appear on this bridge
|
|
||||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
|
||||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
|
||||||
#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge
|
|
||||||
#OPTIONAL (default empty)
|
|
||||||
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
|
||||||
|
|
||||||
#Nicks you want to ignore.
|
|
||||||
#Messages from those users will not be sent to other bridges.
|
|
||||||
#OPTIONAL
|
|
||||||
IgnoreNicks="ircspammer1 ircspammer2"
|
|
||||||
|
|
||||||
#Flood control
|
#Flood control
|
||||||
#Delay in milliseconds between each message send to the IRC server
|
#Delay in milliseconds between each message send to the IRC server
|
||||||
#OPTIONAL (default 1300)
|
#OPTIONAL (default 1300)
|
||||||
@ -60,6 +48,22 @@ MessageDelay=1300
|
|||||||
#OPTIONAL (default 30)
|
#OPTIONAL (default 30)
|
||||||
MessageQueue=30
|
MessageQueue=30
|
||||||
|
|
||||||
|
#Nicks you want to ignore.
|
||||||
|
#Messages from those users will not be sent to other bridges.
|
||||||
|
#OPTIONAL
|
||||||
|
IgnoreNicks="ircspammer1 ircspammer2"
|
||||||
|
|
||||||
|
#RemoteNickFormat defines how remote users appear on this bridge
|
||||||
|
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||||
|
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||||
|
#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge
|
||||||
|
#OPTIONAL (default empty)
|
||||||
|
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
||||||
|
|
||||||
|
#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment)
|
||||||
|
#OPTIONAL (default false)
|
||||||
|
ShowJoinPart=false
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
#XMPP section
|
#XMPP section
|
||||||
###################################################################
|
###################################################################
|
||||||
@ -89,6 +93,21 @@ Muc="conference.jabber.example.com"
|
|||||||
#REQUIRED
|
#REQUIRED
|
||||||
Nick="xmppbot"
|
Nick="xmppbot"
|
||||||
|
|
||||||
|
#Nicks you want to ignore.
|
||||||
|
#Messages from those users will not be sent to other bridges.
|
||||||
|
#OPTIONAL
|
||||||
|
IgnoreNicks="ircspammer1 ircspammer2"
|
||||||
|
|
||||||
|
#RemoteNickFormat defines how remote users appear on this bridge
|
||||||
|
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||||
|
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||||
|
#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge
|
||||||
|
#OPTIONAL (default empty)
|
||||||
|
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
||||||
|
|
||||||
|
#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment)
|
||||||
|
#OPTIONAL (default false)
|
||||||
|
ShowJoinPart=false
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
#mattermost section
|
#mattermost section
|
||||||
@ -150,9 +169,13 @@ NoTLS=false
|
|||||||
#OPTIONAL (default false)
|
#OPTIONAL (default false)
|
||||||
SkipTLSVerify=true
|
SkipTLSVerify=true
|
||||||
|
|
||||||
#Enable to show IRC joins/parts in mattermost.
|
#how to format the list of IRC nicks when displayed in mattermost.
|
||||||
#OPTIONAL (default false)
|
#Possible options are "table" and "plain"
|
||||||
ShowJoinPart=false
|
#OPTIONAL (default plain)
|
||||||
|
NickFormatter="plain"
|
||||||
|
#How many nicks to list per row for formatters that support this.
|
||||||
|
#OPTIONAL (default 4)
|
||||||
|
NicksPerRow=4
|
||||||
|
|
||||||
#Whether to prefix messages from other bridges to mattermost with the sender's nick.
|
#Whether to prefix messages from other bridges to mattermost with the sender's nick.
|
||||||
#Useful if username overrides for incoming webhooks isn't enabled on the
|
#Useful if username overrides for incoming webhooks isn't enabled on the
|
||||||
@ -162,6 +185,11 @@ ShowJoinPart=false
|
|||||||
#OPTIONAL (default false)
|
#OPTIONAL (default false)
|
||||||
PrefixMessagesWithNick=false
|
PrefixMessagesWithNick=false
|
||||||
|
|
||||||
|
#Nicks you want to ignore.
|
||||||
|
#Messages from those users will not be sent to other bridges.
|
||||||
|
#OPTIONAL
|
||||||
|
IgnoreNicks="ircspammer1 ircspammer2"
|
||||||
|
|
||||||
#RemoteNickFormat defines how remote users appear on this bridge
|
#RemoteNickFormat defines how remote users appear on this bridge
|
||||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||||
@ -169,17 +197,9 @@ PrefixMessagesWithNick=false
|
|||||||
#OPTIONAL (default empty)
|
#OPTIONAL (default empty)
|
||||||
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
||||||
|
|
||||||
#how to format the list of IRC nicks when displayed in mattermost.
|
#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment)
|
||||||
#Possible options are "table" and "plain"
|
#OPTIONAL (default false)
|
||||||
#OPTIONAL (default plain)
|
ShowJoinPart=false
|
||||||
NickFormatter="plain"
|
|
||||||
#How many nicks to list per row for formatters that support this.
|
|
||||||
#OPTIONAL (default 4)
|
|
||||||
NicksPerRow=4
|
|
||||||
|
|
||||||
#Nicks you want to ignore. Messages from those users will not be bridged.
|
|
||||||
#OPTIONAL
|
|
||||||
IgnoreNicks="mmbot spammer2"
|
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
#Gitter section
|
#Gitter section
|
||||||
@ -197,9 +217,10 @@ IgnoreNicks="mmbot spammer2"
|
|||||||
#REQUIRED
|
#REQUIRED
|
||||||
Token="Yourtokenhere"
|
Token="Yourtokenhere"
|
||||||
|
|
||||||
#Nicks you want to ignore. Messages of those users will not be bridged.
|
#Nicks you want to ignore.
|
||||||
#OPTIONAL
|
#Messages from those users will not be sent to other bridges.
|
||||||
IgnoreNicks="spammer1 spammer2"
|
#OPTIONAL
|
||||||
|
IgnoreNicks="ircspammer1 ircspammer2"
|
||||||
|
|
||||||
#RemoteNickFormat defines how remote users appear on this bridge
|
#RemoteNickFormat defines how remote users appear on this bridge
|
||||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||||
@ -208,6 +229,10 @@ IgnoreNicks="spammer1 spammer2"
|
|||||||
#OPTIONAL (default empty)
|
#OPTIONAL (default empty)
|
||||||
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
||||||
|
|
||||||
|
#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment)
|
||||||
|
#OPTIONAL (default false)
|
||||||
|
ShowJoinPart=false
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
#slack section
|
#slack section
|
||||||
###################################################################
|
###################################################################
|
||||||
@ -251,21 +276,6 @@ Token="yourslacktoken"
|
|||||||
#OPTIONAL
|
#OPTIONAL
|
||||||
IconURL="https://robohash.org/{NICK}.png?size=48x48"
|
IconURL="https://robohash.org/{NICK}.png?size=48x48"
|
||||||
|
|
||||||
#Whether to prefix messages from other bridges to mattermost with RemoteNickFormat
|
|
||||||
#Useful if username overrides for incoming webhooks isn't enabled on the
|
|
||||||
#slack server. If you set PrefixMessagesWithNick to true, each message
|
|
||||||
#from bridge to Slack will by default be prefixed by "bridge-" + nick. You can,
|
|
||||||
#however, modify how the messages appear, by setting (and modifying) RemoteNickFormat
|
|
||||||
#OPTIONAL (default false)
|
|
||||||
PrefixMessagesWithNick=false
|
|
||||||
|
|
||||||
#RemoteNickFormat defines how remote users appear on this bridge
|
|
||||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
|
||||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
|
||||||
#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge
|
|
||||||
#OPTIONAL (default empty)
|
|
||||||
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
|
||||||
|
|
||||||
#how to format the list of IRC nicks when displayed in slack
|
#how to format the list of IRC nicks when displayed in slack
|
||||||
#Possible options are "table" and "plain"
|
#Possible options are "table" and "plain"
|
||||||
#OPTIONAL (default plain)
|
#OPTIONAL (default plain)
|
||||||
@ -274,9 +284,29 @@ NickFormatter="plain"
|
|||||||
#OPTIONAL (default 4)
|
#OPTIONAL (default 4)
|
||||||
NicksPerRow=4
|
NicksPerRow=4
|
||||||
|
|
||||||
#Nicks you want to ignore. Messages from those users will not be bridged.
|
#Whether to prefix messages from other bridges to mattermost with RemoteNickFormat
|
||||||
#OPTIONAL
|
#Useful if username overrides for incoming webhooks isn't enabled on the
|
||||||
IgnoreNicks="mmbot spammer2"
|
#slack server. If you set PrefixMessagesWithNick to true, each message
|
||||||
|
#from bridge to Slack will by default be prefixed by "bridge-" + nick. You can,
|
||||||
|
#however, modify how the messages appear, by setting (and modifying) RemoteNickFormat
|
||||||
|
#OPTIONAL (default false)
|
||||||
|
PrefixMessagesWithNick=false
|
||||||
|
|
||||||
|
#Nicks you want to ignore.
|
||||||
|
#Messages from those users will not be sent to other bridges.
|
||||||
|
#OPTIONAL
|
||||||
|
IgnoreNicks="ircspammer1 ircspammer2"
|
||||||
|
|
||||||
|
#RemoteNickFormat defines how remote users appear on this bridge
|
||||||
|
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||||
|
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||||
|
#The string "{PROTOCOL}" (case sensitive) will be replaced by the protocol used by the bridge
|
||||||
|
#OPTIONAL (default empty)
|
||||||
|
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
||||||
|
|
||||||
|
#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment)
|
||||||
|
#OPTIONAL (default false)
|
||||||
|
ShowJoinPart=false
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
#discord section
|
#discord section
|
||||||
@ -296,9 +326,10 @@ Token="Yourtokenhere"
|
|||||||
#REQUIRED
|
#REQUIRED
|
||||||
Server="yourservername"
|
Server="yourservername"
|
||||||
|
|
||||||
#Nicks you want to ignore. Messages of those users will not be bridged.
|
#Nicks you want to ignore.
|
||||||
#OPTIONAL
|
#Messages from those users will not be sent to other bridges.
|
||||||
IgnoreNicks="spammer1 spammer2"
|
#OPTIONAL
|
||||||
|
IgnoreNicks="ircspammer1 ircspammer2"
|
||||||
|
|
||||||
#RemoteNickFormat defines how remote users appear on this bridge
|
#RemoteNickFormat defines how remote users appear on this bridge
|
||||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||||
@ -307,6 +338,9 @@ IgnoreNicks="spammer1 spammer2"
|
|||||||
#OPTIONAL (default empty)
|
#OPTIONAL (default empty)
|
||||||
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
|
||||||
|
|
||||||
|
#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment)
|
||||||
|
#OPTIONAL (default false)
|
||||||
|
ShowJoinPart=false
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
#Gateway configuration
|
#Gateway configuration
|
||||||
|
Loading…
Reference in New Issue
Block a user