From 523f6ffb805b5d5d8a4ebde9a174135c7fc96639 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 24 Oct 2015 17:25:18 +0200 Subject: Add support for NAMES --- matterbridge.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/matterbridge.go b/matterbridge.go index d6ec67e1..afad75af 100644 --- a/matterbridge.go +++ b/matterbridge.go @@ -39,6 +39,7 @@ func (b *Bridge) createIRC(name string) *irc.Connection { i.AddCallback("JOIN", b.handleJoinPart) i.AddCallback("PART", b.handleJoinPart) } + i.AddCallback("353", b.handleOther) return i } @@ -59,9 +60,24 @@ func (b *Bridge) handleJoinPart(event *irc.Event) { b.m.Send(matterMessage) } +func (b *Bridge) handleOther(event *irc.Event) { + matterMessage := matterhook.OMessage{} + switch event.Code { + case "353": + matterMessage.UserName = b.Config.IRC.Nick + matterMessage.Text = event.Message() + " currently on IRC" + } + b.m.Send(matterMessage) +} + func (b *Bridge) handleMatter() { for { message := b.m.Receive() + switch message.Text { + case "!users": + log.Println("received !users from", message.UserName) + b.i.SendRaw("NAMES " + b.Config.IRC.Channel) + } b.i.Privmsg(b.Config.IRC.Channel, message.UserName+": "+message.Text) } } -- cgit v1.2.3