|
@@ -2878,8 +2878,21 @@ func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
2878
|
2878
|
return false
|
2879
|
2879
|
}
|
2880
|
2880
|
|
|
2881
|
+// does `target` have an operator status that is visible to `client`?
|
|
2882
|
+func operStatusVisible(client, target *Client, hasPrivs bool) bool {
|
|
2883
|
+ targetOper := target.Oper()
|
|
2884
|
+ if targetOper == nil {
|
|
2885
|
+ return false
|
|
2886
|
+ }
|
|
2887
|
+ if client == target || hasPrivs {
|
|
2888
|
+ return true
|
|
2889
|
+ }
|
|
2890
|
+ return !targetOper.Hidden
|
|
2891
|
+}
|
|
2892
|
+
|
2881
|
2893
|
// USERHOST <nickname>{ <nickname>}
|
2882
|
2894
|
func userhostHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
|
2895
|
+ hasPrivs := client.HasMode(modes.Operator) // TODO(#1176) figure out the right capab for this
|
2883
|
2896
|
returnedClients := make(ClientSet)
|
2884
|
2897
|
|
2885
|
2898
|
var tl utils.TokenLineBuilder
|
|
@@ -2901,7 +2914,7 @@ func userhostHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *
|
2901
|
2914
|
|
2902
|
2915
|
var isOper, isAway string
|
2903
|
2916
|
|
2904
|
|
- if target.HasMode(modes.Operator) {
|
|
2917
|
+ if operStatusVisible(client, target, hasPrivs) {
|
2905
|
2918
|
isOper = "*"
|
2906
|
2919
|
}
|
2907
|
2920
|
if away, _ := target.Away(); away {
|
|
@@ -3061,7 +3074,7 @@ func (client *Client) rplWhoReply(channel *Channel, target *Client, rb *Response
|
3061
|
3074
|
flags.WriteRune('H') // Here
|
3062
|
3075
|
}
|
3063
|
3076
|
|
3064
|
|
- if target.HasMode(modes.Operator) && target.Oper().Visible(hasPrivs) {
|
|
3077
|
+ if target.HasMode(modes.Operator) && operStatusVisible(client, target, hasPrivs) {
|
3065
|
3078
|
flags.WriteRune('*')
|
3066
|
3079
|
}
|
3067
|
3080
|
|