summaryrefslogtreecommitdiff
path: root/modules/commands/os_login.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-07-01 22:17:52 -0400
committerAdam <Adam@anope.org>2013-07-01 22:17:52 -0400
commit1a3d9a016d3adc49788bbff73aac9b3b5ea85b17 (patch)
treec0ecf92ed768473bc82ff64a7fce827245f37ba9 /modules/commands/os_login.cpp
parent518182ac9204f815258b0de91b3f884d8efa1502 (diff)
Change extensible keys to require explicitly having a type defined for it. Completely modularize more features like bs_kick, entrymsg, log, mode, etc. Move fantasy to its own module. Move greet to its own module.
Diffstat (limited to 'modules/commands/os_login.cpp')
-rw-r--r--modules/commands/os_login.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/modules/commands/os_login.cpp b/modules/commands/os_login.cpp
index 9d666188a..6c1edecfb 100644
--- a/modules/commands/os_login.cpp
+++ b/modules/commands/os_login.cpp
@@ -31,7 +31,7 @@ class CommandOSLogin : public Command
source.Reply(_("No oper block for your nick."));
else if (o->password.empty())
source.Reply(_("Your oper block doesn't require logging in."));
- else if (u->HasExt("os_login_password_correct"))
+ else if (u->HasExt("os_login"))
source.Reply(_("You are already identified."));
else if (o->password != password)
{
@@ -41,11 +41,9 @@ class CommandOSLogin : public Command
else
{
Log(LOG_ADMIN, source, this) << "and successfully identified to " << source.service->nick;
- u->Extend("os_login_password_correct");
+ u->Extend<bool>("os_login");
source.Reply(_("Password accepted."));
}
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
@@ -80,12 +78,12 @@ class CommandOSLogout : public Command
source.Reply(_("No oper block for your nick."));
else if (o->password.empty())
source.Reply(_("Your oper block doesn't require logging in."));
- else if (!u->HasExt("os_login_password_correct"))
+ else if (!u->HasExt("os_login"))
source.Reply(_("You are not identified."));
else
{
Log(LOG_ADMIN, source, this);
- u->Shrink("os_login_password_correct");
+ u->Shrink<bool>("os_login");
source.Reply(_("You have been logged out."));
}
}
@@ -110,25 +108,20 @@ class OSLogin : public Module
{
CommandOSLogin commandoslogin;
CommandOSLogout commandoslogout;
+ ExtensibleItem<bool> os_login;
public:
OSLogin(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- commandoslogin(this), commandoslogout(this)
+ commandoslogin(this), commandoslogout(this), os_login(this, "os_login")
{
}
- ~OSLogin()
- {
- for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
- it->second->Shrink("os_login_password_correct");
- }
-
EventReturn IsServicesOper(User *u) anope_override
{
if (!u->Account()->o->password.empty())
{
- if (u->HasExt("os_login_password_correct"))
+ if (os_login.HasExt(u))
return EVENT_ALLOW;
return EVENT_STOP;
}