commit c9f0052129b142f8ae5d3adf12e58ccadda81e3d
Author: Wim <wim@42.be>
Date: Mon Nov 14 22:53:06 2016 +0000
diff --git a/bridge/config/config.go b/bridge/config/config.go
index c577e34..d3d8811 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -812 +817 @@ import (
"strings"
)
+const (
+ EVENT_JOIN_LEAVE = "join_leave"
+)
+
type Message struct {
Text string
Channel string
Username string
Avatar string
Account string
+ Event string
}
type Protocol struct {
diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go
index d6b6c5f..1540c56 100644
--- a/bridge/irc/irc.go
+++ b/bridge/irc/irc.go
@@ -15611 +15624 @@ func (b *Birc) handleNewConnection(event *irc.Event) {
i.SendRaw("PONG :" + e.Message())
flog.Debugf("PING/PONG")
})
+ i.AddCallback("JOIN", b.handleJoinPart)
+ i.AddCallback("PART", b.handleJoinPart)
+ i.AddCallback("QUIT", b.handleJoinPart)
i.AddCallback("*", b.handleOther)
// we are now fully connected
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) {
if strings.Contains(event.Message(), "This nickname is registered") && event.Nick == b.Config.NickServNick {
b.i.Privmsg(b.Config.NickServNick, "IDENTIFY "+b.Config.NickServPassword)
diff --git a/changelog.md b/changelog.md
index 42bca6d..c781506 100644
--- a/changelog.md
+++ b/changelog.md
@@ -19 +117 @@
-# 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
## New features
* Supports mattermost v3.5.0
-# v0.7
+# v0.7.0
## Breaking config changes from 0.6 to 0.7
Matterbridge now uses TOML configuration (https://github.com/toml-lang/toml)
See matterbridge.toml.sample for an example
diff --git a/gateway/gateway.go b/gateway/gateway.go
index 580e129..63da4bb 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -1066 +10610 @@ func (gw *Gateway) mapIgnores() {
func (gw *Gateway) getDestChannel(msg *config.Message, dest string) []string {
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 {
if channel == msg.Channel {
return gw.ChannelsOut[dest]
@@ -1186 +12210 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) {
if gw.ignoreMessage(&msg) {
return
}
+ // only relay join/part when configged
+ if msg.Event == config.EVENT_JOIN_LEAVE && !gw.Bridges[dest.Account].Config.ShowJoinPart {
+ return
+ }
originchannel := msg.Channel
channels := gw.getDestChannel(&msg, dest.Account)
for _, channel := range channels {
diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample
index 3eb0576..831e99f 100644
--- a/matterbridge.toml.sample
+++ b/matterbridge.toml.sample
@@ -3718 +376 @@ Nick="matterbot"
NickServNick="nickserv"
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
#Delay in milliseconds between each message send to the IRC server
#OPTIONAL (default 1300)
@@ -606 +4822 @@ MessageDelay=1300
#OPTIONAL (default 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
###################################################################
@@ -896 +9321 @@ Muc="conference.jabber.example.com"
#REQUIRED
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
@@ -1509 +16913 @@ NoTLS=false
#OPTIONAL (default false)
SkipTLSVerify=true
-#Enable to show IRC joins/parts in mattermost.
-#OPTIONAL (default false)
-ShowJoinPart=false
+#how to format the list of IRC nicks when displayed in mattermost.
+#Possible options are "table" and "plain"
+#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.
#Useful if username overrides for incoming webhooks isn't enabled on the
@@ -1626 +18511 @@ ShowJoinPart=false
#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
@@ -16917 +1979 @@ PrefixMessagesWithNick=false
#OPTIONAL (default empty)
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
-#how to format the list of IRC nicks when displayed in mattermost.
-#Possible options are "table" and "plain"
-#OPTIONAL (default plain)
-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"
+#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment)
+#OPTIONAL (default false)
+ShowJoinPart=false
###################################################################
#Gitter section
@@ -1979 +21710 @@ IgnoreNicks="mmbot spammer2"
#REQUIRED
Token="Yourtokenhere"
-#Nicks you want to ignore. Messages of those users will not be bridged.
-#OPTIONAL
-IgnoreNicks="spammer1 spammer2"
+#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.
@@ -2086 +22910 @@ 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)
+#OPTIONAL (default false)
+ShowJoinPart=false
+
###################################################################
#slack section
###################################################################
@@ -2516 +27614 @@ Token="yourslacktoken"
#OPTIONAL
IconURL="https://robohash.org/{NICK}.png?size=48x48"
+#how to format the list of IRC nicks when displayed in slack
+#Possible options are "table" and "plain"
+#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 RemoteNickFormat
#Useful if username overrides for incoming webhooks isn't enabled on the
#slack server. If you set PrefixMessagesWithNick to true, each message
@@ -2596 +29211 @@ IconURL="https://robohash.org/{NICK}.png?size=48x48"
#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
@@ -26617 +3049 @@ PrefixMessagesWithNick=false
#OPTIONAL (default empty)
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
-#how to format the list of IRC nicks when displayed in slack
-#Possible options are "table" and "plain"
-#OPTIONAL (default plain)
-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"
+#Enable to show users joins/parts from other bridges (only from irc-bridge at the moment)
+#OPTIONAL (default false)
+ShowJoinPart=false
###################################################################
#discord section
@@ -2969 +32610 @@ Token="Yourtokenhere"
#REQUIRED
Server="yourservername"
-#Nicks you want to ignore. Messages of those users will not be bridged.
-#OPTIONAL
-IgnoreNicks="spammer1 spammer2"
+#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.
@@ -3076 +3389 @@ 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)
+#OPTIONAL (default false)
+ShowJoinPart=false
###################################################################
#Gateway configuration