diff options
author | Wim <wim@42.be> | 2015-10-24 17:25:18 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2015-10-24 17:25:18 +0200 |
commit | 523f6ffb805b5d5d8a4ebde9a174135c7fc96639 (patch) | |
tree | 9ad359f7aafa3f1b57105810f84c069ef42dd8e6 | |
parent | b346ac868b052f07e88cf092d5ee1a04e9f14f81 (diff) | |
download | matterbridge-msglm-523f6ffb805b5d5d8a4ebde9a174135c7fc96639.tar.gz matterbridge-msglm-523f6ffb805b5d5d8a4ebde9a174135c7fc96639.tar.bz2 matterbridge-msglm-523f6ffb805b5d5d8a4ebde9a174135c7fc96639.zip |
Add support for NAMES
-rw-r--r-- | matterbridge.go | 16 |
1 files changed, 16 insertions, 0 deletions
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) } } |