From 3b0d9c4db9eb9d75963a78d43f72ed40833c4c9f Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Tue, 26 Sep 2017 07:52:43 +1000 Subject: [PATCH] Send nick parameter correctly on ERR_NOSUCHNICK numerics --- irc/channel.go | 2 +- irc/nickname.go | 2 +- irc/roleplay.go | 2 +- irc/server.go | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/irc/channel.go b/irc/channel.go index 89ec2bd1..6b29ee2e 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -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 } diff --git a/irc/nickname.go b/irc/nickname.go index 97cb40b5..6de714c9 100644 --- a/irc/nickname.go +++ b/irc/nickname.go @@ -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 } diff --git a/irc/roleplay.go b/irc/roleplay.go index 9a7663a6..f2b36b8e 100644 --- a/irc/roleplay.go +++ b/irc/roleplay.go @@ -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 } diff --git a/irc/server.go b/irc/server.go index d908aa74..560d2e39 100644 --- a/irc/server.go +++ b/irc/server.go @@ -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] {