summaryrefslogtreecommitdiffstats
path: root/gateway
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-02-17 22:43:04 +0100
committerGitHub <noreply@github.com>2019-02-17 22:43:04 +0100
commitd76a04bd0a96772cec5b279aaa1ee45235adc707 (patch)
tree1e74cb1f6858aee185c170b40eab52b697f910d9 /gateway
parenta8fe54a78d869ce4185ff8f25e90fd87035002ec (diff)
downloadmatterbridge-msglm-d76a04bd0a96772cec5b279aaa1ee45235adc707.tar.gz
matterbridge-msglm-d76a04bd0a96772cec5b279aaa1ee45235adc707.tar.bz2
matterbridge-msglm-d76a04bd0a96772cec5b279aaa1ee45235adc707.zip
Support quits from irc correctly. Fixes #722 (#724)
Diffstat (limited to 'gateway')
-rw-r--r--gateway/gateway.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go
index f74a6680..8b3ccf05 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -176,7 +176,6 @@ func (gw *Gateway) getDestChannel(msg *config.Message, dest bridge.Bridge) []con
// discord join/leave is for the whole bridge, isn't a per channel join/leave
if msg.Event == config.EventJoinLeave && dest.Protocol == "discord" && msg.Account == dest.Account {
- flog.Error("here")
for _, channel := range gw.Channels {
if channel.Account == msg.Account && strings.Contains(channel.Direction, "out") &&
gw.validGatewayDest(msg) {
@@ -186,6 +185,18 @@ func (gw *Gateway) getDestChannel(msg *config.Message, dest bridge.Bridge) []con
return channels
}
+ // irc quit is for the whole bridge, isn't a per channel quit.
+ // channel is empty when we quit
+ if msg.Event == config.EventJoinLeave && getProtocol(msg) == "irc" && msg.Channel == "" {
+ for _, channel := range gw.Channels {
+ if channel.Account == dest.Account && strings.Contains(channel.Direction, "out") &&
+ gw.validGatewayDest(msg) {
+ channels = append(channels, *channel)
+ }
+ }
+ return channels
+ }
+
// if source channel is in only, do nothing
for _, channel := range gw.Channels {
// lookup the channel from the message
@@ -435,3 +446,8 @@ func (gw *Gateway) ignoreText(text string, input []string) bool {
}
return false
}
+
+func getProtocol(msg *config.Message) string {
+ p := strings.Split(msg.Account, ".")
+ return p[0]
+}