diff options
author | Adam <Adam@anope.org> | 2011-11-18 11:22:01 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-11-18 11:22:01 -0500 |
commit | c43cdf438fb388c6989cca78d44be0c650c6c013 (patch) | |
tree | 080f742871b072d8a338f21fbe2067526f85b9f3 /modules/commands/os_login.cpp | |
parent | 837421123996de045d240db6ee85e1215c8f436b (diff) |
Added operserv/logout
Diffstat (limited to 'modules/commands/os_login.cpp')
-rw-r--r-- | modules/commands/os_login.cpp | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/modules/commands/os_login.cpp b/modules/commands/os_login.cpp index d08310424..acaea5cc6 100644 --- a/modules/commands/os_login.cpp +++ b/modules/commands/os_login.cpp @@ -60,17 +60,54 @@ class CommandOSLogin : public Command } }; +class CommandOSLogout : public Command +{ + public: + CommandOSLogout(Module *creator) : Command(creator, "operserv/logout", 0, 0) + { + this->SetDesc(Anope::printf(_("Logout from to %s"), Config->OperServ.c_str())); + this->SetSyntax(""); + } + + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) + { + Oper *o = source.u->Account()->o; + if (o == NULL) + 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 (!source.u->HasExt("os_login_password_correct")) + source.Reply(_("You are not identified.")); + else + { + Log(LOG_ADMIN, source.u, this); + source.u->Shrink("os_login_password_correct"); + source.Reply(_("You have been logged out.")); + } + } + + bool OnHelp(CommandSource &source, const Anope::string &subcommand) + { + this->SendSyntax(source); + source.Reply(" "); + source.Reply(_("Logs you out from %s so you lose Services Operator privileges.\n" + "This command is only useful if your oper block is configured\n" + "with a password."), source.owner->nick.c_str()); + return true; + } +}; + class OSLogin : public Module { CommandOSLogin commandoslogin; + CommandOSLogout commandoslogout; public: OSLogin(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - commandoslogin(this) + commandoslogin(this), commandoslogout(this) { this->SetAuthor("Anope"); - ModuleManager::Attach(I_IsServicesOper, this); } |