3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-23 03:02:48 +01:00

Send nick parameter correctly on ERR_NOSUCHNICK numerics

This commit is contained in:
Daniel Oaks 2017-09-26 07:52:43 +10:00
parent 1ccdd67a45
commit 3b0d9c4db9
4 changed files with 11 additions and 11 deletions

View File

@ -569,7 +569,7 @@ func (channel *Channel) applyModeMemberNoMutex(client *Client, mode Mode,
casefoldedName, err := CasefoldName(nick)
target := channel.server.clients.Get(casefoldedName)
if err != nil || target == nil {
client.Send(nil, client.server.name, ERR_NOSUCHNICK, nick, "No such nick")
client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, nick, "No such nick")
return nil
}

View File

@ -89,7 +89,7 @@ func sanickHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
target := server.clients.Get(oldnick)
if target == nil {
client.Send(nil, server.name, ERR_NOSUCHNICK, msg.Params[0], "No such nick")
client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, msg.Params[0], "No such nick")
return false
}

View File

@ -99,7 +99,7 @@ func sendRoleplayMessage(server *Server, client *Client, source string, targetSt
target, err := CasefoldName(targetString)
user := server.clients.Get(target)
if err != nil || user == nil {
client.Send(nil, server.name, ERR_NOSUCHNICK, target, "No such nick")
client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, target, "No such nick")
return
}

View File

@ -1083,7 +1083,7 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
user := server.clients.Get(target)
if err != nil || user == nil {
if len(target) > 0 {
client.Send(nil, server.name, ERR_NOSUCHNICK, target, "No such nick")
client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, target, "No such nick")
}
continue
}
@ -1150,7 +1150,7 @@ func tagmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
user := server.clients.Get(target)
if err != nil || user == nil {
if len(target) > 0 {
client.Send(nil, server.name, ERR_NOSUCHNICK, target, "No such nick")
client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, target, "No such nick")
}
continue
}
@ -1214,12 +1214,12 @@ func whoisHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
for _, mask := range masks {
casefoldedMask, err := Casefold(mask)
if err != nil {
client.Send(nil, client.server.name, ERR_NOSUCHNICK, mask, "No such nick")
client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, mask, "No such nick")
continue
}
matches := server.clients.FindAll(casefoldedMask)
if len(matches) == 0 {
client.Send(nil, client.server.name, ERR_NOSUCHNICK, mask, "No such nick")
client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, mask, "No such nick")
continue
}
for mclient := range matches {
@ -1231,7 +1231,7 @@ func whoisHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
casefoldedMask, err := Casefold(strings.Split(masksString, ",")[0])
mclient := server.clients.Get(casefoldedMask)
if err != nil || mclient == nil {
client.Send(nil, client.server.name, ERR_NOSUCHNICK, masksString, "No such nick")
client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, masksString, "No such nick")
// fall through, ENDOFWHOIS is always sent
} else {
client.getWhoisOf(mclient)
@ -1849,7 +1849,7 @@ func kickHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
casefoldedNickname, err := CasefoldName(nickname)
target := server.clients.Get(casefoldedNickname)
if err != nil || target == nil {
client.Send(nil, server.name, ERR_NOSUCHNICK, nickname, "No such nick")
client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, nickname, "No such nick")
continue
}
@ -2118,7 +2118,7 @@ func killHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
casefoldedNickname, err := CasefoldName(nickname)
target := server.clients.Get(casefoldedNickname)
if err != nil || target == nil {
client.Send(nil, client.server.name, ERR_NOSUCHNICK, nickname, "No such nick")
client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, nickname, "No such nick")
return false
}
@ -2198,7 +2198,7 @@ func userhostHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
casefoldedNickname, err := CasefoldName(nickname)
target := server.clients.Get(casefoldedNickname)
if err != nil || target == nil {
client.Send(nil, client.server.name, ERR_NOSUCHNICK, nickname, "No such nick")
client.Send(nil, client.server.name, ERR_NOSUCHNICK, client.nick, nickname, "No such nick")
return false
}
if returnedNicks[casefoldedNickname] {