mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 18:52:41 +01:00
move a check, avoiding a crash
This commit is contained in:
parent
240f121e5e
commit
71e82a9ccf
@ -327,11 +327,7 @@ func (client *Client) applyUserModeChanges(force bool, changes ModeChanges) Mode
|
||||
// MODE <target> [<modestring> [<mode arguments>...]]
|
||||
func umodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
||||
nickname, err := CasefoldName(msg.Params[0])
|
||||
|
||||
target := server.clients.Get(nickname)
|
||||
targetNick := target.getNick()
|
||||
hasPrivs := client == target || msg.Command == "SAMODE"
|
||||
|
||||
if err != nil || target == nil {
|
||||
if len(msg.Params[0]) > 0 {
|
||||
client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, msg.Params[0], "No such nick")
|
||||
@ -339,6 +335,9 @@ func umodeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
targetNick := target.getNick()
|
||||
hasPrivs := client == target || msg.Command == "SAMODE"
|
||||
|
||||
if !hasPrivs {
|
||||
if len(msg.Params) > 1 {
|
||||
client.Send(nil, server.name, ERR_USERSDONTMATCH, client.nick, "Can't change modes for other users")
|
||||
|
Loading…
Reference in New Issue
Block a user