Add general::default_operhost.

This commit is contained in:
B.Greenham 2010-03-02 01:57:25 -05:00
parent 1a9821cd51
commit 220c9db54d
7 changed files with 40 additions and 0 deletions

View File

@ -462,6 +462,7 @@ general {
default_operstring = "is an IRC Operator";
default_adminstring = "is a Server Administrator";
default_operhost = "staff.testnet.net";
servicestring = "is a Network Service";
disable_fake_channels = no;
tkline_expire_notices = no;

View File

@ -1004,6 +1004,13 @@ general {
*/
default_adminstring = "is a Server Administrator";
/* default operhost: defines the default virtual host that
* operators will receiving upon opering up. Can be overriden
* by the vhost option in individual operator blocks. This
* must be a valid hostmask.
*/
default_operhost = "staff.testnet.net";
/* servicestring: defines the response for opered services (+S)
* in /whois queries, eg "is a Network Service".
* This is updated on rehash.

View File

@ -138,6 +138,7 @@ struct config_file_entry
char *default_operstring;
char *default_adminstring;
char *default_operhost;
char *servicestring;
char *kline_reason;

View File

@ -151,6 +151,12 @@ static struct InfoStruct info_table[] = {
&ConfigFileEntry.default_operstring,
"Default operstring at startup.",
},
{
"default_operhost",
OUTPUT_STRING,
&ConfigFileEntry.default_operhost,
"Default vhost for operators to receive upon opering up.",
},
{
"servicestring",
OUTPUT_STRING,

View File

@ -2141,6 +2141,7 @@ static struct ConfEntry conf_general_table[] =
{ "default_operstring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_operstring },
{ "default_adminstring",CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_adminstring },
{ "default_operhost", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_operhost },
{ "servicestring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.servicestring },
{ "egdpool_path", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.egdpool_path },
{ "kline_reason", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.kline_reason },

View File

@ -680,6 +680,7 @@ set_default_conf(void)
ConfigFileEntry.default_operstring = rb_strdup("is an IRC operator");
ConfigFileEntry.default_adminstring = rb_strdup("is a Server Administrator");
ConfigFileEntry.default_operhost = rb_strdup("");
ConfigFileEntry.servicestring = rb_strdup("is a Network Service");
ConfigFileEntry.default_umodes = UMODE_INVISIBLE;
@ -876,6 +877,12 @@ validate_conf(void)
splitchecking = 0;
}
if(!valid_hostname(ConfigFileEntry.default_operhost))
{
conf_report_error("Warning -- invalid default_operhost specified, ignoring.");
ConfigFileEntry.default_operhost = rb_strdup("");
}
/* Parse the exemptchanops option and set the internal variables
* that we will use. */
char * ech;

View File

@ -1310,6 +1310,23 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
else
source_p->umodes |= DEFAULT_OPER_UMODES;
if(!EmptyString(ConfigFileEntry.default_operhost))
{
change_nick_user_host(source_p, source_p->name, source_p->username, ConfigFileEntry.default_operhost, 0, "Changing host");
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host (set by %s)", source_p->host, source_p->servptr->name);
sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(source_p), source_p->host);
sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(source_p), source_p->host);
if (!IsDynSpoof(source_p))
SetDynSpoof(source_p);
}
if (oper_p->snomask)
{
source_p->snomask |= oper_p->snomask;