ircd: add general::hide_opers_in_whois to simulate ircd-seven operhide

This commit is contained in:
William Pitcock 2016-01-15 13:38:40 -06:00
parent 161ac1c8d5
commit 71c955336e
6 changed files with 9 additions and 1 deletions

View file

@ -546,6 +546,7 @@ general {
max_ratelimit_tokens = 30;
away_interval = 30;
certfp_method = sha1;
hide_opers_in_whois = no;
};
modules {

View file

@ -1337,6 +1337,9 @@ general {
* prior to charybdis 3.5 MUST use sha1 for certfp_method.
*/
certfp_method = sha1;
/* hide_opers_in_whois: if set to YES, then oper status will be hidden in /WHOIS output. */
hide_opers_in_whois = no;
};
modules {

View file

@ -237,6 +237,8 @@ struct config_file_entry
unsigned int nicklen;
int certfp_method;
int hide_opers_in_whois;
};
struct config_channel_entry

View file

@ -2428,6 +2428,7 @@ static struct ConfEntry conf_general_table[] =
{ "client_flood_message_time", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_time },
{ "max_ratelimit_tokens", CF_INT, NULL, 0, &ConfigFileEntry.max_ratelimit_tokens },
{ "away_interval", CF_INT, NULL, 0, &ConfigFileEntry.away_interval },
{ "hide_opers_in_whois", CF_YESNO, NULL, 0, &ConfigFileEntry.hide_opers_in_whois },
{ "certfp_method", CF_STRING, conf_set_general_certfp_method, 0, NULL },
{ "\0", 0, NULL, 0, NULL }
};

View file

@ -825,6 +825,7 @@ set_default_conf(void)
ConfigFileEntry.nicklen = NICKLEN;
ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_SHA1;
ConfigFileEntry.hide_opers_in_whois = 0;
if (!alias_dict)
alias_dict = irc_dictionary_create("alias", strcasecmp);

View file

@ -317,7 +317,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
sendto_one_numeric(source_p, RPL_AWAY, form_str(RPL_AWAY),
target_p->name, target_p->user->away);
if(IsOper(target_p))
if(IsOper(target_p) && (!ConfigFileEntry.hide_opers_in_whois || source_p == target_p))
{
sendto_one_numeric(source_p, RPL_WHOISOPERATOR, form_str(RPL_WHOISOPERATOR),
target_p->name,