aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_opflags.cpp
diff options
context:
space:
mode:
authorGravatar Daniel De Graaf2010-08-06 20:34:04 -0400
committerGravatar Daniel De Graaf2010-08-06 20:34:04 -0400
commit8da03ef9ce894b5434a094da1dadbfd4e704c64f (patch)
tree4a380757c0042183383a54b92ed71acda781c695 /src/modules/m_opflags.cpp
parentFix permission check when a user has no opflags (diff)
Add <opflags> config tag
Diffstat (limited to 'src/modules/m_opflags.cpp')
-rw-r--r--src/modules/m_opflags.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/modules/m_opflags.cpp b/src/modules/m_opflags.cpp
index 1d7a4d56d..e3781d03a 100644
--- a/src/modules/m_opflags.cpp
+++ b/src/modules/m_opflags.cpp
@@ -84,6 +84,8 @@ class FlagCmd : public Command
{
public:
OpFlagProviderImpl prov;
+ unsigned int conflevel;
+ unsigned int usermax;
FlagCmd(Module* parent) : Command(parent, "OPFLAGS", 2), prov(parent)
{
syntax = "<channel> <nick> {+-=}[<flags>]";
@@ -117,7 +119,9 @@ class FlagCmd : public Command
if (IS_LOCAL(src))
{
ModResult res = ServerInstance->CheckExemption(src,chan,"opflags");
- if (!res.check(chan->GetPrefixValue(src) >= OP_VALUE))
+ PermissionData perm(src, "opflags", chan, user);
+
+ if (!perm.result.check(chan->GetPrefixValue(src) >= conflevel))
{
src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You cannot change opflags on this channel.",
src->nick.c_str(), chan->name.c_str());
@@ -155,6 +159,12 @@ class FlagCmd : public Command
else
flags.erase(flag);
}
+ if (IS_LOCAL(src) && flags.size() > usermax)
+ {
+ src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Users cannot have more than %d opflags set.",
+ src->nick.c_str(), chan->name.c_str(), usermax);
+ return CMD_FAILURE;
+ }
if (flags.empty())
{
prov.ext.unset(memb);
@@ -199,8 +209,9 @@ class ModuleOpFlags : public Module
void OnRehash(User*)
{
- // ConfigTag* tag = ServerInstance->Config->ConfValue("opflags");
- // TODO maxflags?
+ ConfigTag* tag = ServerInstance->Config->ConfValue("opflags");
+ cmd.conflevel = tag->getInt("level", OP_VALUE);
+ cmd.usermax = tag->getInt("maxflags", 15);
}
void OnSyncChannel(Channel* channel, SyncTarget* target)