1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 09:36:38 +02:00

Combine all of the set modules now that having them split apart is almost completely pointless

This commit is contained in:
Adam
2012-12-22 14:49:48 -05:00
parent 0cde0aee34
commit dc751bd2f1
46 changed files with 2969 additions and 4223 deletions
+363 -3
View File
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSSet : public Command
@@ -56,13 +54,375 @@ class CommandBSSet : public Command
}
};
class CommandBSSetDontKickOps : public Command
{
public:
CommandBSSetDontKickOps(Module *creator, const Anope::string &sname = "botserv/set/dontkickops") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("To protect ops against bot kicks"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (params[1].equals_ci("ON"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickops";
ci->botflags.SetFlag(BS_DONTKICKOPS);
source.Reply(_("Bot \002won't kick ops\002 on channel %s."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickops";
ci->botflags.UnsetFlag(BS_DONTKICKOPS);
source.Reply(_("Bot \002will kick ops\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002ops protection\002 mode on a channel.\n"
"When it is enabled, ops won't be kicked by the bot\n"
"even if they don't match the NOKICK level."));
return true;
}
};
class CommandBSSetDontKickVoices : public Command
{
public:
CommandBSSetDontKickVoices(Module *creator, const Anope::string &sname = "botserv/set/dontkickvoices") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("To protect voices against bot kicks"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (params[1].equals_ci("ON"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickvoices";
ci->botflags.SetFlag(BS_DONTKICKVOICES);
source.Reply(_("Bot \002won't kick voices\002 on channel %s."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickvoices";
ci->botflags.UnsetFlag(BS_DONTKICKVOICES);
source.Reply(_("Bot \002will kick voices\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002voices protection\002 mode on a channel.\n"
"When it is enabled, voices won't be kicked by the bot\n"
"even if they don't match the NOKICK level."));
return true;
}
};
class CommandBSSetFantasy : public Command
{
public:
CommandBSSetFantasy(Module *creator, const Anope::string &sname = "botserv/set/fantasy") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Enable fantaisist commands"));
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
const Anope::string &value = params[1];
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable fantasy";
ci->botflags.SetFlag(BS_FANTASY);
source.Reply(_("Fantasy mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable fantasy";
ci->botflags.UnsetFlag(BS_FANTASY);
source.Reply(_("Fantasy mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002fantasy\002 mode on a channel.\n"
"When it is enabled, users will be able to use\n"
"%s commands on a channel when prefixed\n"
"with one of the following fantasy characters: \002%s\002\n"
" \n"
"Note that users wanting to use fantaisist\n"
"commands MUST have enough level for both\n"
"the FANTASIA and another level depending\n"
"of the command if required (for example, to use \n"
"!op, user must have enough access for the OPDEOP\n"
"level)."), Config->ChanServ.c_str(), Config->BSFantasyCharacter.c_str());
return true;
}
};
class CommandBSSetGreet : public Command
{
public:
CommandBSSetGreet(Module *creator, const Anope::string &sname = "botserv/set/greet") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Enable greet messages"));
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
const Anope::string &value = params[1];
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets";
ci->botflags.SetFlag(BS_GREET);
source.Reply(_("Greet mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable greets";
ci->botflags.UnsetFlag(BS_GREET);
source.Reply(_("Greet mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002greet\002 mode on a channel.\n"
"When it is enabled, the bot will display greet\n"
"messages of users joining the channel, provided\n"
"they have enough access to the channel."));
return true;
}
};
class CommandBSSetNoBot : public Command
{
public:
CommandBSSetNoBot(Module *creator, const Anope::string &sname = "botserv/set/nobot") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Prevent a bot from being assigned to a channel"));
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
const Anope::string &value = params[1];
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to enable nobot";
ci->botflags.SetFlag(BS_NOBOT);
if (ci->bi)
ci->bi->UnAssign(source.GetUser(), ci);
source.Reply(_("No Bot mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to disable nobot";
ci->botflags.UnsetFlag(BS_NOBOT);
source.Reply(_("No Bot mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"This option makes a channel be unassignable. If a bot \n"
"is already assigned to the channel, it is unassigned\n"
"automatically when you enable the option."));
return true;
}
};
class CommandBSSetPrivate : public Command
{
public:
CommandBSSetPrivate(Module *creator, const Anope::string &sname = "botserv/set/private") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Prevent a bot from being assigned by non IRC operators"));
this->SetSyntax(_("\037botname\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
BotInfo *bi = BotInfo::Find(params[0], true);
const Anope::string &value = params[1];
if (bi == NULL)
{
source.Reply(BOT_DOES_NOT_EXIST, params[0].c_str());
return;
}
if (value.equals_ci("ON"))
{
bi->SetFlag(BI_PRIVATE);
source.Reply(_("Private mode of bot %s is now \002on\002."), bi->nick.c_str());
}
else if (value.equals_ci("OFF"))
{
bi->UnsetFlag(BI_PRIVATE);
source.Reply(_("Private mode of bot %s is now \002off\002."), bi->nick.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"This option prevents a bot from being assigned to a\n"
"channel by users that aren't IRC operators."));
return true;
}
};
class BSSet : public Module
{
CommandBSSet commandbsset;
CommandBSSetDontKickOps commandbssetdontkickops;
CommandBSSetDontKickVoices commandbssetdontkickvoices;
CommandBSSetFantasy commandbssetfantasy;
CommandBSSetNoBot commandbssetnobot;
CommandBSSetPrivate commandbssetprivate;
public:
BSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandbsset(this)
commandbsset(this), commandbssetdontkickops(this), commandbssetdontkickvoices(this),
commandbssetfantasy(this), commandbssetnobot(this), commandbssetprivate(this)
{
this->SetAuthor("Anope");
-90
View File
@@ -1,90 +0,0 @@
/* BotServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSSetDontKickOps : public Command
{
public:
CommandBSSetDontKickOps(Module *creator, const Anope::string &sname = "botserv/set/dontkickops") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("To protect ops against bot kicks"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (params[1].equals_ci("ON"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickops";
ci->botflags.SetFlag(BS_DONTKICKOPS);
source.Reply(_("Bot \002won't kick ops\002 on channel %s."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickops";
ci->botflags.UnsetFlag(BS_DONTKICKOPS);
source.Reply(_("Bot \002will kick ops\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002ops protection\002 mode on a channel.\n"
"When it is enabled, ops won't be kicked by the bot\n"
"even if they don't match the NOKICK level."));
return true;
}
};
class BSSetDontKickOps : public Module
{
CommandBSSetDontKickOps commandbssetdontkickops;
public:
BSSetDontKickOps(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandbssetdontkickops(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(BSSetDontKickOps)
@@ -1,90 +0,0 @@
/* BotServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSSetDontKickVoices : public Command
{
public:
CommandBSSetDontKickVoices(Module *creator, const Anope::string &sname = "botserv/set/dontkickvoices") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("To protect voices against bot kicks"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
AccessGroup access = source.AccessFor(ci);
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (params[1].equals_ci("ON"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickvoices";
ci->botflags.SetFlag(BS_DONTKICKVOICES);
source.Reply(_("Bot \002won't kick voices\002 on channel %s."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
bool override = !access.HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickvoices";
ci->botflags.UnsetFlag(BS_DONTKICKVOICES);
source.Reply(_("Bot \002will kick voices\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002voices protection\002 mode on a channel.\n"
"When it is enabled, voices won't be kicked by the bot\n"
"even if they don't match the NOKICK level."));
return true;
}
};
class BSSetDontKickVoices : public Module
{
CommandBSSetDontKickVoices commandbssetdontkickvoices;
public:
BSSetDontKickVoices(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandbssetdontkickvoices(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(BSSetDontKickVoices)
-99
View File
@@ -1,99 +0,0 @@
/* BotServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSSetFantasy : public Command
{
public:
CommandBSSetFantasy(Module *creator, const Anope::string &sname = "botserv/set/fantasy") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Enable fantaisist commands"));
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
const Anope::string &value = params[1];
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable fantasy";
ci->botflags.SetFlag(BS_FANTASY);
source.Reply(_("Fantasy mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable fantasy";
ci->botflags.UnsetFlag(BS_FANTASY);
source.Reply(_("Fantasy mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002fantasy\002 mode on a channel.\n"
"When it is enabled, users will be able to use\n"
"%s commands on a channel when prefixed\n"
"with one of the following fantasy characters: \002%s\002\n"
" \n"
"Note that users wanting to use fantaisist\n"
"commands MUST have enough level for both\n"
"the FANTASIA and another level depending\n"
"of the command if required (for example, to use \n"
"!op, user must have enough access for the OPDEOP\n"
"level)."), Config->ChanServ.c_str(), Config->BSFantasyCharacter.c_str());
return true;
}
};
class BSSetFantasy : public Module
{
CommandBSSetFantasy commandbssetfantasy;
public:
BSSetFantasy(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandbssetfantasy(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(BSSetFantasy)
-92
View File
@@ -1,92 +0,0 @@
/* BotServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSSetGreet : public Command
{
public:
CommandBSSetGreet(Module *creator, const Anope::string &sname = "botserv/set/greet") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Enable greet messages"));
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
const Anope::string &value = params[1];
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
return;
}
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets";
ci->botflags.SetFlag(BS_GREET);
source.Reply(_("Greet mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable greets";
ci->botflags.UnsetFlag(BS_GREET);
source.Reply(_("Greet mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"Enables or disables \002greet\002 mode on a channel.\n"
"When it is enabled, the bot will display greet\n"
"messages of users joining the channel, provided\n"
"they have enough access to the channel."));
return true;
}
};
class BSSetGreet : public Module
{
CommandBSSetGreet commandbssetgreet;
public:
BSSetGreet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandbssetgreet(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(BSSetGreet)
-87
View File
@@ -1,87 +0,0 @@
/* BotServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSSetNoBot : public Command
{
public:
CommandBSSetNoBot(Module *creator, const Anope::string &sname = "botserv/set/nobot") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Prevent a bot from being assigned to a channel"));
this->SetSyntax(_("\037channel\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
const Anope::string &value = params[1];
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (!source.HasCommand("botserv/set/nobot"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (value.equals_ci("ON"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to enable nobot";
ci->botflags.SetFlag(BS_NOBOT);
if (ci->bi)
ci->bi->UnAssign(source.GetUser(), ci);
source.Reply(_("No Bot mode is now \002on\002 on channel %s."), ci->name.c_str());
}
else if (value.equals_ci("OFF"))
{
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to disable nobot";
ci->botflags.UnsetFlag(BS_NOBOT);
source.Reply(_("No Bot mode is now \002off\002 on channel %s."), ci->name.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"This option makes a channel be unassignable. If a bot \n"
"is already assigned to the channel, it is unassigned\n"
"automatically when you enable the option."));
return true;
}
};
class BSSetNoBot : public Module
{
CommandBSSetNoBot commandbssetnobot;
public:
BSSetNoBot(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandbssetnobot(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(BSSetNoBot)
-78
View File
@@ -1,78 +0,0 @@
/* BotServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandBSSetPrivate : public Command
{
public:
CommandBSSetPrivate(Module *creator, const Anope::string &sname = "botserv/set/private") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Prevent a bot from being assigned by non IRC operators"));
this->SetSyntax(_("\037botname\037 {\037ON|OFF\037}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
BotInfo *bi = BotInfo::Find(params[0], true);
const Anope::string &value = params[1];
if (bi == NULL)
{
source.Reply(BOT_DOES_NOT_EXIST, params[0].c_str());
return;
}
if (!source.HasCommand("botserv/set/private"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (value.equals_ci("ON"))
{
bi->SetFlag(BI_PRIVATE);
source.Reply(_("Private mode of bot %s is now \002on\002."), bi->nick.c_str());
}
else if (value.equals_ci("OFF"))
{
bi->UnsetFlag(BI_PRIVATE);
source.Reply(_("Private mode of bot %s is now \002off\002."), bi->nick.c_str());
}
else
this->OnSyntaxError(source, source.command);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(_(" \n"
"This option prevents a bot from being assigned to a\n"
"channel by users that aren't IRC operators."));
return true;
}
};
class BSSetPrivate : public Module
{
CommandBSSetPrivate commandbssetprivate;
public:
BSSetPrivate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandbssetprivate(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(BSSetPrivate)
-73
View File
@@ -1,73 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
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 SASET \037option\037\002 for more information on a\n"
"particular option."), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str());
return true;
}
};
class CSSASet : public Module
{
CommandCSSASet commandcssaset;
public:
CSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssaset(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSASet)
-79
View File
@@ -1,79 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSASetNoexpire : public Command
{
public:
CommandCSSASetNoexpire(Module *creator) : Command(creator, "chanserv/saset/noexpire", 2, 2)
{
this->SetDesc(_("Prevent the channel from expiring"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_NO_EXPIRE);
source.Reply(_("Channel %s \002will not\002 expire."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_NO_EXPIRE);
source.Reply(_("Channel %s \002will\002 expire."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "NOEXPIRE");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sets whether the given channel will expire. Setting this\n"
"to ON prevents the channel from expiring."));
return true;
}
};
class CSSetNoexpire : public Module
{
CommandCSSASetNoexpire commandcssasetnoexpire;
public:
CSSetNoexpire(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssasetnoexpire(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetNoexpire)
File diff suppressed because it is too large Load Diff
-85
View File
@@ -1,85 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetAutoOp : public Command
{
public:
CommandCSSetAutoOp(Module *creator, const Anope::string &cname = "chanserv/set/autoop") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Should services automatically give status to users"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->UnsetFlag(CI_NOAUTOOP);
source.Reply(_("Services will now automatically give modes to users in \2%s\2"), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->SetFlag(CI_NOAUTOOP);
source.Reply(_("Services will no longer automatically give modes to users in \2%s\2"), ci->name.c_str());
}
else
this->OnSyntaxError(source, "AUTOOP");
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
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());
return true;
}
};
class CSSetAutoOp : public Module
{
CommandCSSetAutoOp commandcssetautoop;
public:
CSSetAutoOp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetautoop(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetAutoOp)
-91
View File
@@ -1,91 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetBanType : public Command
{
public:
CommandCSSetBanType(Module *creator, const Anope::string &cname = "chanserv/set/bantype") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Set how Services make bans on the channel"));
this->SetSyntax(_("\037channel\037 \037bantype\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
try
{
int16_t new_type = convertTo<int16_t>(params[1]);
if (new_type < 0 || new_type > 3)
throw ConvertException("Invalid range");
ci->bantype = new_type;
source.Reply(_("Ban type for channel %s is now #%d."), ci->name.c_str(), ci->bantype);
}
catch (const ConvertException &)
{
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
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sets the ban type that will be used by services whenever\n"
"they need to ban someone from your channel.\n"
" \n"
"bantype is a number between 0 and 3 that means:\n"
" \n"
"0: ban in the form *!user@host\n"
"1: ban in the form *!*user@host\n"
"2: ban in the form *!*@host\n"
"3: ban in the form *!*user@*.domain"), this->name.c_str());
return true;
}
};
class CSSetBanType : public Module
{
CommandCSSetBanType commandcssetbantype;
public:
CSSetBanType(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetbantype(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetBanType)
-94
View File
@@ -1,94 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetChanstats : public Command
{
public:
CommandCSSetChanstats(Module *creator) : Command(creator, "chanserv/set/chanstats", 2, 2)
{
this->SetDesc(_("Turn chanstat statistics on or off"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (!ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_STATS);
source.Reply(_("Chanstats statistics are now enabled for this channel"));
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_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
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply("Turn Chanstats channel statistics ON or OFF");
return true;
}
};
class CSSetChanstats : public Module
{
CommandCSSetChanstats commandcssetchanstats;
bool CSDefChanstats;
public:
CSSetChanstats(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetchanstats(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnReload, I_OnChanRegistered };
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->SetFlag(CI_STATS);
}
};
MODULE_INIT(CSSetChanstats)
-82
View File
@@ -1,82 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetDescription : public Command
{
public:
CommandCSSetDescription(Module *creator, const Anope::string &cname = "chanserv/set/description") : Command(creator, cname, 1, 2)
{
this->SetDesc(_("Set the channel description"));
this->SetSyntax(_("\037channel\037 [\037description\037]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params.size() > 1)
{
ci->desc = params[1];
source.Reply(_("Description of %s changed to \002%s\002."), ci->name.c_str(), ci->desc.c_str());
}
else
{
ci->desc.clear();
source.Reply(_("Description of %s unset."), ci->name.c_str());
}
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sets the description for the channel, which shows up with\n"
"the \002LIST\002 and \002INFO\002 commands."), this->name.c_str());
return true;
}
};
class CSSetDescription : public Module
{
CommandCSSetDescription commandcssetdescription;
public:
CSSetDescription(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetdescription(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetDescription)
-97
View File
@@ -1,97 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetFounder : public Command
{
public:
CommandCSSetFounder(Module *creator, const Anope::string &cname = "chanserv/set/founder") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Set the founder of a channel"));
this->SetSyntax(_("\037channel\037 \037nick\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (source.permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")))
{
source.Reply(ACCESS_DENIED);
return;
}
const NickAlias *na = NickAlias::Find(params[1]);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str());
return;
}
NickCore *nc = na->nc;
if (Config->CSMaxReg && nc->channelcount >= Config->CSMaxReg && !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;
ci->SetFounder(nc);
source.Reply(_("Founder of \002%s\002 changed to \002%s\002."), ci->name.c_str(), na->nick.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the founder of a channel. The new nickname must\n"
"be a registered one."), this->name.c_str());
return true;
}
};
class CSSetFounder : public Module
{
CommandCSSetFounder commandcssetfounder;
public:
CSSetFounder(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetfounder(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetFounder)
-87
View File
@@ -1,87 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetKeepTopic : public Command
{
public:
CommandCSSetKeepTopic(Module *creator, const Anope::string &cname = "chanserv/set/keeptopic") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Retain topic when channel is not in use"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_KEEPTOPIC);
source.Reply(_("Topic retention option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_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
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002topic retention\002 option for a\n"
"channel. When \002%s\002 is set, the topic for the\n"
"channel will be remembered by %s even after the\n"
"last user leaves the channel, and will be restored the\n"
"next time the channel is created."), this->name.c_str(), source.service->nick.c_str());
return true;
}
};
class CSSetKeepTopic : public Module
{
CommandCSSetKeepTopic commandcssetkeeptopic;
public:
CSSetKeepTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetkeeptopic(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetKeepTopic)
-85
View File
@@ -1,85 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetPeace : public Command
{
public:
CommandCSSetPeace(Module *creator, const Anope::string &cname = "chanserv/set/peace") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Regulate the use of critical commands"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_PEACE);
source.Reply(_("Peace option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_PEACE);
source.Reply(_("Peace option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "PEACE");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002peace\002 option for a channel.\n"
"When \002peace\002 is set, a user won't be able to kick,\n"
"ban or remove a channel status of a user that has\n"
"a level superior or equal to his via %s commands."), source.service->nick.c_str());
return true;
}
};
class CSSetPeace : public Module
{
CommandCSSetPeace commandcssetpeace;
public:
CSSetPeace(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetpeace(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetPeace)
-177
View File
@@ -1,177 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetPersist : public Command
{
public:
CommandCSSetPersist(Module *creator, const Anope::string &cname = "chanserv/set/persist") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Set the channel as permanent"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PERM);
if (params[1].equals_ci("ON"))
{
if (!ci->HasFlag(CI_PERSIST))
{
ci->SetFlag(CI_PERSIST);
if (ci->c)
ci->c->SetFlag(CH_PERSIST);
/* Channel doesn't exist, create it */
if (!ci->c)
{
Channel *c = new Channel(ci->name);
if (ci->bi)
ci->bi->Join(c);
}
/* No botserv bot, no channel mode, give them ChanServ.
* Yes, this works fine with no Config->BotServ.
*/
if (!ci->bi && !cm)
{
if (!ChanServ)
{
source.Reply(_("ChanServ is required to enable persist on this network."));
return;
}
ChanServ->Assign(NULL, ci);
if (!ci->c->FindUser(ChanServ))
ChanServ->Join(ci->c);
}
/* Set the perm mode */
if (cm)
{
if (ci->c && !ci->c->HasMode(CMODE_PERM))
ci->c->SetMode(NULL, cm);
/* Add it to the channels mlock */
ci->SetMLock(cm, true);
}
}
source.Reply(_("Channel \002%s\002 is now persistent."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
if (ci->HasFlag(CI_PERSIST))
{
ci->UnsetFlag(CI_PERSIST);
if (ci->c)
ci->c->UnsetFlag(CH_PERSIST);
/* Unset perm mode */
if (cm)
{
if (ci->c && ci->c->HasMode(CMODE_PERM))
ci->c->RemoveMode(NULL, cm);
/* Remove from mlock */
ci->RemoveMLock(cm, true);
}
/* 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 (!ChanServ)
{
source.Reply(_("ChanServ is required to enable persist on this network."));
return;
}
/* Unassign bot */
ChanServ->UnAssign(NULL, ci);
}
}
source.Reply(_("Channel \002%s\002 is no longer persistent."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "PERSIST");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the persistent channel setting.\n"
"When persistent is set, the service bot will remain\n"
"in the channel when it has emptied of users.\n"
" \n"
"If your IRCd does not have a permanent (persistent) channel\n"
"mode you must have a service bot in your channel to\n"
"set persist on, and it can not be unassigned while persist\n"
"is on.\n"
" \n"
"If this network does not have BotServ enabled and does\n"
"not have a permanent channel mode, ChanServ will\n"
"join your channel when you set persist on (and leave when\n"
"it has been set off).\n"
" \n"
"If your IRCd has a permanent (persistent) channel mode\n"
"and it is set or unset (for any reason, including MODE LOCK),\n"
"persist is automatically set and unset for the channel aswell.\n"
"Additionally, services will set or unset this mode when you\n"
"set persist on or off."));
return true;
}
};
class CSSetPersist : public Module
{
CommandCSSetPersist commandcssetpeace;
public:
CSSetPersist(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetpeace(this)
{
this->SetAuthor("Anope");
ModuleManager::Attach(I_OnDelChan, this);
}
void OnDelChan(ChannelInfo *ci) anope_override
{
if (ci->c && ci->HasFlag(CI_PERSIST))
ci->c->RemoveMode(NULL, CMODE_PERM, "", false);
}
};
MODULE_INIT(CSSetPersist)
-86
View File
@@ -1,86 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetPrivate : public Command
{
public:
CommandCSSetPrivate(Module *creator, const Anope::string &cname = "chanserv/set/private") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Hide channel from LIST command"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_PRIVATE);
source.Reply(_("Private option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_PRIVATE);
source.Reply(_("Private option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "PRIVATE");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
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());
return true;
}
};
class CSSetPrivate : public Module
{
CommandCSSetPrivate commandcssetprivate;
public:
CSSetPrivate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetprivate(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetPrivate)
-84
View File
@@ -1,84 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetRestricted : public Command
{
public:
CommandCSSetRestricted(Module *creator, const Anope::string &cname = "chanserv/set/restricted") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Restrict access to the channel"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_RESTRICTED);
source.Reply(_("Restricted access option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_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
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002restricted access\002 option for a\n"
"channel. When \002restricted access\002 is set, users not on the access list will\n"
"instead be kicked and banned from the channel."));
return true;
}
};
class CSSetRestricted : public Module
{
CommandCSSetRestricted commandcssetrestricted;
public:
CSSetRestricted(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetrestricted(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetRestricted)
-87
View File
@@ -1,87 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetSecure : public Command
{
public:
CommandCSSetSecure(Module *creator, const Anope::string &cname = "chanserv/set/secure") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Activate security features"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_SECURE);
source.Reply(_("Secure option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_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
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables security features for a\n"
"channel. When \002%s\002 is set, only users who have\n"
"registered their nicknames and IDENTIFY'd\n"
"with their password will be given access to the channel\n"
"as controlled by the access list."), this->name.c_str());
return true;
}
};
class CSSetSecure : public Module
{
CommandCSSetSecure commandcssetsecure;
public:
CSSetSecure(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetsecure(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetSecure)
-87
View File
@@ -1,87 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetSecureFounder : public Command
{
public:
CommandCSSetSecureFounder(Module *creator, const Anope::string &cname = "chanserv/set/securefounder") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Stricter control of channel founder status"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_SECUREFOUNDER);
source.Reply(_("Secure founder option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_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
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002secure founder\002 option for a channel.\n"
"When \002secure founder\002 is set, only the real founder will be\n"
"able to drop the channel, change its founder and its successor,\n"
"and not those who have founder level access through\n"
"the access/qop command."));
return true;
}
};
class CSSetSecureFounder : public Module
{
CommandCSSetSecureFounder commandcssetsecurefounder;
public:
CSSetSecureFounder(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetsecurefounder(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetSecureFounder)
-85
View File
@@ -1,85 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetSecureOps : public Command
{
public:
CommandCSSetSecureOps(Module *creator, const Anope::string &cname = "chanserv/set/secureops") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Stricter control of chanop status"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_SECUREOPS);
source.Reply(_("Secure ops option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_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
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002secure ops\002 option for a channel.\n"
"When \002secure ops\002 is set, users who are not on the userlist\n"
"will not be allowed chanop status."));
return true;
}
};
class CSSetSecureOps : public Module
{
CommandCSSetSecureOps commandcssetsecureops;
public:
CSSetSecureOps(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetsecureops(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetSecureOps)
-97
View File
@@ -1,97 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetSignKick : public Command
{
public:
CommandCSSetSignKick(Module *creator, const Anope::string &cname = "chanserv/set/signkick") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Sign kicks that are done with KICK command"));
this->SetSyntax(_("\037channel\037 SIGNKICK {ON | LEVEL | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_SIGNKICK);
ci->UnsetFlag(CI_SIGNKICK_LEVEL);
source.Reply(_("Signed kick option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("LEVEL"))
{
ci->SetFlag(CI_SIGNKICK_LEVEL);
ci->UnsetFlag(CI_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());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_SIGNKICK);
ci->UnsetFlag(CI_SIGNKICK_LEVEL);
source.Reply(_("Signed kick option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "SIGNKICK");
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables signed kicks for a\n"
"channel. When \002SIGNKICK\002 is set, kicks issued with\n"
"the \002KICK\002 command will have the nick that used the\n"
"command in their reason.\n"
" \n"
"If you use \002LEVEL\002, those who have a level that is superior\n"
"or equal to the SIGNKICK level on the channel won't have their\n"
"kicks signed."));
return true;
}
};
class CSSetSignKick : public Module
{
CommandCSSetSignKick commandcssetsignkick;
public:
CSSetSignKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetsignkick(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetSignKick)
-115
View File
@@ -1,115 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetSuccessor : public Command
{
public:
CommandCSSetSuccessor(Module *creator, const Anope::string &cname = "chanserv/set/successor") : Command(creator, cname, 1, 2)
{
this->SetDesc(_("Set the successor for a channel"));
this->SetSyntax(_("\037channel\037 \037nick\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty())
{
if (!source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"))
{
source.Reply(ACCESS_DENIED);
return;
}
}
NickCore *nc;
if (params.size() > 1)
{
const NickAlias *na = NickAlias::Find(params[1]);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str());
return;
}
if (na->nc == ci->GetFounder())
{
source.Reply(_("%s cannot be the successor on channel %s as they are the founder."), na->nick.c_str(), ci->name.c_str());
return;
}
nc = na->nc;
}
else
nc = NULL;
Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to change the successor from " << (ci->successor ? ci->successor->display : "(none)") << " to " << (nc ? nc->display : "(none)");
ci->successor = nc;
if (nc)
source.Reply(_("Successor for \002%s\002 changed to \002%s\002."), ci->name.c_str(), nc->display.c_str());
else
source.Reply(_("Successor for \002%s\002 unset."), ci->name.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
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"
"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);
return true;
}
};
class CSSetSuccessor : public Module
{
CommandCSSetSuccessor commandcssetsuccessor;
public:
CSSetSuccessor(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssetsuccessor(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetSuccessor)
-85
View File
@@ -1,85 +0,0 @@
/* ChanServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandCSSetTopicLock : public Command
{
public:
CommandCSSetTopicLock(Module *creator, const Anope::string &cname = "chanserv/set/topiclock") : Command(creator, cname, 2, 2)
{
this->SetDesc(_("Topic can only be changed with TOPIC"));
this->SetSyntax(_("\037channel\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetChannelOption, OnSetChannelOption(source, this, ci, params[1]));
if (MOD_RESULT == EVENT_STOP)
return;
if (MOD_RESULT != EVENT_ALLOW && source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("ON"))
{
ci->SetFlag(CI_TOPICLOCK);
source.Reply(_("Topic lock option for %s is now \002on\002."), ci->name.c_str());
}
else if (params[1].equals_ci("OFF"))
{
ci->UnsetFlag(CI_TOPICLOCK);
source.Reply(_("Topic lock option for %s is now \002off\002."), ci->name.c_str());
}
else
this->OnSyntaxError(source, "TOPICLOCK");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Enables or disables the \002topic lock\002 option for a channel.\n"
"When \002topic lock\002 is set, the channel topic will be unchangable\n"
"except via the \002TOPIC\002 command."));
return true;
}
};
class CSSetTopicLock : public Module
{
CommandCSSetTopicLock commandcssettopiclock;
public:
CSSetTopicLock(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandcssettopiclock(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(CSSetTopicLock)
-128
View File
@@ -1,128 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSASet : public Command
{
public:
CommandNSSASet(Module *creator) : Command(creator, "nickserv/saset", 2, 4)
{
this->SetDesc(_("Set SET-options on another nickname"));
this->SetSyntax(_("\037option\037 \037nickname\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(_("Sets various nickname options. \037option\037 can be one of:"));
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 = c_name;
command->OnServHelp(source);
}
}
}
source.Reply(_("Type \002%s%s HELP SASET \037option\037\002 for more information\n"
"on a specific option. The options will be set on the given\n"
"\037nickname\037."), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str());
return true;
}
};
class CommandNSSASetPassword : public Command
{
public:
CommandNSSASetPassword(Module *creator) : Command(creator, "nickserv/saset/password", 2, 2)
{
this->SetDesc(_("Set the nickname password"));
this->SetSyntax(_("\037nickname\037 \037new-password\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const NickAlias *setter_na = NickAlias::Find(params[0]);
if (setter_na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
return;
}
NickCore *nc = setter_na->nc;
size_t len = params[1].length();
if (Config->NSSecureAdmins && source.nc != nc && nc->IsServicesOper())
{
source.Reply(_("You may not change the password of other services operators."));
return;
}
else if (nc->display.equals_ci(params[1]) || (Config->StrictPasswords && len < 5))
{
source.Reply(MORE_OBSCURE_PASSWORD);
return;
}
else if (len > Config->PassLen)
{
source.Reply(PASSWORD_TOO_LONG);
return;
}
Anope::Encrypt(params[1], nc->pass);
Anope::string tmp_pass;
if (Anope::Decrypt(nc->pass, tmp_pass) == 1)
source.Reply(_("Password for \002%s\002 changed to \002%s\002."), nc->display.c_str(), tmp_pass.c_str());
else
source.Reply(_("Password for \002%s\002 changed."), nc->display.c_str());
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the password used to identify as the nick's owner."));
return true;
}
};
class NSSASet : public Module
{
CommandNSSASet commandnssaset;
CommandNSSASetPassword commandnssasetpassword;
public:
NSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssaset(this), commandnssasetpassword(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(NSSASet)
-75
View File
@@ -1,75 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSASetNoexpire : public Command
{
public:
CommandNSSASetNoexpire(Module *creator) : Command(creator, "nickserv/saset/noexpire", 1, 2)
{
this->SetDesc(_("Prevent the nickname from expiring"));
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
NickAlias *na = NickAlias::Find(params[0]);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
return;
}
Anope::string param = params.size() > 1 ? params[1] : "";
if (param.equals_ci("ON"))
{
na->SetFlag(NS_NO_EXPIRE);
source.Reply(_("Nick %s \002will not\002 expire."), na->nick.c_str());
}
else if (param.equals_ci("OFF"))
{
na->UnsetFlag(NS_NO_EXPIRE);
source.Reply(_("Nick %s \002will\002 expire."), na->nick.c_str());
}
else
this->OnSyntaxError(source, "NOEXPIRE");
return;
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sets whether the given nickname will expire. Setting this\n"
"to \002ON\002 prevents the nickname from expiring."));
return true;
}
};
class NSSASetNoexpire : public Module
{
CommandNSSASetNoexpire commandnssasetnoexpire;
public:
NSSASetNoexpire(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssasetnoexpire(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(NSSASetNoexpire)
File diff suppressed because it is too large Load Diff
-110
View File
@@ -1,110 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetAutoOp : public Command
{
public:
CommandNSSetAutoOp(Module *creator, const Anope::string &sname = "nickserv/set/autoop", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Should services op you automatically."));
this->SetSyntax(_("{ON | OFF}"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
const NickAlias *na = NickAlias::Find(user);
if (na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
NickCore *nc = na->nc;
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
if (param.equals_ci("ON"))
{
nc->SetFlag(NI_AUTOOP);
source.Reply(_("Services will now autoop %s in channels."), nc->display.c_str());
}
else if (param.equals_ci("OFF"))
{
nc->UnsetFlag(NI_AUTOOP);
source.Reply(_("Services will no longer autoop %s in channels."), nc->display.c_str());
}
else
this->OnSyntaxError(source, "AUTOOP");
return;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, source.nc->display, params[0]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sets whether you will be opped automatically. Set to ON to \n"
"allow ChanServ to op you automatically when entering channels."));
return true;
}
};
class CommandNSSASetAutoOp : public CommandNSSetAutoOp
{
public:
CommandNSSASetAutoOp(Module *creator) : CommandNSSetAutoOp(creator, "nickserv/saset/autoop", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, params[0], params[1]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Sets whether the given nickname will be opped automatically.\n"
"Set to \002ON\002 to allow ChanServ to op the given nickname \n"
"omatically when joining channels."));
return true;
}
};
class NSSetAutoOp : public Module
{
CommandNSSetAutoOp commandnssetautoop;
CommandNSSASetAutoOp commandnssasetautoop;
public:
NSSetAutoOp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetautoop(this), commandnssasetautoop(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(NSSetAutoOp)
-120
View File
@@ -1,120 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetChanstats : public Command
{
public:
CommandNSSetChanstats(Module *creator, const Anope::string &sname = "nickserv/set/chanstats", size_t min = 1 ) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Turn chanstat statistic on or off"));
this->SetSyntax(_("{ON | OFF}"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
NickAlias *na = NickAlias::Find(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, na->nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
if (param.equals_ci("ON"))
{
na->nc->SetFlag(NI_STATS);
source.Reply(_("Chanstat statistics are now enabled for your nick"));
}
else if (param.equals_ci("OFF"))
{
na->nc->UnsetFlag(NI_STATS);
source.Reply(_("Chanstat statistics are now disabled for your nick"));
}
else
this->OnSyntaxError(source, "CHANSTATS");
return;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, source.nc->display, params[0]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Turns Chanstats statistics ON or OFF"));
return true;
}
};
class CommandNSSASetChanstats : public CommandNSSetChanstats
{
public:
CommandNSSASetChanstats(Module *creator) : CommandNSSetChanstats(creator, "nickserv/saset/chanstats", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, params[0], params[1]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Turns chanstats channel statistics ON or OFF for this user"));
return true;
}
};
class NSSetChanstats : public Module
{
CommandNSSetChanstats commandnssetchanstats;
CommandNSSASetChanstats commandnssasetchanstats;
bool NSDefChanstats;
public:
NSSetChanstats(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetchanstats(this), commandnssasetchanstats(this)
{
this->SetAuthor("Anope");
Implementation i[] = { I_OnReload, I_OnNickRegister };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
this->OnReload();
}
void OnReload() anope_override
{
ConfigReader config;
NSDefChanstats = config.ReadFlag("chanstats", "NSDefChanstats", "0", 0);
}
void OnNickRegister(NickAlias *na) anope_override
{
if (NSDefChanstats)
na->nc->SetFlag(NI_STATS);
}
};
MODULE_INIT(NSSetChanstats)
-104
View File
@@ -1,104 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetDisplay : public Command
{
public:
CommandNSSetDisplay(Module *creator, const Anope::string &sname = "nickserv/set/display", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Set the display of your group in Services"));
this->SetSyntax(_("\037new-display\037"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
const NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param);
if (user_na == NULL)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
else if (!na || *na->nc != *user_na->nc)
{
source.Reply(_("The new display MUST be a nickname of the nickname group %s"), user_na->nc->display.c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, user_na->nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
user_na->nc->SetDisplay(na);
source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str());
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, source.nc->display, params[0]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the display used to refer to your nickname group in \n"
"Services. The new display MUST be a nick of your group."));
return true;
}
};
class CommandNSSASetDisplay : public CommandNSSetDisplay
{
public:
CommandNSSASetDisplay(Module *creator) : CommandNSSetDisplay(creator, "nickserv/saset/display", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 \037new-display\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, params[0], params[1]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the display used to refer to the nickname group in \n"
"Services. The new display MUST be a nick of your group."));
return true;
}
};
class NSSetDisplay : public Module
{
CommandNSSetDisplay commandnssetdisplay;
CommandNSSASetDisplay commandnssasetdisplay;
public:
NSSetDisplay(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetdisplay(this), commandnssasetdisplay(this)
{
this->SetAuthor("Anope");
if (Config->NoNicknameOwnership)
throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
}
};
MODULE_INIT(NSSetDisplay)
-190
View File
@@ -1,190 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
static bool SendConfirmMail(User *u, const BotInfo *bi)
{
int chars[] = {
' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
};
int idx, min = 1, max = 62;
Anope::string code;
for (idx = 0; idx < 9; ++idx)
code += chars[1 + static_cast<int>((static_cast<float>(max - min)) * static_cast<uint16_t>(rand()) / 65536.0) + min];
u->Account()->Extend("ns_set_email_passcode", new ExtensibleItemClass<Anope::string>(code));
Anope::string subject = Config->MailEmailchangeSubject;
Anope::string message = Config->MailEmailchangeMessage;
subject = subject.replace_all_cs("%e", u->Account()->email);
subject = subject.replace_all_cs("%N", Config->NetworkName);
subject = subject.replace_all_cs("%c", code);
message = message.replace_all_cs("%e", u->Account()->email);
message = message.replace_all_cs("%N", Config->NetworkName);
message = message.replace_all_cs("%c", code);
return Mail::Send(u, u->Account(), bi, subject, message);
}
class CommandNSSetEmail : public Command
{
public:
CommandNSSetEmail(Module *creator, const Anope::string &cname = "nickserv/set/email", size_t min = 0) : Command(creator, cname, min, min + 1)
{
this->SetDesc(_("Associate an E-mail address with your nickname"));
this->SetSyntax(_("\037address\037"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
const NickAlias *na = NickAlias::Find(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
NickCore *nc = na->nc;
if (param.empty() && Config->NSForceEmail)
{
source.Reply(_("You cannot unset the e-mail on this network."));
return;
}
else if (Config->NSSecureAdmins && source.nc != nc && nc->IsServicesOper())
{
source.Reply(_("You may not change the email of other services operators."));
return;
}
else if (!param.empty() && !Mail::Validate(param))
{
source.Reply(MAIL_X_INVALID, param.c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
if (!param.empty() && Config->NSConfirmEmailChanges && !source.IsServicesOper())
{
source.nc->Extend("ns_set_email", new ExtensibleItemClass<Anope::string>(param));
Anope::string old = source.nc->email;
source.nc->email = param;
if (SendConfirmMail(source.GetUser(), source.service))
source.Reply(_("A confirmation email has been sent to \002%s\002. Follow the instructions in it to change your email address."), param.c_str());
source.nc->email = old;
}
else
{
if (!param.empty())
{
nc->email = param;
source.Reply(_("E-mail address for \002%s\002 changed to \002%s\002."), nc->display.c_str(), param.c_str());
}
else
{
nc->email.clear();
source.Reply(_("E-mail address for \002%s\002 unset."), nc->display.c_str());
}
}
return;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, source.nc->display, params.size() ? params[0] : "");
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Associates the given E-mail address with your nickname.\n"
"This address will be displayed whenever someone requests\n"
"information on the nickname with the \002INFO\002 command."));
return true;
}
};
class CommandNSSASetEmail : public CommandNSSetEmail
{
public:
CommandNSSASetEmail(Module *creator) : CommandNSSetEmail(creator, "nickserv/saset/email", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 \037address\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, params[0], params.size() > 1 ? params[1] : "");
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Associates the given E-mail address with the nickname."));
return true;
}
};
class NSSetEmail : public Module
{
CommandNSSetEmail commandnssetemail;
CommandNSSASetEmail commandnssasetemail;
public:
NSSetEmail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetemail(this), commandnssasetemail(this)
{
this->SetAuthor("Anope");
ModuleManager::Attach(I_OnPreCommand, this);
}
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) anope_override
{
NickCore *uac = source.nc;
if (command->name == "nickserv/confirm" && !params.empty() && uac)
{
Anope::string *new_email = uac->GetExt<ExtensibleItemClass<Anope::string> *>("ns_set_email"), *passcode = uac->GetExt<ExtensibleItemClass<Anope::string> *>("ns_set_email_passcode");
if (new_email && passcode)
{
if (params[0] == *passcode)
{
uac->email = *new_email;
Log(LOG_COMMAND, source, command) << "to confirm their email address change to " << uac->email;
source.Reply(_("Your email address has been changed to \002%s\002."), uac->email.c_str());
uac->Shrink("ns_set_email");
uac->Shrink("ns_set_email_passcode");
return EVENT_STOP;
}
}
}
return EVENT_CONTINUE;
}
};
MODULE_INIT(NSSetEmail)
-111
View File
@@ -1,111 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetGreet : public Command
{
public:
CommandNSSetGreet(Module *creator, const Anope::string &sname = "nickserv/set/greet", size_t min = 0) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Associate a greet message with your nickname"));
this->SetSyntax(_("\037message\037"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
const NickAlias *na = NickAlias::Find(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
NickCore *nc = na->nc;
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
if (!param.empty())
{
nc->greet = param;
source.Reply(_("Greet message for \002%s\002 changed to \002%s\002."), nc->display.c_str(), nc->greet.c_str());
}
else
{
nc->greet.clear();
source.Reply(_("Greet message for \002%s\002 unset."), nc->display.c_str());
}
return;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, source.nc->display, params.size() > 0 ? params[0] : "");
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Makes the given message the greet of your nickname, that\n"
"will be displayed when joining a channel that has GREET\n"
"option enabled, provided that you have the necessary \n"
"access on it."));
return true;
}
};
class CommandNSSASetGreet : public CommandNSSetGreet
{
public:
CommandNSSASetGreet(Module *creator) : CommandNSSetGreet(creator, "nickserv/saset/greet", 1)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 \037message\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, params[0], params.size() > 1 ? params[1] : "");
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Makes the given message the greet of the nickname, that\n"
"will be displayed when joining a channel that has GREET\n"
"option enabled, provided that the user has the necessary \n"
"access on it."));
return true;
}
};
class NSSetGreet : public Module
{
CommandNSSetGreet commandnssetgreet;
CommandNSSASetGreet commandnssasetgreet;
public:
NSSetGreet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetgreet(this), commandnssasetgreet(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(NSSetGreet)
-152
View File
@@ -1,152 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetHide : public Command
{
public:
CommandNSSetHide(Module *creator, const Anope::string &sname = "nickserv/set/hide", size_t min = 2) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Hide certain pieces of nickname information"));
this->SetSyntax(_("{EMAIL | STATUS | USERMASK | QUIT} {ON | OFF}"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param, const Anope::string &arg)
{
const NickAlias *na = NickAlias::Find(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
NickCore *nc = na->nc;
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
Anope::string onmsg, offmsg;
NickCoreFlag flag;
if (param.equals_ci("EMAIL"))
{
flag = NI_HIDE_EMAIL;
onmsg = _("The E-mail address of \002%s\002 will now be hidden from %s INFO displays.");
offmsg = _("The E-mail address of \002%s\002 will now be shown in %s INFO displays.");
}
else if (param.equals_ci("USERMASK"))
{
flag = NI_HIDE_MASK;
onmsg = _("The last seen user@host mask of \002%s\002 will now be hidden from %s INFO displays.");
offmsg = _("The last seen user@host mask of \002%s\002 will now be shown in %s INFO displays.");
}
else if (param.equals_ci("STATUS"))
{
flag = NI_HIDE_STATUS;
onmsg = _("The services access status of \002%s\002 will now be hidden from %s INFO displays.");
offmsg = _("The services access status of \002%s\002 will now be shown in %s INFO displays.");
}
else if (param.equals_ci("QUIT"))
{
flag = NI_HIDE_QUIT;
onmsg = _("The last quit message of \002%s\002 will now be hidden from %s INFO displays.");
offmsg = _("The last quit message of \002%s\002 will now be shown in %s INFO displays.");
}
else
{
this->OnSyntaxError(source, "HIDE");
return;
}
if (arg.equals_ci("ON"))
{
nc->SetFlag(flag);
source.Reply(onmsg.c_str(), nc->display.c_str(), Config->NickServ.c_str());
}
else if (arg.equals_ci("OFF"))
{
nc->UnsetFlag(flag);
source.Reply(offmsg.c_str(), nc->display.c_str(), Config->NickServ.c_str());
}
else
this->OnSyntaxError(source, "HIDE");
return;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, source.nc->display, params[0], params[1]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows you to prevent certain pieces of information from\n"
"being displayed when someone does a %s \002INFO\002 on your\n"
"nick. You can hide your E-mail address (\002EMAIL\002), last seen\n"
"user@host mask (\002USERMASK\002), your services access status\n"
"(\002STATUS\002) and last quit message (\002QUIT\002).\n"
"The second parameter specifies whether the information should\n"
"be displayed (\002OFF\002) or hidden (\002ON\002)."), Config->NickServ.c_str());
return true;
}
};
class CommandNSSASetHide : public CommandNSSetHide
{
public:
CommandNSSASetHide(Module *creator) : CommandNSSetHide(creator, "nickserv/saset/hide", 3)
{
this->SetSyntax("\037nickname\037 {EMAIL | STATUS | USERMASK | QUIT} {ON | OFF}");
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->ClearSyntax();
this->Run(source, params[0], params[1], params[2]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows you to prevent certain pieces of information from\n"
"being displayed when someone does a %s \002INFO\002 on the\n"
"nick. You can hide the E-mail address (\002EMAIL\002), last seen\n"
"user@host mask (\002USERMASK\002), the services access status\n"
"(\002STATUS\002) and last quit message (\002QUIT\002).\n"
"The second parameter specifies whether the information should\n"
"be displayed (\002OFF\002) or hidden (\002ON\002)."), Config->NickServ.c_str());
return true;
}
};
class NSSetHide : public Module
{
CommandNSSetHide commandnssethide;
CommandNSSASetHide commandnssasethide;
public:
NSSetHide(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssethide(this), commandnssasethide(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(NSSetHide)
-154
View File
@@ -1,154 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetKill : public Command
{
public:
CommandNSSetKill(Module *creator, const Anope::string &sname = "nickserv/set/kill", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Turn protection on or off"));
this->SetSyntax(_("{ON | QUICK | IMMED | OFF}"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
const NickAlias *na = NickAlias::Find(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
NickCore *nc = na->nc;
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
if (param.equals_ci("ON"))
{
nc->SetFlag(NI_KILLPROTECT);
nc->UnsetFlag(NI_KILL_QUICK);
nc->UnsetFlag(NI_KILL_IMMED);
source.Reply(_("Protection is now \002on\002 for \002%s\002."), nc->display.c_str());
}
else if (param.equals_ci("QUICK"))
{
nc->SetFlag(NI_KILLPROTECT);
nc->SetFlag(NI_KILL_QUICK);
nc->UnsetFlag(NI_KILL_IMMED);
source.Reply(_("Protection is now \002on\002 for \002%s\002, with a reduced delay."), nc->display.c_str());
}
else if (param.equals_ci("IMMED"))
{
if (Config->NSAllowKillImmed)
{
nc->SetFlag(NI_KILLPROTECT);
nc->SetFlag(NI_KILL_IMMED);
nc->UnsetFlag(NI_KILL_QUICK);
source.Reply(_("Protection is now \002on\002 for \002%s\002, with no delay."), nc->display.c_str());
}
else
source.Reply(_("The \002IMMED\002 option is not available on this network."));
}
else if (param.equals_ci("OFF"))
{
nc->UnsetFlag(NI_KILLPROTECT);
nc->UnsetFlag(NI_KILL_QUICK);
nc->UnsetFlag(NI_KILL_IMMED);
source.Reply(_("Protection is now \002off\002 for \002%s\002."), nc->display.c_str());
}
else
this->OnSyntaxError(source, "KILL");
return;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, source.nc->display, params[0]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Turns the automatic protection option for your nick\n"
"on or off. With protection on, if another user\n"
"tries to take your nick, they will be given one minute to\n"
"change to another nick, after which %s will forcibly change\n"
"their nick.\n"
" \n"
"If you select \002QUICK\002, the user will be given only 20 seconds\n"
"to change nicks instead of the usual 60. If you select\n"
"\002IMMED\002, user's nick will be changed immediately \037without\037 being\n"
"warned first or given a chance to change their nick; please\n"
"do not use this option unless necessary. Also, your\n"
"network's administrators may have disabled this option."), Config->NickServ.c_str());
return true;
}
};
class CommandNSSASetKill : public CommandNSSetKill
{
public:
CommandNSSASetKill(Module *creator) : CommandNSSetKill(creator, "nickserv/saset/kill", 2)
{
this->SetSyntax(_("\037nickname\037 {ON | QUICK | IMMED | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->ClearSyntax();
this->Run(source, params[0], params[1]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Turns the automatic protection option for the nick\n"
"on or off. With protection on, if another user\n"
"tries to take the nick, they will be given one minute to\n"
"change to another nick, after which %s will forcibly change\n"
"their nick.\n"
" \n"
"If you select \002QUICK\002, the user will be given only 20 seconds\n"
"to change nicks instead of the usual 60. If you select\n"
"\002IMMED\002, the user's nick will be changed immediately \037without\037 being\n"
"warned first or given a chance to change their nick; please\n"
"do not use this option unless necessary. Also, your\n"
"network's administrators may have disabled this option."), Config->NickServ.c_str());
return true;
}
};
class NSSetKill : public Module
{
CommandNSSetKill commandnssetkill;
CommandNSSASetKill commandnssasetkill;
public:
NSSetKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetkill(this), commandnssasetkill(this)
{
this->SetAuthor("Anope");
if (Config->NoNicknameOwnership)
throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
}
};
MODULE_INIT(NSSetKill)
-132
View File
@@ -1,132 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetLanguage : public Command
{
public:
CommandNSSetLanguage(Module *creator, const Anope::string &sname = "nickserv/set/language", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Set the language Services will use when messaging you"));
this->SetSyntax(_("\037language\037"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
const NickAlias *na = NickAlias::Find(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
NickCore *nc = na->nc;
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
for (unsigned j = 0; j < Language::Languages.size(); ++j)
{
if (param == "en" || Language::Languages[j] == param)
break;
else if (j + 1 == Language::Languages.size())
{
this->OnSyntaxError(source, "");
return;
}
}
nc->language = param != "en" ? param : "";
source.Reply(_("Language changed to \002English\002."));
return;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &param) anope_override
{
this->Run(source, source.nc->display, param[0]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the language Services uses when sending messages to\n"
"you (for example, when responding to a command you send).\n"
"\037language\037 should be chosen from the following list of\n"
"supported languages:"));
source.Reply(" en (English)");
for (unsigned j = 0; j < Language::Languages.size(); ++j)
{
const Anope::string &langname = Language::Translate(Language::Languages[j].c_str(), _("English"));
if (langname == "English")
continue;
source.Reply(" %s (%s)", Language::Languages[j].c_str(), langname.c_str());
}
return true;
}
};
class CommandNSSASetLanguage : public CommandNSSetLanguage
{
public:
CommandNSSASetLanguage(Module *creator) : CommandNSSetLanguage(creator, "nickserv/saset/language", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 \037language\037"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, params[0], params[1]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Changes the language Services uses when sending messages to\n"
"the given user (for example, when responding to a command they send).\n"
"\037language\037 should be chosen from the following list of\n"
"supported languages:"));
source.Reply(" en (English)");
for (unsigned j = 0; j < Language::Languages.size(); ++j)
{
const Anope::string &langname = Language::Translate(Language::Languages[j].c_str(), _("English"));
if (langname == "English")
continue;
source.Reply(" %s (%s)", Language::Languages[j].c_str(), langname.c_str());
}
return true;
}
};
class NSSetLanguage : public Module
{
CommandNSSetLanguage commandnssetlanguage;
CommandNSSASetLanguage commandnssasetlanguage;
public:
NSSetLanguage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetlanguage(this), commandnssasetlanguage(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(NSSetLanguage)
-123
View File
@@ -1,123 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetMessage : public Command
{
public:
CommandNSSetMessage(Module *creator, const Anope::string &sname = "nickserv/set/message", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Change the communication method of Services"));
this->SetSyntax(_("{ON | OFF}"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
const NickAlias *na = NickAlias::Find(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
NickCore *nc = na->nc;
if (!Config->UsePrivmsg)
{
source.Reply(_("You cannot %s on this network."), source.command.c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
if (param.equals_ci("ON"))
{
nc->SetFlag(NI_MSG);
source.Reply(_("Services will now reply to \002%s\002 with \002messages\002."), nc->display.c_str());
}
else if (param.equals_ci("OFF"))
{
nc->UnsetFlag(NI_MSG);
source.Reply(_("Services will now reply to \002%s\002 with \002notices\002."), nc->display.c_str());
}
else
this->OnSyntaxError(source, "MSG");
return;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, source.nc->display, params[0]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows you to choose the way Services are communicating with \n"
"you. With \002MSG\002 set, Services will use messages, else they'll \n"
"use notices."));
return true;
}
void OnServHelp(CommandSource &source) anope_override
{
if (Config->UsePrivmsg)
Command::OnServHelp(source);
}
};
class CommandNSSASetMessage : public CommandNSSetMessage
{
public:
CommandNSSASetMessage(Module *creator) : CommandNSSetMessage(creator, "nickserv/saset/message", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Allows you to choose the way Services are communicating with \n"
"the given user. With \002MSG\002 set, Services will use messages,\n"
"else they'll use notices."));
return true;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, params[0], params[1]);
}
};
class NSSetMessage : public Module
{
CommandNSSetMessage commandnssetmessage;
CommandNSSASetMessage commandnssasetmessage;
public:
NSSetMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetmessage(this), commandnssasetmessage(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(NSSetMessage)
-117
View File
@@ -1,117 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetPrivate : public Command
{
public:
CommandNSSetPrivate(Module *creator, const Anope::string &sname = "nickserv/set/private", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(Anope::printf(_("Prevent the nickname from appearing in a \002%s%s LIST\002"), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str()));
this->SetSyntax(_("{ON | OFF}"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
const NickAlias *na = NickAlias::Find(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
NickCore *nc = na->nc;
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
if (param.equals_ci("ON"))
{
nc->SetFlag(NI_PRIVATE);
source.Reply(_("Private option is now \002on\002 for \002%s\002."), nc->display.c_str());
}
else if (param.equals_ci("OFF"))
{
nc->UnsetFlag(NI_PRIVATE);
source.Reply(_("Private option is now \002off\002 for \002%s\002."), nc->display.c_str());
}
else
this->OnSyntaxError(source, "PRIVATE");
return;
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, source.nc->display, params[0]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Turns %s's privacy option on or off for your nick.\n"
"With \002PRIVATE\002 set, your nickname will not appear in\n"
"nickname lists generated with %s's \002LIST\002 command.\n"
"(However, anyone who knows your nickname can still get\n"
"information on it using the \002INFO\002 command.)"),
Config->NickServ.c_str(), Config->NickServ.c_str());
return true;
}
};
class CommandNSSASetPrivate : public CommandNSSetPrivate
{
public:
CommandNSSASetPrivate(Module *creator) : CommandNSSetPrivate(creator, "nickserv/saset/private", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, params[0], params[1]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Turns %s's privacy option on or off for the nick.\n"
"With \002PRIVATE\002 set, the nickname will not appear in\n"
"nickname lists generated with %s's \002LIST\002 command.\n"
"(However, anyone who knows the nickname can still get\n"
"information on it using the \002INFO\002 command.)"),
Config->NickServ.c_str(), Config->NickServ.c_str());
return true;
}
};
class NSSetPrivate : public Module
{
CommandNSSetPrivate commandnssetprivate;
CommandNSSASetPrivate commandnssasetprivate;
public:
NSSetPrivate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetprivate(this), commandnssasetprivate(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(NSSetPrivate)
-117
View File
@@ -1,117 +0,0 @@
/* NickServ core functions
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
/*************************************************************************/
#include "module.h"
class CommandNSSetSecure : public Command
{
public:
CommandNSSetSecure(Module *creator, const Anope::string &sname = "nickserv/set/secure", size_t min = 1) : Command(creator, sname, min, min + 1)
{
this->SetDesc(_("Turn nickname security on or off"));
this->SetSyntax(_("{ON | OFF}"));
}
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
{
const NickAlias *na = NickAlias::Find(user);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
return;
}
NickCore *nc = na->nc;
EventReturn MOD_RESULT;
FOREACH_RESULT(I_OnSetNickOption, OnSetNickOption(source, this, nc, param));
if (MOD_RESULT == EVENT_STOP)
return;
if (param.equals_ci("ON"))
{
nc->SetFlag(NI_SECURE);
source.Reply(_("Secure option is now \002on\002 for \002%s\002."), nc->display.c_str());
}
else if (param.equals_ci("OFF"))
{
nc->UnsetFlag(NI_SECURE);
source.Reply(_("Secure option is now \002off\002 for \002%s\002."), nc->display.c_str());
}
else
this->OnSyntaxError(source, "SECURE");
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, source.nc->display, params[0]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Turns %s's security features on or off for your\n"
"nick. With \002SECURE\002 set, you must enter your password\n"
"before you will be recognized as the owner of the nick,\n"
"regardless of whether your address is on the access\n"
"list. However, if you are on the access list, %s\n"
"will not auto-kill you regardless of the setting of the\n"
"\002KILL\002 option."), Config->NickServ.c_str(), Config->NickServ.c_str());
return true;
}
};
class CommandNSSASetSecure : public CommandNSSetSecure
{
public:
CommandNSSASetSecure(Module *creator) : CommandNSSetSecure(creator, "nickserv/saset/secure", 2)
{
this->ClearSyntax();
this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
this->Run(source, params[0], params[1]);
}
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Turns %s's security features on or off for your\n"
"nick. With \002SECURE\002 set, you must enter your password\n"
"before you will be recognized as the owner of the nick,\n"
"regardless of whether your address is on the access\n"
"list. However, if you are on the access list, %s\n"
"will not auto-kill you regardless of the setting of the\n"
"\002KILL\002 option."), Config->NickServ.c_str(), Config->NickServ.c_str());
return true;
}
};
class NSSetSecure : public Module
{
CommandNSSetSecure commandnssetsecure;
CommandNSSASetSecure commandnssasetsecure;
public:
NSSetSecure(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
commandnssetsecure(this), commandnssasetsecure(this)
{
this->SetAuthor("Anope");
}
};
MODULE_INIT(NSSetSecure)
+2 -5
View File
@@ -1,5 +1,5 @@
/* ns_maxemail.c - Limit the amount of times an email address
* can be used for a NickServ account.
/* ns_maxemail.cpp - Limit the amount of times an email address
* can be used for a NickServ account.
*
* (C) 2003-2012 Anope Team
* Contact us at team@anope.org
@@ -8,9 +8,6 @@
* Anope Coder: GeniusDex <geniusdex@anope.org>
*
* Please read COPYING and README for further details.
*
* Send any bug reports to the Anope Coder, as he will be able
* to deal with it best.
*/
#include "module.h"