diff options
Diffstat (limited to 'modules/commands/os_oper.cpp')
-rw-r--r-- | modules/commands/os_oper.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/modules/commands/os_oper.cpp b/modules/commands/os_oper.cpp index 0f4458cea..923137013 100644 --- a/modules/commands/os_oper.cpp +++ b/modules/commands/os_oper.cpp @@ -34,7 +34,7 @@ class CommandOSOper : public Command this->SetDesc(_("View and change Services Operators")); this->SetSyntax(_("ADD \037oper\037 \037type\037")); this->SetSyntax(_("DEL \037oper\037")); - this->SetSyntax(_("INFO \037type\037")); + this->SetSyntax(_("INFO [\037type\037]")); this->SetSyntax("LIST"); } @@ -47,16 +47,16 @@ class CommandOSOper : public Command const Anope::string &oper = params[1]; const Anope::string &otype = params[2]; - NickServ::Nick *na = NickServ::FindNick(oper); - if (na == NULL) + if (!source.HasPriv("operserv/oper/modify")) { - source.Reply(_("\002{0}\002 isn't currently online."), oper); + source.Reply(_("Access denied. You do not have the operator privilege \002{0}\002."), "operserv/oper/modify"); return; } - if (na->GetAccount()->o) + NickServ::Nick *na = NickServ::FindNick(oper); + if (na == NULL) { - source.Reply(_("Nick \002{0}\002 is already an operator."), na->GetNick()); + source.Reply(_("\002{0}\002 isn't currently online."), oper); return; } @@ -73,6 +73,12 @@ class CommandOSOper : public Command return; } + if (na->GetAccount()->o) + { + na->GetAccount()->o->Delete(); + na->GetAccount()->o = nullptr; + } + Oper *o = operblock.Create(); o->SetName(na->GetAccount()->GetDisplay()); o->SetType(ot); @@ -90,6 +96,12 @@ class CommandOSOper : public Command { const Anope::string &oper = params[1]; + if (!source.HasPriv("operserv/oper/modify")) + { + source.Reply(_("Access denied. You do not have the operator privilege \002{0}\002."), "operserv/oper/modify"); + return; + } + NickServ::Nick *na = NickServ::FindNick(oper); if (na == NULL) { @@ -133,8 +145,19 @@ class CommandOSOper : public Command source.Reply(_(" \002{0}\002 is online using this oper block."), u->nick); } } - else if (subcommand.equals_ci("INFO") && params.size() > 1) + else if (subcommand.equals_ci("INFO")) { + if (params.size() < 2) + { + source.Reply(_("Available opertypes:")); + for (unsigned i = 0; i < Config->MyOperTypes.size(); ++i) + { + OperType *ot = Config->MyOperTypes[i]; + source.Reply("%s", ot->GetName().c_str()); + } + return; + } + Anope::string fulltype = params[1]; if (params.size() > 2) fulltype += " " + params[2]; |