Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "module.h"
00015
00016 class CommandBSSetDontKickOps : public Command
00017 {
00018 public:
00019 CommandBSSetDontKickOps(Module *creator, const Anope::string &sname = "botserv/set/dontkickops") : Command(creator, sname, 2, 2)
00020 {
00021 this->SetDesc(_("To protect ops against bot kicks"));
00022 this->SetSyntax(_("\037channel\037 {ON | OFF}"));
00023 }
00024
00025 void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
00026 {
00027 ChannelInfo *ci = ChannelInfo::Find(params[0]);
00028 if (ci == NULL)
00029 {
00030 source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
00031 return;
00032 }
00033
00034 AccessGroup access = source.AccessFor(ci);
00035 if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
00036 {
00037 source.Reply(ACCESS_DENIED);
00038 return;
00039 }
00040
00041 if (Anope::ReadOnly)
00042 {
00043 source.Reply(_("Sorry, bot option setting is temporarily disabled."));
00044 return;
00045 }
00046
00047 if (params[1].equals_ci("ON"))
00048 {
00049 bool override = !access.HasPriv("SET");
00050 Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickops";
00051
00052 ci->botflags.SetFlag(BS_DONTKICKOPS);
00053 source.Reply(_("Bot \002won't kick ops\002 on channel %s."), ci->name.c_str());
00054 }
00055 else if (params[1].equals_ci("OFF"))
00056 {
00057 bool override = !access.HasPriv("SET");
00058 Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickops";
00059
00060 ci->botflags.UnsetFlag(BS_DONTKICKOPS);
00061 source.Reply(_("Bot \002will kick ops\002 on channel %s."), ci->name.c_str());
00062 }
00063 else
00064 this->OnSyntaxError(source, source.command);
00065 }
00066
00067 bool OnHelp(CommandSource &source, const Anope::string &) anope_override
00068 {
00069 this->SendSyntax(source);
00070 source.Reply(_(" \n"
00071 "Enables or disables \002ops protection\002 mode on a channel.\n"
00072 "When it is enabled, ops won't be kicked by the bot\n"
00073 "even if they don't match the NOKICK level."));
00074 return true;
00075 }
00076 };
00077
00078 class BSSetDontKickOps : public Module
00079 {
00080 CommandBSSetDontKickOps commandbssetdontkickops;
00081
00082 public:
00083 BSSetDontKickOps(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
00084 commandbssetdontkickops(this)
00085 {
00086 this->SetAuthor("Anope");
00087 }
00088 };
00089
00090 MODULE_INIT(BSSetDontKickOps)