diff --git a/server.go b/server.go index f583a4e..58f0728 100644 --- a/server.go +++ b/server.go @@ -230,9 +230,6 @@ func (s *Server) handleCommand(command string, args []string) { } */ - case "PROTOCTL": - // we advertised support for NAMESX, if this happens the client accepted it - case "PASS": // RFC2812 registration. Stash the password for later if len(args) < 1 { @@ -296,6 +293,14 @@ func (s *Server) handleRegisteredCommand(command string, args []string) { } switch command { + case "LIST": + if s.upstream == nil { + s.reply(rplList, fmt.Sprintf("%s %d :%s", BLESSED_CHANNEL, 1, "-")) + } else { + s.reply(rplList, fmt.Sprintf("%s %d :%s", BLESSED_CHANNEL, len(s.upstream.Users), s.upstream.HubName)) + } + s.reply(rplListEnd) + case "JOIN": if len(args) < 1 { s.reply(errMoreArgs) @@ -410,10 +415,9 @@ func (s *Server) handleJoinedCommand(command string, args []string) { s.reply(errNoPriv) // Disallow topic set } - case "LIST": - listItem := fmt.Sprintf("%s %d :%s", BLESSED_CHANNEL, len(s.upstream.Users), s.upstream.HubName) - s.reply(rplList, listItem) - s.reply(rplListEnd) + case "PROTOCTL": + // we advertised support for NAMESX, if this happens the client accepted it + s.sendNames() case "OPER": if len(args) < 2 { @@ -434,8 +438,8 @@ func (s *Server) handleJoinedCommand(command string, args []string) { return } - // s.sendNames() // Ignore what we're "supposed" to do - s.sendWho(args[0]) + // s.sendWho(args[0]) + // s.sendNames() // fixes hexchat, but andchat always sends WHO /immediately/ after NAMES end, causing an infinite loop case "MODE": if len(args) < 1 { @@ -451,6 +455,7 @@ func (s *Server) handleJoinedCommand(command string, args []string) { if len(args) == 1 { // No more args, they just want the mode s.sendChannelMode() + } else { // Setting modes is disallowed s.reply(errNoPriv)