summaryrefslogtreecommitdiffstats
path: root/bridge/irc
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-11-14 22:53:06 +0100
committerWim <wim@42.be>2016-11-14 22:53:06 +0100
commit449ed31e25f2c21ac9db258999a5a893889983eb (patch)
treefea6132df575adc0b6318475eaea5fc3e4f17ab6 /bridge/irc
parent1f3690458885ada309be4737e4afb7bb5ecc7ad5 (diff)
downloadmatterbridge-msglm-449ed31e25f2c21ac9db258999a5a893889983eb.tar.gz
matterbridge-msglm-449ed31e25f2c21ac9db258999a5a893889983eb.tar.bz2
matterbridge-msglm-449ed31e25f2c21ac9db258999a5a893889983eb.zip
Fix ShowJoinPart from irc bridge. Closes #72
Diffstat (limited to 'bridge/irc')
-rw-r--r--bridge/irc/irc.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go
index d6b6c5f6..1540c56f 100644
--- a/bridge/irc/irc.go
+++ b/bridge/irc/irc.go
@@ -156,11 +156,24 @@ 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)