summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-02 02:14:36 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-02 02:14:36 +0000
commit64a926656777aaaefaf355c4ee6d40ccd479039d (patch)
tree7dbbf589b8686c23045c9afb171a6e0d6efd5bd0 /src/inspircd.cpp
parent8557dcec22e3f6d92649d6521abc4703597a385e (diff)
Added permissions checks, ick!
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2102 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index c2b5ebf9b..e20a374be 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -1630,8 +1630,19 @@ bool is_valid_cmd(const char* commandname, int pcnt, userrec * user)
{
if ((pcnt>=cmdlist[i].min_params) && (strcasecmp(cmdlist[i].source,"<core>")))
{
- if (strchr(user->modes,cmdlist[i].flags_needed))
+ if ((strchr(user->modes,cmdlist[i].flags_needed)) || (!cmdlist[i].flags_needed))
{
+ if (cmdlist[i].flags_needed)
+ {
+ if (!user->HasPermission(command))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
return true;
}
}
@@ -1645,15 +1656,24 @@ bool is_valid_cmd(const char* commandname, int pcnt, userrec * user)
void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user)
{
- for (unsigned int i = 0; i < cmdlist.size(); i++)
+ for (unsigned int i = 0; i < cmdlist.size(); i++)
+ {
+ if (!strcasecmp(cmdlist[i].command,commandname))
{
- if (!strcasecmp(cmdlist[i].command,commandname))
+ if (cmdlist[i].handler_function)
{
- if (cmdlist[i].handler_function)
+ if (pcnt>=cmdlist[i].min_params)
{
- if (pcnt>=cmdlist[i].min_params)
+ if ((strchr(user->modes,cmdlist[i].flags_needed)) || (!cmdlist[i].flags_needed))
{
- if (strchr(user->modes,cmdlist[i].flags_needed))
+ if (cmdlist[i].flags_needed)
+ {
+ if (!user->HasPermission(command))
+ {
+ cmdlist[i].handler_function(parameters,pcnt,user);
+ }
+ }
+ else
{
cmdlist[i].handler_function(parameters,pcnt,user);
}
@@ -1661,6 +1681,7 @@ void call_handler(const char* commandname,char **parameters, int pcnt, userrec *
}
}
}
+ }
}