summaryrefslogtreecommitdiffstats
path: root/bridge/irc/irc.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-04-08 00:42:37 +0200
committerWim <wim@42.be>2017-04-08 00:42:37 +0200
commitb469c8ddbda62ceecbd10883e4af1fbfe5d54898 (patch)
treef483ff9c9aa06aa4cd866a03f386492c3a33dcc7 /bridge/irc/irc.go
parenteee0036c7f0d711f0af203bf0fb8dccd42241c1a (diff)
downloadmatterbridge-msglm-b469c8ddbda62ceecbd10883e4af1fbfe5d54898.tar.gz
matterbridge-msglm-b469c8ddbda62ceecbd10883e4af1fbfe5d54898.tar.bz2
matterbridge-msglm-b469c8ddbda62ceecbd10883e4af1fbfe5d54898.zip
Rejoin channel when kicked (irc). Closes #146
Diffstat (limited to 'bridge/irc/irc.go')
-rw-r--r--bridge/irc/irc.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go
index b1041f2a..8f72f0f7 100644
--- a/bridge/irc/irc.go
+++ b/bridge/irc/irc.go
@@ -167,14 +167,19 @@ func (b *Birc) handleNewConnection(event *irc.Event) {
i.AddCallback("JOIN", b.handleJoinPart)
i.AddCallback("PART", b.handleJoinPart)
i.AddCallback("QUIT", b.handleJoinPart)
+ i.AddCallback("KICK", 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 == "KICK" {
+ flog.Infof("Got kicked from %s by %s", channel, event.Nick)
+ b.Remote <- config.Message{Username: "system", Text: "rejoin", Channel: channel, Account: b.Account, Event: config.EVENT_REJOIN_CHANNELS}
+ return
+ }
if event.Code == "QUIT" {
if event.Nick == b.Nick && strings.Contains(event.Raw, "Ping timeout") {
flog.Infof("%s reconnecting ..", b.Account)
@@ -182,6 +187,7 @@ func (b *Birc) handleJoinPart(event *irc.Event) {
return
}
}
+ flog.Debugf("Sending JOIN_LEAVE event from %s to gateway", b.Account)
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)
}