From 71c955336ece2e27ffc657853d292e7bc6f48d84 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 15 Jan 2016 13:38:40 -0600 Subject: [PATCH] ircd: add general::hide_opers_in_whois to simulate ircd-seven operhide --- doc/ircd.conf.example | 1 + doc/reference.conf | 3 +++ include/s_conf.h | 2 ++ ircd/newconf.c | 1 + ircd/s_conf.c | 1 + modules/m_whois.c | 2 +- 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/ircd.conf.example b/doc/ircd.conf.example index 5f03d4d3..79e58388 100755 --- a/doc/ircd.conf.example +++ b/doc/ircd.conf.example @@ -546,6 +546,7 @@ general { max_ratelimit_tokens = 30; away_interval = 30; certfp_method = sha1; + hide_opers_in_whois = no; }; modules { diff --git a/doc/reference.conf b/doc/reference.conf index 2eb395fa..b3ff2580 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -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 { diff --git a/include/s_conf.h b/include/s_conf.h index fa490b6e..3d9a65e4 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -237,6 +237,8 @@ struct config_file_entry unsigned int nicklen; int certfp_method; + + int hide_opers_in_whois; }; struct config_channel_entry diff --git a/ircd/newconf.c b/ircd/newconf.c index 19b9d24d..6ec62dc8 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -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 } }; diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 214fc553..45f3d7d5 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -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); diff --git a/modules/m_whois.c b/modules/m_whois.c index 63c6a927..b9967fc0 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -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,