- char buf[512];
- rb_snprintf(buf, sizeof(buf), "is opered as %s, privset %s",
- target_p->localClient->opername, target_p->localClient->privset->name);
- sendto_one_numeric(source_p, RPL_WHOISSPECIAL, form_str(RPL_WHOISSPECIAL),
- target_p->name, buf);
+ if (target_p == source_p || HasPrivilege(source_p, "oper:privs"))
+ {
+ const char *privset = "(missing)";
+ if (target_p->user->privset != NULL)
+ privset = target_p->user->privset->name;
+ snprintf(buf, sizeof buf, "is opered as %s, privset %s", target_p->user->opername, privset);
+ s = buf;
+ }
+ else if (IsOper(source_p) && SeesOper(target_p, source_p))
+ {
+ snprintf(buf, sizeof buf, "is opered as %s", target_p->user->opername);
+ s = buf;
+ }
+ else if (!ConfigFileEntry.hide_opers_in_whois && SeesOper(target_p, source_p))
+ {
+ s = IsAdmin(target_p) ? GlobalSetOptions.adminstring :
+ GlobalSetOptions.operstring;
+ }
+ }
+ if (s != NULL)
+ {
+ sendto_one_numeric(source_p, RPL_WHOISOPERATOR, form_str(RPL_WHOISOPERATOR),
+ target_p->name, s);