Add OPERHOST option to /set, which allows you to change the host operators get on oper up (provided they don't have a specific one already defined in their operator block.)
This commit is contained in:
parent
1434082803
commit
67537fefa4
|
@ -1,7 +1,6 @@
|
||||||
Todo list for ShadowIRCd 6.1
|
Todo list for ShadowIRCd 6.1
|
||||||
-----------------------------
|
-----------------------------
|
||||||
* notice/message !#channel and %#channel
|
* notice/message !#channel and %#channel
|
||||||
* Add default_operhost to /set
|
|
||||||
|
|
||||||
Todo list for ShadowIRCd 6.2
|
Todo list for ShadowIRCd 6.2
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct SetOptions
|
||||||
int spam_num;
|
int spam_num;
|
||||||
int spam_time;
|
int spam_time;
|
||||||
|
|
||||||
|
char operhost[REALLEN];
|
||||||
char operstring[REALLEN];
|
char operstring[REALLEN];
|
||||||
char adminstring[REALLEN];
|
char adminstring[REALLEN];
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
#include "s_conf.h"
|
#include "s_conf.h"
|
||||||
|
#include "s_user.h"
|
||||||
#include "s_newconf.h"
|
#include "s_newconf.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
|
@ -71,6 +72,7 @@ static void quote_floodcount(struct Client *, const char *, int);
|
||||||
static void quote_identtimeout(struct Client *, const char *, int);
|
static void quote_identtimeout(struct Client *, const char *, int);
|
||||||
static void quote_max(struct Client *, const char *, int);
|
static void quote_max(struct Client *, const char *, int);
|
||||||
static void quote_operstring(struct Client *, const char *, int);
|
static void quote_operstring(struct Client *, const char *, int);
|
||||||
|
static void quote_operhost(struct Client *, const char *, int);
|
||||||
static void quote_spamnum(struct Client *, const char *, int);
|
static void quote_spamnum(struct Client *, const char *, int);
|
||||||
static void quote_spamtime(struct Client *, const char *, int);
|
static void quote_spamtime(struct Client *, const char *, int);
|
||||||
static void quote_splitmode(struct Client *, const char *, int);
|
static void quote_splitmode(struct Client *, const char *, int);
|
||||||
|
@ -98,6 +100,7 @@ static struct SetStruct set_cmd_table[] = {
|
||||||
{"IDENTTIMEOUT", quote_identtimeout, 0, 1 },
|
{"IDENTTIMEOUT", quote_identtimeout, 0, 1 },
|
||||||
{"MAX", quote_max, 0, 1 },
|
{"MAX", quote_max, 0, 1 },
|
||||||
{"MAXCLIENTS", quote_max, 0, 1 },
|
{"MAXCLIENTS", quote_max, 0, 1 },
|
||||||
|
{"OPERHOST", quote_operhost, 1, 0 },
|
||||||
{"OPERSTRING", quote_operstring, 1, 0 },
|
{"OPERSTRING", quote_operstring, 1, 0 },
|
||||||
{"SPAMNUM", quote_spamnum, 0, 1 },
|
{"SPAMNUM", quote_spamnum, 0, 1 },
|
||||||
{"SPAMTIME", quote_spamtime, 0, 1 },
|
{"SPAMTIME", quote_spamtime, 0, 1 },
|
||||||
|
@ -247,6 +250,29 @@ quote_max(struct Client *source_p, const char *arg, int newval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SET OPERHOST */
|
||||||
|
static void
|
||||||
|
quote_operhost(struct Client *source_p, const char *arg, int newval)
|
||||||
|
{
|
||||||
|
if(EmptyString(arg))
|
||||||
|
{
|
||||||
|
sendto_one_notice(source_p, ":OPERHOST is currently '%s'", GlobalSetOptions.operhost);
|
||||||
|
}
|
||||||
|
else if(!valid_hostname(arg))
|
||||||
|
{
|
||||||
|
sendto_one_notice(source_p, "Invalid hostmask.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rb_strlcpy(GlobalSetOptions.operhost, arg,
|
||||||
|
sizeof(GlobalSetOptions.operhost));
|
||||||
|
|
||||||
|
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||||
|
"%s has changed OPERHOST to '%s'",
|
||||||
|
get_oper_name(source_p), arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* SET OPERSTRING */
|
/* SET OPERSTRING */
|
||||||
static void
|
static void
|
||||||
quote_operstring(struct Client *source_p, const char *arg, int newval)
|
quote_operstring(struct Client *source_p, const char *arg, int newval)
|
||||||
|
|
|
@ -329,6 +329,13 @@ initialize_global_set_options(void)
|
||||||
else
|
else
|
||||||
GlobalSetOptions.ident_timeout = IDENT_TIMEOUT;
|
GlobalSetOptions.ident_timeout = IDENT_TIMEOUT;
|
||||||
|
|
||||||
|
if(ConfigFileEntry.default_operhost)
|
||||||
|
rb_strlcpy(GlobalSetOptions.operhost,
|
||||||
|
ConfigFileEntry.default_operhost,
|
||||||
|
sizeof(GlobalSetOptions.operhost));
|
||||||
|
else
|
||||||
|
rb_strlcpy(GlobalSetOptions.operhost, "", sizeof(GlobalSetOptions.operhost));
|
||||||
|
|
||||||
rb_strlcpy(GlobalSetOptions.operstring,
|
rb_strlcpy(GlobalSetOptions.operstring,
|
||||||
ConfigFileEntry.default_operstring,
|
ConfigFileEntry.default_operstring,
|
||||||
sizeof(GlobalSetOptions.operstring));
|
sizeof(GlobalSetOptions.operstring));
|
||||||
|
|
|
@ -1341,12 +1341,12 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
|
||||||
if(oper_p->operstring)
|
if(oper_p->operstring)
|
||||||
user_metadata_add(source_p, "OPERSTRING", oper_p->operstring, 1);
|
user_metadata_add(source_p, "OPERSTRING", oper_p->operstring, 1);
|
||||||
|
|
||||||
if(oper_p->vhost || !EmptyString(ConfigFileEntry.default_operhost))
|
if(oper_p->vhost || !EmptyString(GlobalSetOptions.operhost))
|
||||||
{
|
{
|
||||||
if(oper_p->vhost)
|
if(oper_p->vhost)
|
||||||
change_nick_user_host(source_p, source_p->name, source_p->username, oper_p->vhost, 0, "Changing host");
|
change_nick_user_host(source_p, source_p->name, source_p->username, oper_p->vhost, 0, "Changing host");
|
||||||
else
|
else
|
||||||
change_nick_user_host(source_p, source_p->name, source_p->username, ConfigFileEntry.default_operhost, 0, "Changing host");
|
change_nick_user_host(source_p, source_p->name, source_p->username, GlobalSetOptions.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_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host (set by %s)", source_p->host, source_p->servptr->name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue