mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
Merge pull request #991 from ajaspers/who_invisible
Hide +i users from WHO * queries.
This commit is contained in:
commit
d187cc5512
@ -2637,8 +2637,30 @@ func whoHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
|
||||
}
|
||||
}
|
||||
} 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) {
|
||||
client.rplWhoReply(nil, mclient, rb)
|
||||
if isOper || !mclient.HasMode(modes.Invisible) || isFriend(mclient) {
|
||||
client.rplWhoReply(nil, mclient, rb)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user