mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 03:02:48 +01:00
Merge pull request #991 from ajaspers/who_invisible
Hide +i users from WHO * queries.
This commit is contained in:
commit
d187cc5512
@ -2637,10 +2637,32 @@ func whoHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Construct set of channels the client is in.
|
||||||
|
userChannels := make(map[*Channel]bool)
|
||||||
|
for _, channel := range client.Channels() {
|
||||||
|
userChannels[channel] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Another client is a friend if they share at least one channel, or they are the same client.
|
||||||
|
isFriend := func(otherClient *Client) bool {
|
||||||
|
if client == otherClient {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, channel := range otherClient.Channels() {
|
||||||
|
if userChannels[channel] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
for mclient := range server.clients.FindAll(mask) {
|
for mclient := range server.clients.FindAll(mask) {
|
||||||
|
if isOper || !mclient.HasMode(modes.Invisible) || isFriend(mclient) {
|
||||||
client.rplWhoReply(nil, mclient, rb)
|
client.rplWhoReply(nil, mclient, rb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rb.Add(nil, server.name, RPL_ENDOFWHO, client.nick, mask, client.t("End of WHO list"))
|
rb.Add(nil, server.name, RPL_ENDOFWHO, client.nick, mask, client.t("End of WHO list"))
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user