mirror of
https://github.com/anope/anope.git
synced 2026-07-06 06:13:13 +02:00
Fix up a bunch of access checking to be a bit more modern and so on
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2235 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -23,9 +23,7 @@ void myChanServHelp(User * u);
|
||||
**/
|
||||
void myChanServHelp(User * u)
|
||||
{
|
||||
if (is_services_admin(u)) {
|
||||
notice_lang(s_ChanServ, u, CHAN_HELP_CMD_FORBID);
|
||||
}
|
||||
notice_lang(s_ChanServ, u, CHAN_HELP_CMD_FORBID);
|
||||
}
|
||||
|
||||
class CommandCSForbid : public Command
|
||||
|
||||
+3
-10
@@ -21,9 +21,7 @@
|
||||
**/
|
||||
void myChanServHelp(User * u)
|
||||
{
|
||||
if (is_services_admin(u)) {
|
||||
notice_lang(s_ChanServ, u, CHAN_HELP_CMD_GETPASS);
|
||||
}
|
||||
notice_lang(s_ChanServ, u, CHAN_HELP_CMD_GETPASS);
|
||||
}
|
||||
|
||||
class CommandCSGetPass : public Command
|
||||
@@ -72,13 +70,8 @@ class CommandCSGetPass : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (is_services_admin(u))
|
||||
{
|
||||
notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP_GETPASS);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP_GETPASS);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnSyntaxError(User *u)
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ class CommandCSHelp : public Command
|
||||
moduleDisplayHelp(2, u);
|
||||
if (CSExpire >= 86400)
|
||||
notice_help(s_ChanServ, u, CHAN_HELP_EXPIRES, CSExpire / 86400);
|
||||
if (is_services_oper(u))
|
||||
if (u->nc && u->nc->IsServicesOper())
|
||||
notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP);
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@ class CommandCSInfo : public Command
|
||||
|
||||
bool OnUserHelp(User *u)
|
||||
{
|
||||
if (is_services_admin(u) || is_services_root(u))
|
||||
if (u->nc && u->nc->IsServicesOper())
|
||||
notice_lang(s_ChanServ, u, CHAN_SERVADMIN_HELP_INFO);
|
||||
else
|
||||
notice_lang(s_NickServ, u, CHAN_HELP_INFO);
|
||||
|
||||
@@ -30,7 +30,7 @@ class CommandCSSendPass : public Command
|
||||
ChannelInfo *ci;
|
||||
NickCore *founder;
|
||||
|
||||
if (RestrictMail && !is_services_oper(u))
|
||||
if (RestrictMail && !u->nc->HasCommand("chanserv/sendpass"))
|
||||
notice_lang(s_ChanServ, u, PERMISSION_DENIED);
|
||||
else if (!(ci = cs_findchan(chan)) || !(founder = ci->founder))
|
||||
notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, chan);
|
||||
|
||||
+1
-1
@@ -670,7 +670,7 @@ class CommandCSSet : public Command
|
||||
if (subcommand.empty())
|
||||
{
|
||||
notice_help(s_ChanServ, u, CHAN_HELP_SET);
|
||||
if (is_services_admin(u))
|
||||
if (u->nc && u->nc->IsServicesOper())
|
||||
notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP_SET);
|
||||
}
|
||||
else if (subcommand == "FOUNDER")
|
||||
|
||||
@@ -55,9 +55,6 @@ class CommandCSStatus : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_services_admin(u))
|
||||
return false;
|
||||
|
||||
notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP_STATUS);
|
||||
return true;
|
||||
}
|
||||
@@ -89,8 +86,7 @@ class CSStatus : public Module
|
||||
**/
|
||||
void myChanServHelp(User *u)
|
||||
{
|
||||
if (is_services_admin(u))
|
||||
notice_lang(s_ChanServ, u, CHAN_HELP_CMD_STATUS);
|
||||
notice_lang(s_ChanServ, u, CHAN_HELP_CMD_STATUS);
|
||||
}
|
||||
|
||||
MODULE_INIT("cs_status", CSStatus)
|
||||
|
||||
+2
-11
@@ -112,9 +112,6 @@ class CommandCSSuspend : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_services_oper(u))
|
||||
return false;
|
||||
|
||||
notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP_SUSPEND);
|
||||
return true;
|
||||
}
|
||||
@@ -189,9 +186,6 @@ class CommandCSUnSuspend : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_services_oper(u))
|
||||
return false;
|
||||
|
||||
notice_help(s_ChanServ, u, CHAN_SERVADMIN_HELP_UNSUSPEND);
|
||||
return true;
|
||||
}
|
||||
@@ -224,11 +218,8 @@ class CSSuspend : public Module
|
||||
**/
|
||||
void myChanServHelp(User *u)
|
||||
{
|
||||
if (is_services_oper(u))
|
||||
{
|
||||
notice_lang(s_ChanServ, u, CHAN_HELP_CMD_SUSPEND);
|
||||
notice_lang(s_ChanServ, u, CHAN_HELP_CMD_UNSUSPEND);
|
||||
}
|
||||
notice_lang(s_ChanServ, u, CHAN_HELP_CMD_SUSPEND);
|
||||
notice_lang(s_ChanServ, u, CHAN_HELP_CMD_UNSUSPEND);
|
||||
}
|
||||
|
||||
MODULE_INIT("cs_suspend", CSSuspend)
|
||||
|
||||
+1
-5
@@ -139,9 +139,6 @@ class CommandHSList : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_services_oper(u))
|
||||
return false;
|
||||
|
||||
notice_help(s_HostServ, u, HOST_HELP_LIST);
|
||||
return true;
|
||||
}
|
||||
@@ -167,8 +164,7 @@ class HSList : public Module
|
||||
**/
|
||||
void myHostServHelp(User *u)
|
||||
{
|
||||
if (is_services_oper(u))
|
||||
notice_lang(s_HostServ, u, HOST_HELP_CMD_LIST);
|
||||
notice_lang(s_HostServ, u, HOST_HELP_CMD_LIST);
|
||||
}
|
||||
|
||||
MODULE_INIT("hs_list", HSList)
|
||||
|
||||
+3
-4
@@ -30,7 +30,6 @@ class CommandMSInfo : public Command
|
||||
NickAlias *na = NULL;
|
||||
ChannelInfo *ci = NULL;
|
||||
const char *name = params.size() ? params[0].c_str() : NULL;
|
||||
int is_servadmin = is_services_admin(u);
|
||||
int hardmax = 0;
|
||||
|
||||
if (name && *name != '#' && u->nc->HasPriv("memoserv/info"))
|
||||
@@ -176,14 +175,14 @@ class CommandMSInfo : public Command
|
||||
|
||||
if (!mi->memomax)
|
||||
{
|
||||
if (!is_servadmin && hardmax)
|
||||
if (!u->nc->IsServicesOper() && hardmax)
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_HARD_LIMIT_ZERO);
|
||||
else
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_LIMIT_ZERO);
|
||||
}
|
||||
else if (mi->memomax > 0)
|
||||
{
|
||||
if (!is_servadmin && hardmax)
|
||||
if (!u->nc->IsServicesOper() && hardmax)
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_HARD_LIMIT, mi->memomax);
|
||||
else
|
||||
notice_lang(s_MemoServ, u, MEMO_INFO_LIMIT, mi->memomax);
|
||||
@@ -206,7 +205,7 @@ class CommandMSInfo : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (is_services_admin(u))
|
||||
if (u->nc && u->nc->IsServicesOper())
|
||||
notice_help(s_MemoServ, u, MEMO_SERVADMIN_HELP_INFO);
|
||||
else
|
||||
notice_help(s_MemoServ, u, MEMO_HELP_INFO);
|
||||
|
||||
+2
-3
@@ -49,7 +49,7 @@ class CommandMSRSend : public Command
|
||||
if (MSMemoReceipt == 1)
|
||||
{
|
||||
/* Services opers and above can use rsend */
|
||||
if (is_services_oper(u))
|
||||
if (u->nc->IsServicesOper())
|
||||
memo_send(u, nick, text, z);
|
||||
else
|
||||
notice_lang(s_MemoServ, u, ACCESS_DENIED);
|
||||
@@ -102,8 +102,7 @@ class MSRSend : public Module
|
||||
**/
|
||||
void myMemoServHelp(User *u)
|
||||
{
|
||||
if ((MSMemoReceipt == 1 && is_services_oper(u)) || MSMemoReceipt == 2)
|
||||
notice_lang(s_MemoServ, u, MEMO_HELP_CMD_RSEND);
|
||||
notice_lang(s_MemoServ, u, MEMO_HELP_CMD_RSEND);
|
||||
}
|
||||
|
||||
MODULE_INIT("ms_rsend", MSRSend)
|
||||
|
||||
@@ -62,9 +62,6 @@ class CommandMSSendAll : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_services_admin(u))
|
||||
return false;
|
||||
|
||||
notice_help(s_MemoServ, u, MEMO_HELP_SENDALL);
|
||||
return true;
|
||||
}
|
||||
@@ -94,8 +91,7 @@ class MSSendAll : public Module
|
||||
**/
|
||||
void myMemoServHelp(User *u)
|
||||
{
|
||||
if (is_services_admin(u))
|
||||
notice_lang(s_MemoServ, u, MEMO_HELP_CMD_SENDALL);
|
||||
notice_lang(s_MemoServ, u, MEMO_HELP_CMD_SENDALL);
|
||||
}
|
||||
|
||||
MODULE_INIT("ms_sendall", MSSendAll)
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ class CommandMSSet : public Command
|
||||
notice_help(s_MemoServ, u, MEMO_HELP_SET_NOTIFY);
|
||||
else if (subcommand == "LIMIT")
|
||||
{
|
||||
if (is_services_oper(u))
|
||||
if (u->nc && u->nc->IsServicesOper())
|
||||
notice_help(s_MemoServ, u, MEMO_SERVADMIN_HELP_SET_LIMIT, MSMaxMemos);
|
||||
else
|
||||
notice_help(s_MemoServ, u, MEMO_HELP_SET_LIMIT, MSMaxMemos);
|
||||
|
||||
+1
-5
@@ -60,9 +60,6 @@ class CommandMSStaff : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (!is_services_oper(u))
|
||||
return false;
|
||||
|
||||
notice_help(s_MemoServ, u, MEMO_HELP_STAFF);
|
||||
return true;
|
||||
}
|
||||
@@ -92,8 +89,7 @@ class MSStaff : public Module
|
||||
**/
|
||||
void myMemoServHelp(User *u)
|
||||
{
|
||||
if (is_services_oper(u))
|
||||
notice_lang(s_MemoServ, u, MEMO_HELP_CMD_STAFF);
|
||||
notice_lang(s_MemoServ, u, MEMO_HELP_CMD_STAFF);
|
||||
}
|
||||
|
||||
MODULE_INIT("ms_staff", MSStaff)
|
||||
|
||||
@@ -135,7 +135,7 @@ class CommandNSAccess : public Command
|
||||
const char *mask = params.size() > 1 ? params[1].c_str() : NULL;
|
||||
NickAlias *na;
|
||||
|
||||
if (!stricmp(cmd, "LIST") && is_services_admin(u) && mask && (na = findnick(params[1].c_str())))
|
||||
if (!stricmp(cmd, "LIST") && u->nc->IsServicesOper() && mask && (na = findnick(params[1].c_str())))
|
||||
return this->DoServAdminList(u, params, na->nc);
|
||||
|
||||
if (mask && !strchr(mask, '@'))
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ class CommandNSAList : public Command
|
||||
NickAlias *na;
|
||||
|
||||
int min_level = 0;
|
||||
int is_servadmin = is_services_admin(u);
|
||||
int is_servadmin = u->nc->IsServicesOper();
|
||||
int lev_param = 0;
|
||||
|
||||
if (!is_servadmin)
|
||||
@@ -134,7 +134,7 @@ class CommandNSAList : public Command
|
||||
|
||||
bool OnHelp(User *u, const std::string &subcommand)
|
||||
{
|
||||
if (is_services_admin(u))
|
||||
if (u->nc && u->nc->IsServicesOper())
|
||||
notice_help(s_NickServ, u, NICK_SERVADMIN_HELP_ALIST);
|
||||
else
|
||||
notice_help(s_NickServ, u, NICK_HELP_ALIST);
|
||||
|
||||
Reference in New Issue
Block a user