Ignore commands sent before USER rather than disconnecting the client
This commit is contained in:
parent
43f4ee95f4
commit
d1e3b6a46b
3 changed files with 9 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
# AnonIRCd
|
||||
[![Donate](https://img.shields.io/liberapay/receives/rocketnine.space.svg?logo=liberapay)](https://liberapay.com/rocketnine.space)
|
||||
[![Donate via LiberaPay](https://img.shields.io/liberapay/receives/rocketnine.space.svg?logo=liberapay)](https://liberapay.com/rocketnine.space)
|
||||
[![Donate via Patreon](https://img.shields.io/badge/dynamic/json?color=%23e85b46&label=Patreon&query=data.attributes.patron_count&suffix=%20patrons&url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F5252223)](https://www.patreon.com/rocketnine)
|
||||
|
||||
Anonymous IRC daemon
|
||||
|
||||
|
|
2
main.go
2
main.go
|
@ -1,5 +1,5 @@
|
|||
// AnonIRCd - Anonymous IRC daemon
|
||||
// https://github.com/sageru-6ch/anonircd
|
||||
// https://code.rocketnine.space/tslocum/anonircd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
|
10
server.go
10
server.go
|
@ -914,7 +914,7 @@ func (s *Server) handleUserCommand(client string, command string, params []strin
|
|||
|
||||
cl.sendMessage(fmt.Sprintf("%s: %s", params[0], chst))
|
||||
} else {
|
||||
cl.sendMessage("AnonIRCd https://github.com/sageru-6ch/anonircd")
|
||||
cl.sendMessage("AnonIRCd https://code.rocketnine.space/tslocum/anonircd")
|
||||
}
|
||||
return
|
||||
case commandRegister:
|
||||
|
@ -1215,7 +1215,7 @@ func (s *Server) handleRead(c *Client) {
|
|||
c.host = strings.Trim(msg.Params[2], "\"")
|
||||
|
||||
c.writeMessage(irc.RPL_WELCOME, []string{"Welcome to AnonIRC " + c.getPrefix().String()})
|
||||
c.writeMessage(irc.RPL_YOURHOST, []string{"Your host is AnonIRC, running version AnonIRCd https://github.com/sageru-6ch/anonircd"})
|
||||
c.writeMessage(irc.RPL_YOURHOST, []string{"Your host is AnonIRC, running version AnonIRCd https://code.rocketnine.space/tslocum/anonircd"})
|
||||
c.writeMessage(irc.RPL_CREATED, []string{fmt.Sprintf("This server was created %s", time.Unix(s.created, 0).UTC())})
|
||||
c.writeMessage(strings.Join([]string{irc.RPL_MYINFO, c.nick, "AnonIRC", "AnonIRCd", clientModes, channelModes, channelModesWithArg}, " "), []string{})
|
||||
|
||||
|
@ -1263,7 +1263,9 @@ func (s *Server) handleRead(c *Client) {
|
|||
} else if msg.Command == irc.PING {
|
||||
c.writeMessage(irc.PONG+" AnonIRC", []string{msg.Trailing()})
|
||||
} else if c.user == "" {
|
||||
return // Client must send USER before issuing remaining commands
|
||||
// Client must send USER before issuing remaining commands.
|
||||
// Ignore command.
|
||||
continue
|
||||
} else if msg.Command == irc.WHOIS && len(msg.Params) > 0 && len(msg.Params[0]) >= len(prefixAnonymous.Name) && strings.ToLower(msg.Params[0][:len(prefixAnonymous.Name)]) == strings.ToLower(prefixAnonymous.Name) {
|
||||
go func() {
|
||||
whoisindex := 1
|
||||
|
@ -1376,7 +1378,7 @@ func (s *Server) handleWrite(c *Client) {
|
|||
werror := false
|
||||
for msg := range c.writebuffer {
|
||||
if werror {
|
||||
// We experienced a write error, stop writing
|
||||
// We experienced a write error.
|
||||
c.wg.Done()
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue