summaryrefslogtreecommitdiffstats
path: root/bridge/irc/irc.go
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/irc/irc.go')
-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)