mirror of
https://github.com/anope/anope.git
synced 2026-06-30 06:16:38 +02:00
Removed is_host_setter() and is_host_remover() from code and replaced them with opertype priv "hostserv/set", removed <hostserv:hostsetters> from configuration.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2260 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -1062,16 +1062,6 @@ hostserv
|
||||
* to the base names of the modules for HostServ. This directive is optional, but highly recommended.
|
||||
*/
|
||||
modules = "hs_help hs_on hs_off hs_group hs_list hs_set hs_setall hs_del hs_delall"
|
||||
|
||||
/*
|
||||
* Specifies the nicks of NON-OPERS allowed to set or remove vHosts using HostServ. Can be re-loaded
|
||||
* with /msg operserv reload. You can specify more than one nick by separating each one by a space.
|
||||
*
|
||||
* This directive is optional, but you are discouraged from using it. It is recommended that you only
|
||||
* give opers the ability to set or remove vHosts by making them Services Opers or higher, but if you
|
||||
* do decide to use this directive, make sure you insert the correct nick(s) here.
|
||||
*/
|
||||
#hostsetters = "CyberBotX w00t"
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -284,9 +284,6 @@ E bool RestrictOperNicks;
|
||||
E unsigned NewsCount;
|
||||
E char *Numeric;
|
||||
|
||||
E char **HostSetters;
|
||||
E int HostNumber;
|
||||
|
||||
E bool UseMail;
|
||||
E char *SendMailPath;
|
||||
E char *SendFrom;
|
||||
@@ -467,8 +464,6 @@ E void hostserv_init();
|
||||
E void addHostCore(const char *nick, char *vIdent, char *vhost, const char *creator, int32 tmp_time);
|
||||
E char *getvIdent(char *nick);
|
||||
E char *getvHost(char *nick);
|
||||
E int is_host_remover(User * u);
|
||||
E int is_host_setter(User *u);
|
||||
E HostCore *hostCoreListHead();
|
||||
E HostCore *findHostCore(HostCore * head, const char *nick, bool *found);
|
||||
E HostCore *createHostCorelist(HostCore * next, const char *nick, char *vIdent, char *vHost, const char *creator, int32 tmp_time);
|
||||
|
||||
@@ -66,10 +66,6 @@ char *BotDBName;
|
||||
char *OperDBName;
|
||||
char *NewsDBName;
|
||||
|
||||
static char *HostSetter;
|
||||
char **HostSetters;
|
||||
int HostNumber = 0; /* needs to be set to 0 */
|
||||
|
||||
bool NoBackupOkay;
|
||||
bool StrictPasswords;
|
||||
unsigned BadPassLimit;
|
||||
@@ -892,7 +888,6 @@ int ServerConfig::Read(bool bail)
|
||||
{"hostserv", "description", "vHost Service", new ValueContainerChar(&desc_HostServ), DT_CHARPTR | DT_NORELOAD, ValidateHostServ},
|
||||
{"hostserv", "database", "hosts.db", new ValueContainerChar(&HostDBName), DT_CHARPTR, ValidateHostServ},
|
||||
{"hostserv", "modules", "", new ValueContainerChar(&HostCoreModules), DT_CHARPTR, NoValidation},
|
||||
{"hostserv", "hostsetters", "", new ValueContainerChar(&HostSetter), DT_CHARPTR, NoValidation},
|
||||
{"operserv", "nick", "OperServ", new ValueContainerChar(&s_OperServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
|
||||
{"operserv", "description", "Operator Service", new ValueContainerChar(&desc_OperServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
|
||||
{"operserv", "globalnick", "Global", new ValueContainerChar(&s_GlobalNoticer), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
|
||||
@@ -1788,9 +1783,6 @@ int read_config(int reload)
|
||||
} while ((s = strtok(NULL, " ")));
|
||||
}
|
||||
|
||||
/* Host Setters building... :P */
|
||||
HostSetters = buildStringList(HostSetter ? HostSetter : "", &HostNumber);
|
||||
|
||||
/* Modules Autoload building... :P */
|
||||
ModulesAutoload = buildStringList(Modules, &ModulesNumber);
|
||||
HostServCoreModules =
|
||||
|
||||
+7
-5
@@ -26,6 +26,12 @@ class CommandHSDel : public Command
|
||||
|
||||
CommandReturn Execute(User *u, std::vector<std::string> ¶ms)
|
||||
{
|
||||
if (!u->nc->HasPriv("hostserv/set"))
|
||||
{
|
||||
notice_lang(s_HostServ, u, ACCESS_DENIED);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
NickAlias *na;
|
||||
const char *nick = params[0].c_str();
|
||||
if ((na = findnick(nick)))
|
||||
@@ -46,9 +52,6 @@ class CommandHSDel : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_host_remover(u))
|
||||
return false;
|
||||
|
||||
notice_help(s_HostServ, u, HOST_HELP_DEL);
|
||||
return true;
|
||||
}
|
||||
@@ -80,8 +83,7 @@ class HSDel : public Module
|
||||
**/
|
||||
void myHostServHelp(User *u)
|
||||
{
|
||||
if (is_host_remover(u))
|
||||
notice_lang(s_HostServ, u, HOST_HELP_CMD_DEL);
|
||||
notice_lang(s_HostServ, u, HOST_HELP_CMD_DEL);
|
||||
}
|
||||
|
||||
MODULE_INIT("hs_del", HSDel)
|
||||
|
||||
@@ -26,6 +26,12 @@ class CommandHSDelAll : public Command
|
||||
|
||||
CommandReturn Execute(User *u, std::vector<std::string> ¶ms)
|
||||
{
|
||||
if (!u->nc->HasPriv("hostserv/set"))
|
||||
{
|
||||
notice_lang(s_HostServ, u, ACCESS_DENIED);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
int i;
|
||||
const char *nick = params[0].c_str();
|
||||
NickAlias *na;
|
||||
@@ -53,9 +59,6 @@ class CommandHSDelAll : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_host_remover(u))
|
||||
return false;
|
||||
|
||||
notice_help(s_HostServ, u, HOST_HELP_DELALL);
|
||||
return true;
|
||||
}
|
||||
@@ -87,8 +90,7 @@ class HSDelAll : public Module
|
||||
**/
|
||||
void myHostServHelp(User *u)
|
||||
{
|
||||
if (is_host_remover(u))
|
||||
notice_lang(s_HostServ, u, HOST_HELP_CMD_DELALL);
|
||||
notice_lang(s_HostServ, u, HOST_HELP_CMD_DELALL);
|
||||
}
|
||||
|
||||
MODULE_INIT("hs_delall", HSDelAll)
|
||||
|
||||
+7
-5
@@ -26,6 +26,12 @@ class CommandHSSet : public Command
|
||||
|
||||
CommandReturn Execute(User *u, std::vector<std::string> ¶ms)
|
||||
{
|
||||
if (!u->nc->HasPriv("hostserv/set"))
|
||||
{
|
||||
notice_lang(s_HostServ, u, ACCESS_DENIED);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
const char *nick = params[0].c_str();
|
||||
const char *rawhostmask = params[1].c_str();
|
||||
char *hostmask = new char[HOSTMAX];
|
||||
@@ -143,9 +149,6 @@ class CommandHSSet : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_host_setter(u))
|
||||
return false;
|
||||
|
||||
notice_help(s_HostServ, u, HOST_HELP_SET);
|
||||
return true;
|
||||
}
|
||||
@@ -177,8 +180,7 @@ class HSSet : public Module
|
||||
**/
|
||||
void myHostServHelp(User *u)
|
||||
{
|
||||
if (is_host_setter(u))
|
||||
notice_lang(s_HostServ, u, HOST_HELP_CMD_SET);
|
||||
notice_lang(s_HostServ, u, HOST_HELP_CMD_SET);
|
||||
}
|
||||
|
||||
MODULE_INIT("hs_set", HSSet)
|
||||
|
||||
@@ -27,6 +27,12 @@ class CommandHSSetAll : public Command
|
||||
|
||||
CommandReturn Execute(User *u, std::vector<std::string> ¶ms)
|
||||
{
|
||||
if (!u->nc->HasPriv("hostserv/set"))
|
||||
{
|
||||
notice_lang(s_HostServ, u, ACCESS_DENIED);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
const char *nick = params[0].c_str();
|
||||
const char *rawhostmask = params[1].c_str();
|
||||
char *hostmask = new char[HOSTMAX];
|
||||
@@ -143,9 +149,6 @@ class CommandHSSetAll : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_host_setter(u))
|
||||
return false;
|
||||
|
||||
notice_help(s_HostServ, u, HOST_HELP_SETALL);
|
||||
return true;
|
||||
}
|
||||
@@ -176,8 +179,7 @@ class HSSetAll : public Module
|
||||
**/
|
||||
void myHostServHelp(User *u)
|
||||
{
|
||||
if (is_host_setter(u))
|
||||
notice_lang(s_HostServ, u, HOST_HELP_CMD_SETALL);
|
||||
notice_lang(s_HostServ, u, HOST_HELP_CMD_SETALL);
|
||||
}
|
||||
|
||||
MODULE_INIT("hs_setall", HSSetAll)
|
||||
|
||||
@@ -514,35 +514,6 @@ int do_on_id(User * u)
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
int is_host_setter(User * u)
|
||||
{
|
||||
int i, j;
|
||||
NickAlias *na;
|
||||
|
||||
if (u->nc && u->nc->IsServicesOper()) {
|
||||
return 1;
|
||||
}
|
||||
if (!nick_identified(u)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Look through all user's aliases (0000412) */
|
||||
for (i = 0; i < u->nc->aliases.count; i++) {
|
||||
na = static_cast<NickAlias *>(u->nc->aliases.list[i]);
|
||||
for (j = 0; j < HostNumber; j++) {
|
||||
if (stricmp(HostSetters[j], na->nick) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int is_host_remover(User * u)
|
||||
{
|
||||
return is_host_setter(u); /* only here incase we want to split them up later */
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the last_usermak properly. Using virtual ident and/or host
|
||||
|
||||
+21
-12
@@ -210,6 +210,12 @@ class CommandHSActivate : public Command
|
||||
|
||||
CommandReturn Execute(User *u, std::vector<std::string> ¶ms)
|
||||
{
|
||||
if (!u->nc->HasPriv("hostserv/set"))
|
||||
{
|
||||
notice_lang(s_HostServ, u, ACCESS_DENIED);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
const char *nick = params[0].c_str();
|
||||
NickAlias *na;
|
||||
HostCore *tmp, *hc;
|
||||
@@ -245,9 +251,6 @@ class CommandHSActivate : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_host_setter(u))
|
||||
return false;
|
||||
|
||||
me->NoticeLang(s_HostServ, u, LNG_ACTIVATE_SYNTAX);
|
||||
ircdproto->SendMessage(findbot(s_HostServ), u->nick, " ");
|
||||
me->NoticeLang(s_HostServ, u, LNG_HELP_ACTIVATE);
|
||||
@@ -272,6 +275,12 @@ class CommandHSReject : public Command
|
||||
|
||||
CommandReturn Execute(User *u, std::vector<std::string> ¶ms)
|
||||
{
|
||||
if (!u->nc->HasPriv("hostserv/set"))
|
||||
{
|
||||
notice_lang(s_HostServ, u, ACCESS_DENIED);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
const char *nick = params[0].c_str();
|
||||
const char *reason = params.size() > 1 ? params[1].c_str() : NULL;
|
||||
HostCore *tmp, *hc;
|
||||
@@ -305,9 +314,6 @@ class CommandHSReject : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_host_setter(u))
|
||||
return false;
|
||||
|
||||
me->NoticeLang(s_HostServ, u, LNG_REJECT_SYNTAX);
|
||||
ircdproto->SendMessage(findbot(s_HostServ), u->nick, " ");
|
||||
me->NoticeLang(s_HostServ, u, LNG_HELP_REJECT);
|
||||
@@ -328,6 +334,12 @@ class HSListBase : public Command
|
||||
protected:
|
||||
CommandReturn DoList(User *u, std::vector<std::string> ¶ms)
|
||||
{
|
||||
if (!u->nc->HasPriv("hostserv/set"))
|
||||
{
|
||||
notice_lang(s_HostServ, u, ACCESS_DENIED);
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
struct tm *tm;
|
||||
char buf[BUFSIZE];
|
||||
int counter = 1;
|
||||
@@ -380,9 +392,6 @@ class CommandHSWaiting : public HSListBase
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_host_setter(u))
|
||||
return false;
|
||||
|
||||
me->NoticeLang(s_HostServ, u, LNG_WAITING_SYNTAX);
|
||||
ircdproto->SendMessage(findbot(s_HostServ), u->nick, " ");
|
||||
me->NoticeLang(s_HostServ, u, LNG_HELP_WAITING);
|
||||
@@ -829,8 +838,9 @@ void req_send_memos(User *u, char *vIdent, char *vHost)
|
||||
}
|
||||
if (HSRequestMemoSetters == 1)
|
||||
{
|
||||
/* Needs to be rethought because of removal of HostSetters in favor of opertype priv -- CyberBotX
|
||||
for (i = 0; i < HostNumber; ++i)
|
||||
my_memo_lang(u, HostSetters[i], z, LNG_REQUEST_MEMO, host);
|
||||
my_memo_lang(u, HostSetters[i], z, LNG_REQUEST_MEMO, host);*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -864,8 +874,7 @@ int my_isvalidchar(const char c)
|
||||
void hs_help(User * u)
|
||||
{
|
||||
me->NoticeLang(s_HostServ, u, LNG_HELP);
|
||||
if (is_host_setter(u))
|
||||
me->NoticeLang(s_HostServ, u, LNG_HELP_SETTER);
|
||||
me->NoticeLang(s_HostServ, u, LNG_HELP_SETTER);
|
||||
}
|
||||
|
||||
void hsreq_load_db()
|
||||
|
||||
Reference in New Issue
Block a user