From 61e337b083cb8f3c4bd17c72f79b23cb5ff01739 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 14 Nov 2015 18:54:34 +0300 Subject: [PATCH] ISON command support --- README | 4 ++-- daemon.go | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README b/README index 0a11809..f3a0ec0 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ DESCRIPTION goircd is very simple IRC server, written on Go. -It is heavily inspired by miniircd daemon written on Python. +It was heavily inspired by miniircd daemon written on Python. GoVPN is free software: see the file COPYING for copying conditions. It does not aim to replace full featured mass scalable IRC networks: @@ -35,7 +35,7 @@ SUPPORTED IRC COMMANDS * PASS/NICK/USER during registration workflow * PING/PONGs -* NOTICE/PRIVMSG +* NOTICE/PRIVMSG, ISON * AWAY, MOTD, LUSERS, WHO, WHOIS, VERSION, QUIT * LIST, JOIN, TOPIC, +k/-k channel MODE diff --git a/daemon.go b/daemon.go index c01dbde..be5de5c 100644 --- a/daemon.go +++ b/daemon.go @@ -486,6 +486,22 @@ func Processor(events chan ClientEvent, finished chan struct{}) { cols := strings.Split(cols[1], " ") nicknames := strings.Split(cols[len(cols)-1], ",") SendWhois(client, nicknames) + case "ISON": + if len(cols) == 1 || len(cols[1]) < 1 { + client.ReplyNotEnoughParameters("ISON") + continue + } + nicksKnown := make(map[string]struct{}) + for c := range clients { + nicksKnown[*c.nickname] = struct{}{} + } + var nicksExists []string + for _, nickname := range strings.Split(cols[1], " ") { + if _, exists := nicksKnown[nickname]; exists { + nicksExists = append(nicksExists, nickname) + } + } + client.ReplyNicknamed("303", strings.Join(nicksExists, " ")) case "VERSION": var debug string if *verbose {