forked from External/ergo
Merge pull request #1702 from ajaspers/whowas
Show real IP in WHOWAS to opers with ban capability.
This commit is contained in:
commit
f07524111c
4 changed files with 11 additions and 4 deletions
|
|
@ -3416,11 +3416,8 @@ func whowasHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respo
|
|||
count = 0
|
||||
}
|
||||
}
|
||||
//var target string
|
||||
//if len(msg.Params) > 2 {
|
||||
// target = msg.Params[2]
|
||||
//}
|
||||
cnick := client.Nick()
|
||||
canSeeIP := client.Oper().HasRoleCapab("ban")
|
||||
for _, nickname := range nicknames {
|
||||
results := server.whoWas.Find(nickname, count)
|
||||
if len(results) == 0 {
|
||||
|
|
@ -3428,6 +3425,9 @@ func whowasHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respo
|
|||
} else {
|
||||
for _, whoWas := range results {
|
||||
rb.Add(nil, server.name, RPL_WHOWASUSER, cnick, whoWas.nick, whoWas.username, whoWas.hostname, "*", whoWas.realname)
|
||||
if canSeeIP {
|
||||
rb.Add(nil, server.name, RPL_WHOWASIP, cnick, whoWas.nick, fmt.Sprintf(client.t("was connecting from %s"), utils.IPStringToHostname(whoWas.ip.String())))
|
||||
}
|
||||
}
|
||||
}
|
||||
rb.Add(nil, server.name, RPL_ENDOFWHOWAS, cnick, utils.SafeErrorParam(nickname), client.t("End of WHOWAS"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue