mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
fix #994
This commit is contained in:
parent
d187cc5512
commit
6f688a4644
@ -661,12 +661,7 @@ func (client *Client) run(session *Session) {
|
|||||||
|
|
||||||
cmd, exists := Commands[msg.Command]
|
cmd, exists := Commands[msg.Command]
|
||||||
if !exists {
|
if !exists {
|
||||||
if len(msg.Command) > 0 {
|
cmd = unknownCommand
|
||||||
session.Send(nil, client.server.name, ERR_UNKNOWNCOMMAND, client.Nick(), msg.Command, client.t("Unknown command"))
|
|
||||||
} else {
|
|
||||||
session.Send(nil, client.server.name, ERR_UNKNOWNCOMMAND, client.Nick(), "lastcmd", client.t("No command given"))
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isExiting := cmd.Run(client.server, client, session, msg)
|
isExiting := cmd.Run(client.server, client, session, msg)
|
||||||
|
@ -73,6 +73,12 @@ func (cmd *Command) Run(server *Server, client *Client, session *Session, msg ir
|
|||||||
return exiting
|
return exiting
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fake handler for unknown commands (see #994: this ensures the response tags are correct)
|
||||||
|
var unknownCommand = Command{
|
||||||
|
handler: unknownCommandHandler,
|
||||||
|
usablePreReg: true,
|
||||||
|
}
|
||||||
|
|
||||||
// Commands holds all commands executable by a client connected to us.
|
// Commands holds all commands executable by a client connected to us.
|
||||||
var Commands map[string]Command
|
var Commands map[string]Command
|
||||||
|
|
||||||
|
@ -2760,3 +2760,9 @@ func zncHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
|
|||||||
zncModuleHandler(client, msg.Params[0], msg.Params[1:], rb)
|
zncModuleHandler(client, msg.Params[0], msg.Params[1:], rb)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fake handler for unknown commands
|
||||||
|
func unknownCommandHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
||||||
|
rb.Add(nil, server.name, ERR_UNKNOWNCOMMAND, client.Nick(), utils.SafeErrorParam(msg.Command), client.t("Unknown command"))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user