mirror of
https://github.com/pissnet/pissircd.git
synced 2025-07-29 22:42:24 +01:00
Use CommandAdd() everywhere, even in core.
This commit is contained in:
parent
a0aa1032a5
commit
6221333bfe
3 changed files with 21 additions and 44 deletions
40
src/packet.c
40
src/packet.c
|
@ -74,19 +74,19 @@ void init_CommandHash(void)
|
|||
#endif
|
||||
|
||||
bzero(CommandHash, sizeof(CommandHash));
|
||||
add_CommandX(MSG_ERROR, m_error, MAXPARA, M_UNREGISTERED|M_SERVER);
|
||||
add_CommandX(MSG_VERSION, m_version, MAXPARA, M_UNREGISTERED|M_USER|M_SERVER);
|
||||
add_Command(MSG_SUMMON, m_summon, 1);
|
||||
add_Command(MSG_USERS, m_users, MAXPARA);
|
||||
add_Command(MSG_INFO, m_info, MAXPARA);
|
||||
add_Command(MSG_DNS, m_dns, MAXPARA);
|
||||
add_Command(MSG_REHASH, m_rehash, MAXPARA);
|
||||
add_Command(MSG_RESTART, m_restart, 2);
|
||||
add_Command(MSG_DIE, m_die, MAXPARA);
|
||||
add_Command(MSG_DALINFO, m_dalinfo, MAXPARA);
|
||||
add_Command(MSG_CREDITS, m_credits, MAXPARA);
|
||||
add_Command(MSG_LICENSE, m_license, MAXPARA);
|
||||
add_Command(MSG_MODULE, m_module, MAXPARA);
|
||||
CommandAdd(NULL, MSG_ERROR, m_error, MAXPARA, M_UNREGISTERED|M_SERVER);
|
||||
CommandAdd(NULL, MSG_VERSION, m_version, MAXPARA, M_UNREGISTERED|M_USER|M_SERVER);
|
||||
CommandAdd(NULL, MSG_SUMMON, m_summon, 1, M_USER);
|
||||
CommandAdd(NULL, MSG_USERS, m_users, MAXPARA, M_USER);
|
||||
CommandAdd(NULL, MSG_INFO, m_info, MAXPARA, M_USER);
|
||||
CommandAdd(NULL, MSG_DNS, m_dns, MAXPARA, M_USER);
|
||||
CommandAdd(NULL, MSG_REHASH, m_rehash, MAXPARA, M_USER|M_SERVER);
|
||||
CommandAdd(NULL, MSG_RESTART, m_restart, 2, M_USER);
|
||||
CommandAdd(NULL, MSG_DIE, m_die, MAXPARA, M_USER);
|
||||
CommandAdd(NULL, MSG_DALINFO, m_dalinfo, MAXPARA, M_USER);
|
||||
CommandAdd(NULL, MSG_CREDITS, m_credits, MAXPARA, M_USER);
|
||||
CommandAdd(NULL, MSG_LICENSE, m_license, MAXPARA, M_USER);
|
||||
CommandAdd(NULL, MSG_MODULE, m_module, MAXPARA, M_USER);
|
||||
|
||||
#ifdef DEVELOP_DEBUG
|
||||
for (i = 0; i <= 255; i++)
|
||||
|
@ -118,20 +118,6 @@ aCommand *add_Command_backend(char *cmd, int (*func)(), unsigned char parameters
|
|||
return newcmd;
|
||||
}
|
||||
|
||||
void add_Command(char *name, int (*func)(), unsigned char parameters)
|
||||
{
|
||||
aCommand *cmd, *tok;
|
||||
cmd = add_Command_backend(name, func, parameters, 0);
|
||||
cmd->friend = NULL;
|
||||
}
|
||||
|
||||
void add_CommandX(char *name, int (*func)(), unsigned char parameters, int flags)
|
||||
{
|
||||
aCommand *cmd, *tok;
|
||||
cmd = add_Command_backend(name, func, parameters, flags);
|
||||
cmd->friend = NULL;
|
||||
}
|
||||
|
||||
inline aCommand *find_CommandEx(char *cmd, int (*func)(), int token)
|
||||
{
|
||||
aCommand *p;
|
||||
|
|
|
@ -8405,7 +8405,8 @@ int _conf_alias(ConfigFile *conf, ConfigEntry *ce)
|
|||
if (BadPtr(alias->nick) && alias->type != ALIAS_COMMAND) {
|
||||
safestrdup(alias->nick, alias->alias);
|
||||
}
|
||||
add_CommandX(alias->alias, m_alias, 1, M_USER|M_ALIAS);
|
||||
CommandAdd(NULL, alias->alias, m_alias, 1, M_USER|M_ALIAS);
|
||||
|
||||
AddListItem(alias, conf_alias);
|
||||
return 0;
|
||||
}
|
||||
|
|
22
src/s_serv.c
22
src/s_serv.c
|
@ -613,20 +613,13 @@ extern void reinit_resolver(aClient *sptr);
|
|||
*/
|
||||
CMD_FUNC(m_rehash)
|
||||
{
|
||||
int x;
|
||||
int x = 0;
|
||||
|
||||
if (MyClient(sptr) && !ValidatePermissionsForPath("server:rehash",sptr,NULL,NULL,NULL))
|
||||
if (!ValidatePermissionsForPath("server:rehash",sptr,NULL,NULL,NULL))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
if (!MyClient(sptr) && !ValidatePermissionsForPath("server:rehash",sptr,NULL,NULL,NULL)
|
||||
&& !IsULine(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
x = 0;
|
||||
|
||||
if ((parc < 3) || BadPtr(parv[2])) {
|
||||
/* If the argument starts with a '-' (like -motd, -opermotd, etc) then it's
|
||||
|
@ -813,13 +806,9 @@ CMD_FUNC(m_restart)
|
|||
char *reason = parv[1];
|
||||
aClient *acptr;
|
||||
int i;
|
||||
|
||||
/* Check permissions */
|
||||
if (MyClient(sptr) && !ValidatePermissionsForPath("server:restart",sptr,NULL,NULL,NULL))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
if (!MyClient(sptr) && !ValidatePermissionsForPath("server:restart",sptr,NULL,NULL,NULL) && !IsULine(sptr))
|
||||
if (!ValidatePermissionsForPath("server:restart",sptr,NULL,NULL,NULL))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
|
||||
return 0;
|
||||
|
@ -1172,7 +1161,8 @@ CMD_FUNC(m_die)
|
|||
{
|
||||
aClient *acptr;
|
||||
int i;
|
||||
if (!MyClient(sptr) || !ValidatePermissionsForPath("server:die",sptr,NULL,NULL,NULL))
|
||||
|
||||
if (!ValidatePermissionsForPath("server:die",sptr,NULL,NULL,NULL))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue