3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-13 07:29:30 +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) casefoldedName, err := CasefoldName(nick)
target := channel.server.clients.Get(casefoldedName) target := channel.server.clients.Get(casefoldedName)
if err != nil || target == nil { 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 return nil
} }

View File

@ -89,7 +89,7 @@ func sanickHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
target := server.clients.Get(oldnick) target := server.clients.Get(oldnick)
if target == nil { 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 return false
} }

View File

@ -99,7 +99,7 @@ func sendRoleplayMessage(server *Server, client *Client, source string, targetSt
target, err := CasefoldName(targetString) target, err := CasefoldName(targetString)
user := server.clients.Get(target) user := server.clients.Get(target)
if err != nil || user == nil { 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 return
} }

View File

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