diff options
Diffstat (limited to 'modules/commands/cs_xop.cpp')
-rw-r--r-- | modules/commands/cs_xop.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp index 33b2f564e..1d5cfb7d9 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -26,7 +26,7 @@ class XOPChanAccess : public ChanAccess { } - bool HasPriv(const Anope::string &priv) const anope_override + bool HasPriv(const Anope::string &priv) const override { for (std::vector<Anope::string>::iterator it = std::find(order.begin(), order.end(), this->type); it != order.end(); ++it) { @@ -37,12 +37,12 @@ class XOPChanAccess : public ChanAccess return false; } - Anope::string AccessSerialize() const anope_override + Anope::string AccessSerialize() const override { return this->type; } - void AccessUnserialize(const Anope::string &data) anope_override + void AccessUnserialize(const Anope::string &data) override { this->type = data; } @@ -88,7 +88,7 @@ class XOPAccessProvider : public AccessProvider { } - ChanAccess *Create() anope_override + ChanAccess *Create() override { return new XOPChanAccess(this); } @@ -100,6 +100,7 @@ class CommandCSXOP : public Command void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms) { Anope::string mask = params.size() > 2 ? params[2] : ""; + Anope::string description = params.size() > 3 ? params[3] : ""; if (mask.empty()) { @@ -208,6 +209,7 @@ class CommandCSXOP : public Command XOPChanAccess *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create()); acc->SetMask(mask, ci); acc->creator = source.GetNick(); + acc->description = description; acc->type = source.command.upper(); acc->last_seen = 0; acc->created = Anope::CurTime; @@ -280,15 +282,15 @@ class CommandCSXOP : public Command CommandSource &source; ChannelInfo *ci; Command *c; - unsigned deleted; + unsigned deleted = 0; Anope::string nicks; bool override; public: - XOPDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, bool _override, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), override(_override) + XOPDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, bool _override, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), override(_override) { } - ~XOPDelCallback() + ~XOPDelCallback() override { if (!deleted) source.Reply(_("No matching entries on %s %s list."), ci->name.c_str(), source.command.c_str()); @@ -303,7 +305,7 @@ class CommandCSXOP : public Command } } - void HandleNumber(unsigned number) anope_override + void HandleNumber(unsigned number) override { if (!number || number > ci->GetAccessCount()) return; @@ -374,7 +376,7 @@ class CommandCSXOP : public Command } ListFormatter list(source.GetAccount()); - list.AddColumn(_("Number")).AddColumn(_("Mask")); + list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("Description")); if (!nick.empty() && nick.find_first_not_of("1234567890,-") == Anope::string::npos) { @@ -388,7 +390,7 @@ class CommandCSXOP : public Command { } - void HandleNumber(unsigned Number) anope_override + void HandleNumber(unsigned Number) override { if (!Number || Number > ci->GetAccessCount()) return; @@ -401,6 +403,7 @@ class CommandCSXOP : public Command ListFormatter::ListEntry entry; entry["Number"] = stringify(Number); entry["Mask"] = a->Mask(); + entry["Description"] = a->description; this->list.AddEntry(entry); } } nl_list(list, ci, nick, source); @@ -420,6 +423,7 @@ class CommandCSXOP : public Command ListFormatter::ListEntry entry; entry["Number"] = stringify(i + 1); entry["Mask"] = a->Mask(); + entry["Description"] = a->description; list.AddEntry(entry); } } @@ -478,18 +482,18 @@ class CommandCSXOP : public Command public: CommandCSXOP(Module *modname) : Command(modname, "chanserv/xop", 2, 4) { - this->SetSyntax(_("\037channel\037 ADD \037mask\037")); + this->SetSyntax(_("\037channel\037 ADD \037mask\037 [\037description\037]")); this->SetSyntax(_("\037channel\037 DEL {\037mask\037 | \037entry-num\037 | \037list\037}")); this->SetSyntax(_("\037channel\037 LIST [\037mask\037 | \037list\037]")); this->SetSyntax(_("\037channel\037 CLEAR")); } - const Anope::string GetDesc(CommandSource &source) const anope_override + const Anope::string GetDesc(CommandSource &source) const override { return Anope::printf(Language::Translate(source.GetAccount(), _("Modify the list of %s users")), source.command.upper().c_str()); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { ChannelInfo *ci = ChannelInfo::Find(params[0]); if (ci == NULL) @@ -513,7 +517,7 @@ class CommandCSXOP : public Command } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { const Anope::string &cmd = source.command.upper(); @@ -590,7 +594,7 @@ class CSXOP : public Module } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { order.clear(); permissions.clear(); |