summaryrefslogtreecommitdiff
path: root/modules/commands/cs_set.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands/cs_set.cpp')
-rw-r--r--modules/commands/cs_set.cpp171
1 files changed, 65 insertions, 106 deletions
diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp
index e3d2493ff..0de1a39ad 100644
--- a/modules/commands/cs_set.cpp
+++ b/modules/commands/cs_set.cpp
@@ -50,51 +50,7 @@ class CommandCSSet : public Command
}
}
source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information on a\n"
- "particular option."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), this_name.c_str());
- return true;
- }
-};
-
-class CommandCSSASet : public Command
-{
- public:
- CommandCSSASet(Module *creator) : Command(creator, "chanserv/saset", 2, 3)
- {
- this->SetDesc(_("Forcefully set channel options and information"));
- this->SetSyntax(_("\037option\037 \037channel\037 \037parameters\037"));
- }
-
- void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
- {
- this->OnSyntaxError(source, "");
- return;
- }
-
- bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
- {
- this->SendSyntax(source);
- source.Reply(" ");
- source.Reply(_("Allows Services Operators to forcefully change settings\n"
- "on channels.\n"
- " \n"
- "Available options:"));
- Anope::string this_name = source.command;
- for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
- {
- const Anope::string &c_name = it->first;
- const CommandInfo &info = it->second;
- if (c_name.find_ci(this_name + " ") == 0)
- {
- ServiceReference<Command> command("Command", info.name);
- if (command)
- {
- source.command = it->first;
- command->OnServHelp(source);
- }
- }
- }
- source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information on a\n"
- "particular option."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), this_name.c_str());
+ "particular option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str());
return true;
}
};
@@ -122,7 +78,7 @@ class CommandCSSetAutoOp : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -130,11 +86,13 @@ class CommandCSSetAutoOp : public Command
if (params[1].equals_ci("ON"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable autoop";
ci->Shrink("NOAUTOOP");
source.Reply(_("Services will now automatically give modes to users in \002%s\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable autoop";
ci->ExtendMetadata("NOAUTOOP");
source.Reply(_("Services will no longer automatically give modes to users in \002%s\002."), ci->name.c_str());
}
@@ -148,8 +106,8 @@ class CommandCSSetAutoOp : public Command
source.Reply(" ");
source.Reply(_("Enables or disables %s's autoop feature for a\n"
"channel. When disabled, users who join the channel will\n"
- "not automatically gain any status from %s."), Config->ChanServ.c_str(),
- Config->ChanServ.c_str(), this->name.c_str());
+ "not automatically gain any status from %s."), ChanServ->nick.c_str(),
+ ChanServ->nick.c_str(), this->name.c_str());
return true;
}
};
@@ -177,7 +135,7 @@ class CommandCSSetBanType : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -188,6 +146,7 @@ class CommandCSSetBanType : public Command
int16_t new_type = convertTo<int16_t>(params[1]);
if (new_type < 0 || new_type > 3)
throw ConvertException("Invalid range");
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the ban type to " << new_type;
ci->bantype = new_type;
source.Reply(_("Ban type for channel %s is now #%d."), ci->name.c_str(), ci->bantype);
}
@@ -195,8 +154,6 @@ class CommandCSSetBanType : public Command
{
source.Reply(_("\002%s\002 is not a valid ban type."), params[1].c_str());
}
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
@@ -239,7 +196,7 @@ class CommandCSSetChanstats : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -249,15 +206,16 @@ class CommandCSSetChanstats : public Command
{
ci->ExtendMetadata("STATS");
source.Reply(_("Chanstats statistics are now enabled for this channel."));
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable chanstats";
}
else if (params[1].equals_ci("OFF"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable chanstats";
ci->Shrink("STATS");
source.Reply(_("Chanstats statistics are now disabled for this channel."));
}
else
this->OnSyntaxError(source, "");
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
@@ -292,7 +250,7 @@ class CommandCSSetDescription : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -301,11 +259,13 @@ class CommandCSSetDescription : public Command
if (params.size() > 1)
{
ci->desc = params[1];
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the description to " << ci->desc;
source.Reply(_("Description of %s changed to \002%s\002."), ci->name.c_str(), ci->desc.c_str());
}
else
{
ci->desc.clear();
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to unset the description";
source.Reply(_("Description of %s unset."), ci->name.c_str());
}
@@ -345,7 +305,7 @@ class CommandCSSetFounder : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -359,13 +319,14 @@ class CommandCSSetFounder : public Command
}
NickCore *nc = na->nc;
- if (Config->CSMaxReg && nc->channelcount >= Config->CSMaxReg && !source.HasPriv("chanserv/no-register-limit"))
+ unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
+ if (max_reg && nc->channelcount >= max_reg && !source.HasPriv("chanserv/no-register-limit"))
{
source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str());
return;
}
- Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to change the founder from " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << " to " << nc->display;
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the founder from " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << " to " << nc->display;
ci->SetFounder(nc);
@@ -407,7 +368,7 @@ class CommandCSSetKeepTopic : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -415,18 +376,18 @@ class CommandCSSetKeepTopic : public Command
if (params[1].equals_ci("ON"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable keeptopic";
ci->ExtendMetadata("KEEPTOPIC");
source.Reply(_("Topic retention option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable keeptopic";
ci->Shrink("KEEPTOPIC");
source.Reply(_("Topic retention option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "KEEPTOPIC");
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
@@ -464,7 +425,7 @@ class CommandCSSetPeace : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -472,11 +433,13 @@ class CommandCSSetPeace : public Command
if (params[1].equals_ci("ON"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable peace";
ci->ExtendMetadata("PEACE");
source.Reply(_("Peace option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable peace";
ci->Shrink("PEACE");
source.Reply(_("Peace option for %s is now \002off\002."), ci->name.c_str());
}
@@ -521,7 +484,7 @@ class CommandCSSetPersist : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -538,7 +501,8 @@ class CommandCSSetPersist : public Command
/* Channel doesn't exist, create it */
if (!ci->c)
{
- Channel *c = new Channel(ci->name);
+ bool created;
+ Channel *c = Channel::FindOrCreate(ci->name, created);
if (ci->bi)
ci->bi->Join(c);
}
@@ -568,6 +532,7 @@ class CommandCSSetPersist : public Command
}
}
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable persist";
source.Reply(_("Channel \002%s\002 is now persistent."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
@@ -588,7 +553,7 @@ class CommandCSSetPersist : public Command
/* No channel mode, no BotServ, but using ChanServ as the botserv bot
* which was assigned when persist was set on
*/
- if (!cm && Config->BotServ.empty() && ci->bi)
+ if (!cm && !BotServ && ci->bi)
{
if (!ChanServ)
{
@@ -600,6 +565,7 @@ class CommandCSSetPersist : public Command
}
}
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable persist";
source.Reply(_("Channel \002%s\002 is no longer persistent."), ci->name.c_str());
}
else
@@ -658,7 +624,7 @@ class CommandCSSetPrivate : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -666,11 +632,13 @@ class CommandCSSetPrivate : public Command
if (params[1].equals_ci("ON"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable private";
ci->ExtendMetadata("PRIVATE");
source.Reply(_("Private option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable private";
ci->Shrink("PRIVATE");
source.Reply(_("Private option for %s is now \002off\002."), ci->name.c_str());
}
@@ -687,7 +655,7 @@ class CommandCSSetPrivate : public Command
source.Reply(_("Enables or disables the \002private\002 option for a channel.\n"
"When \002private\002 is set, a \002%s%s LIST\002 will not\n"
"include the channel in any lists."),
- Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
+ Config->StrictPrivmsg.c_str(), source.service->nick.c_str());
return true;
}
};
@@ -715,7 +683,7 @@ class CommandCSSetRestricted : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -723,18 +691,18 @@ class CommandCSSetRestricted : public Command
if (params[1].equals_ci("ON"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable restricted";
ci->ExtendMetadata("RESTRICTED");
source.Reply(_("Restricted access option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable restricted";
ci->Shrink("RESTRICTED");
source.Reply(_("Restricted access option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "RESTRICTED");
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
@@ -771,7 +739,7 @@ class CommandCSSetSecure : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -779,18 +747,18 @@ class CommandCSSetSecure : public Command
if (params[1].equals_ci("ON"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure";
ci->ExtendMetadata("SECURE");
source.Reply(_("Secure option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure";
ci->Shrink("SECURE");
source.Reply(_("Secure option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "SECURE");
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
@@ -829,7 +797,7 @@ class CommandCSSetSecureFounder : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -837,18 +805,18 @@ class CommandCSSetSecureFounder : public Command
if (params[1].equals_ci("ON"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure founder";
ci->ExtendMetadata("SECUREFOUNDER");
source.Reply(_("Secure founder option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure founder";
ci->Shrink("SECUREFOUNDER");
source.Reply(_("Secure founder option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "SECUREFOUNDER");
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
@@ -887,7 +855,7 @@ class CommandCSSetSecureOps : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -895,18 +863,18 @@ class CommandCSSetSecureOps : public Command
if (params[1].equals_ci("ON"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure ops";
ci->ExtendMetadata("SECUREOPS");
source.Reply(_("Secure ops option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure ops";
ci->Shrink("SECUREOPS");
source.Reply(_("Secure ops option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "SECUREOPS");
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
@@ -943,7 +911,7 @@ class CommandCSSetSignKick : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -954,6 +922,7 @@ class CommandCSSetSignKick : public Command
ci->ExtendMetadata("SIGNKICK");
ci->Shrink("SIGNKICK_LEVEL");
source.Reply(_("Signed kick option for %s is now \002on\002."), ci->name.c_str());
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable sign kick";
}
else if (params[1].equals_ci("LEVEL"))
{
@@ -961,12 +930,14 @@ class CommandCSSetSignKick : public Command
ci->Shrink("SIGNKICK");
source.Reply(_("Signed kick option for %s is now \002on\002, but depends of the\n"
"level of the user that is using the command."), ci->name.c_str());
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable sign kick level";
}
else if (params[1].equals_ci("OFF"))
{
ci->Shrink("SIGNKICK");
ci->Shrink("SIGNKICK_LEVEL");
source.Reply(_("Signed kick option for %s is now \002off\002."), ci->name.c_str());
+ Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable sign kick";
}
else
this->OnSyntaxError(source, "SIGNKICK");
@@ -1011,7 +982,7 @@ class CommandCSSetSuccessor : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(ACCESS_DENIED);
return;
@@ -1057,18 +1028,20 @@ class CommandCSSetSuccessor : public Command
source.Reply(_("Changes the successor of a channel. If the founder's\n"
"nickname expires or is dropped while the channel is still\n"
"registered, the successor will become the new founder of the\n"
- "channel. However, if the successor already has too many\n"
+ "channel. The new nickname must be a registered one."));
+ unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
+ if (max_reg)
+ source.Reply(_("However, if the successor already has too many\n"
"channels registered (%d), the channel will be dropped\n"
- "instead, just as if no successor had been set. The new\n"
- "nickname must be a registered one."), Config->CSMaxReg);
+ "instead, just as if no successor had been set."), max_reg);
return true;
}
};
-class CommandCSSASetNoexpire : public Command
+class CommandCSSetNoexpire : public Command
{
public:
- CommandCSSASetNoexpire(Module *creator) : Command(creator, "chanserv/saset/noexpire", 2, 2)
+ CommandCSSetNoexpire(Module *creator) : Command(creator, "chanserv/saset/noexpire", 2, 2)
{
this->SetDesc(_("Prevent the channel from expiring"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
@@ -1091,11 +1064,13 @@ class CommandCSSASetNoexpire : public Command
if (params[1].equals_ci("ON"))
{
+ Log(LOG_ADMIN, source, this, ci) << "to enable noexpire";
ci->ExtendMetadata("NO_EXPIRE");
source.Reply(_("Channel %s \002will not\002 expire."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
+ Log(LOG_ADMIN, source, this, ci) << "to disable noexpire";
ci->Shrink("NO_EXPIRE");
source.Reply(_("Channel %s \002will\002 expire."), ci->name.c_str());
}
@@ -1118,7 +1093,6 @@ class CommandCSSASetNoexpire : public Command
class CSSet : public Module
{
CommandCSSet commandcsset;
- CommandCSSASet commandcssaset;
CommandCSSetAutoOp commandcssetautoop;
CommandCSSetBanType commandcssetbantype;
CommandCSSetChanstats commandcssetchanstats;
@@ -1135,34 +1109,19 @@ class CSSet : public Module
CommandCSSetSecureOps commandcssetsecureops;
CommandCSSetSignKick commandcssetsignkick;
CommandCSSetSuccessor commandcssetsuccessor;
- CommandCSSASetNoexpire commandcssasetnoexpire;
+ CommandCSSetNoexpire commandcssetnoexpire;
public:
- CSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- commandcsset(this), commandcssaset(this), commandcssetautoop(this), commandcssetbantype(this), commandcssetchanstats(this),
+ CSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
+ commandcsset(this), commandcssetautoop(this), commandcssetbantype(this), commandcssetchanstats(this),
CSDefChanstats(false), commandcssetdescription(this), commandcssetfounder(this), commandcssetkeeptopic(this),
commandcssetpeace(this), commandcssetpersist(this), commandcssetprivate(this), commandcssetrestricted(this),
commandcssetsecure(this), commandcssetsecurefounder(this), commandcssetsecureops(this), commandcssetsignkick(this),
- commandcssetsuccessor(this), commandcssasetnoexpire(this)
+ commandcssetsuccessor(this), commandcssetnoexpire(this)
{
- this->SetAuthor("Anope");
- Implementation i[] = { I_OnReload, I_OnChanRegistered, I_OnCheckKick, I_OnDelChan };
+ Implementation i[] = { I_OnCheckKick, I_OnDelChan };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
-
- this->OnReload();
- }
-
- void OnReload() anope_override
- {
- ConfigReader config;
- CSDefChanstats = config.ReadFlag("chanstats", "CSDefChanstats", "0", 0);
- }
-
- void OnChanRegistered(ChannelInfo *ci) anope_override
- {
- if (CSDefChanstats)
- ci->ExtendMetadata("STATS");
}
EventReturn OnCheckKick(User *u, ChannelInfo *ci, Anope::string &mask, Anope::string &reason) anope_override