aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_opflags.cpp
diff options
context:
space:
mode:
authorGravatar Daniel De Graaf2010-03-01 09:50:49 -0600
committerGravatar Daniel De Graaf2010-08-03 17:32:38 -0400
commit84faaef9605df856947277780dfea9d8d7982df1 (patch)
tree44b808a8698aeeac4857c7c304380adbf1072d8e /src/modules/m_opflags.cpp
parentLet ENCAP target match on server names, not just SIDs (diff)
Allow m_autoop to grant channel flags, source its mode changes from the joining user
Diffstat (limited to 'src/modules/m_opflags.cpp')
-rw-r--r--src/modules/m_opflags.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/modules/m_opflags.cpp b/src/modules/m_opflags.cpp
index 7eb5644e7..9a2373232 100644
--- a/src/modules/m_opflags.cpp
+++ b/src/modules/m_opflags.cpp
@@ -32,6 +32,30 @@ class OpFlagProviderImpl : public OpFlagProvider
return "";
}
+ void SetFlags(Membership* memb, const std::string& flags)
+ {
+ if (flags.empty())
+ ext.unset(memb);
+ else
+ ext.set(memb, flags);
+ }
+
+ std::string SetFlags(Membership* memb, const std::set<std::string>& flags)
+ {
+ std::string v;
+ for(std::set<std::string>::iterator i = flags.begin(); i != flags.end(); i++)
+ {
+ if (i != flags.begin())
+ v.push_back(',');
+ v.append(*i);
+ }
+ if (v.empty())
+ ext.unset(memb);
+ else
+ ext.set(memb, v);
+ return v;
+ }
+
ModResult PermissionCheck(Membership* memb, const std::string& acl, const std::string& needed)
{
if (!memb)
@@ -161,14 +185,7 @@ class FlagCmd : public Command
}
else
{
- std::string v;
- for(std::set<std::string>::iterator i = flags.begin(); i != flags.end(); i++)
- {
- if (i != flags.begin())
- v.push_back(',');
- v.append(*i);
- }
- prov.ext.set(memb, v);
+ std::string v = prov.SetFlags(memb, flags);
chan->WriteChannelWithServ(src->server, "NOTICE %s :%s set %s opflags to %s",
chan->name.c_str(), src->nick.c_str(), user->nick.c_str(), v.c_str());
}