From 4ec2881ceef8e6fb11b3e0177a543c0dfb95215a Mon Sep 17 00:00:00 2001 From: "." <.@.> Date: Sat, 7 May 2016 19:09:45 +1200 Subject: [PATCH] isolate command processing --HG-- branch : nmdc-ircfrontend --- TODO.txt | 2 ++ server.go | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/TODO.txt b/TODO.txt index 597695d..520526d 100644 --- a/TODO.txt +++ b/TODO.txt @@ -56,6 +56,8 @@ REF https://www.alien.net.au/irc/irc2numerics.html +http://faerion.sourceforge.net/doc/irc/whox.var + http://www.anta.net/misc/telnet-troubleshooting/irc.shtml https://tools.ietf.org/html/rfc2812 diff --git a/server.go b/server.go index 565ab45..5c4254d 100644 --- a/server.go +++ b/server.go @@ -330,6 +330,19 @@ func (s *Server) handleRegisteredCommand(command string, args []string) { s.DisconnectClient() } + default: + s.handleJoinedCommand(command, args) + } +} + +func (s *Server) handleJoinedCommand(command string, args []string) { + + if s.clientState != CSJoined { + s.reply(errNotReg) + return + } + + switch command { case "PART": if len(args) < 1 { s.reply(errMoreArgs)