diff options
| author | Adam <Adam@anope.org> | 2011-08-04 21:59:01 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-08-04 21:59:01 -0400 |
| commit | 9ec18a3b020932eee6242c878149c484f49b13cb (patch) | |
| tree | 6f0470e27bf4f3ced0f6833db00134f4b29a79a9 /modules | |
| parent | 773a1f3075fa12700d41598c0b8a8dd7caf9011e (diff) | |
Added a command:permission setting
Diffstat (limited to 'modules')
73 files changed, 185 insertions, 175 deletions
diff --git a/modules/core/bs_bot.cpp b/modules/core/bs_bot.cpp index ec0bea734..7500d1926 100644 --- a/modules/core/bs_bot.cpp +++ b/modules/core/bs_bot.cpp @@ -314,7 +314,7 @@ class CommandBSBot : public Command if (cmd.equals_ci("ADD")) { // ADD nick user host real - 5 - if (!u->HasCommand("botserv/botserv/bot/add")) + if (!u->HasCommand("botserv/bot/add")) { source.Reply(ACCESS_DENIED); return; @@ -337,7 +337,7 @@ class CommandBSBot : public Command { // CHANGE oldn newn user host real - 6 // but only oldn and newn are required - if (!u->HasCommand("botserv/botserv/bot/change")) + if (!u->HasCommand("botserv/bot/change")) { source.Reply(ACCESS_DENIED); return; @@ -354,7 +354,7 @@ class CommandBSBot : public Command else if (cmd.equals_ci("DEL")) { // DEL nick - if (!u->HasCommand("botserv/botserv/bot/del")) + if (!u->HasCommand("botserv/bot/del")) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/core/cs_list.cpp b/modules/core/cs_list.cpp index 639c23267..a79c047c4 100644 --- a/modules/core/cs_list.cpp +++ b/modules/core/cs_list.cpp @@ -33,12 +33,6 @@ class CommandCSList : public Command int count = 0, from = 0, to = 0; bool suspended = false, channoexpire = false; - if (Config->CSListOpersOnly && !u->HasMode(UMODE_OPER)) - { - source.Reply(ACCESS_DENIED); - return; - } - if (pattern[0] == '#') { Anope::string n1 = myStrGetToken(pattern.substr(1), '-', 0), /* Read FROM out */ diff --git a/modules/core/cs_saset.cpp b/modules/core/cs_saset.cpp index cb749a3c3..699c5bc2c 100644 --- a/modules/core/cs_saset.cpp +++ b/modules/core/cs_saset.cpp @@ -16,7 +16,7 @@ class CommandCSSASet : public Command { public: - CommandCSSASet(Module *creator) : Command(creator, "chanserv/saset", 2, 3, "chanserv/saset") + 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")); @@ -37,11 +37,13 @@ class CommandCSSASet : public Command " \n" "Available options:")); Anope::string this_name = source.command; - for (command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it) + for (BotInfo::command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it) { - if (it->first.find_ci(this_name + " ") == 0) + const Anope::string &c_name = it->first; + CommandInfo &info = it->second; + if (c_name.find_ci(this_name + " ") == 0) { - service_reference<Command> command(it->second); + service_reference<Command> command(info.name); if (command) { source.command = it->first; diff --git a/modules/core/cs_saset_noexpire.cpp b/modules/core/cs_saset_noexpire.cpp index 4a1caa449..1e085496f 100644 --- a/modules/core/cs_saset_noexpire.cpp +++ b/modules/core/cs_saset_noexpire.cpp @@ -16,7 +16,7 @@ class CommandCSSASetNoexpire : public Command { public: - CommandCSSASetNoexpire(Module *creator) : Command(creator, "chanserv/saset/noexpire", 2, 2, "chanserv/saset/noexpire") + CommandCSSASetNoexpire(Module *creator) : Command(creator, "chanserv/saset/noexpire", 2, 2) { this->SetDesc(_("Prevent the channel from expiring")); this->SetDesc(_("\037channel\037 {ON | OFF}")); @@ -32,7 +32,7 @@ class CommandCSSASetNoexpire : public Command return; } - if (!this->permission.empty() && !ci->HasPriv(u, CA_SET)) + if (source.permission.empty() && !ci->HasPriv(u, CA_SET)) { source.Reply(ACCESS_DENIED); return; diff --git a/modules/core/cs_set.cpp b/modules/core/cs_set.cpp index 8b5ca1f61..65719ce91 100644 --- a/modules/core/cs_set.cpp +++ b/modules/core/cs_set.cpp @@ -37,11 +37,13 @@ class CommandCSSet : public Command " \n" "Available options:")); Anope::string this_name = source.command; - for (command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it) + for (BotInfo::command_map::iterator it = source.owner->commands.begin(), it_end = source.owner->commands.end(); it != it_end; ++it) { - if (it->first.find_ci(this_name + " ") == 0) + const Anope::string &c_name = it->first; + CommandInfo &info = it->second; + if (c_name.find_ci(this_name + " ") == 0) { - service_reference<Command> command(it->second); + service_reference<Command> command(info.name); if (command) { source.command = it->first; diff --git a/modules/core/cs_set_bantype.cpp b/modules/core/cs_set_bantype.cpp index 14b13a77b..94d2aa151 100644 --- a/modules/core/cs_set_bantype.cpp +++ b/modules/core/cs_set_bantype.cpp @@ -16,7 +16,7 @@ class CommandCSSetBanType : public Command { public: - CommandCSSetBanType(Module *creator, const Anope::string &cname = "chanserv/set/bantype", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission) + 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")); @@ -32,7 +32,7 @@ class CommandCSSetBanType : public Command return; } - if (!this->permission.empty() && !ci->HasPriv(u, CA_SET)) + if (source.permission.empty() && !ci->HasPriv(u, CA_SET)) { source.Reply(ACCESS_DENIED); return; @@ -74,7 +74,7 @@ class CommandCSSetBanType : public Command class CommandCSSASetBanType : public CommandCSSetBanType { public: - CommandCSSASetBanType(Module *creator) : CommandCSSetBanType(creator, "chanserv/saset/bantype", "chanserv/saset/bantype") + CommandCSSASetBanType(Module *creator) : CommandCSSetBanType(creator, "chanserv/saset/bantype") { } }; diff --git a/modules/core/cs_set_description.cpp b/modules/core/cs_set_description.cpp index 3282f8144..5c2cd447d 100644 --- a/modules/core/cs_set_description.cpp +++ b/modules/core/cs_set_description.cpp @@ -16,7 +16,7 @@ class CommandCSSetDescription : public Command { public: - CommandCSSetDescription(Module *creator, const Anope::string &cname = "chanserv/set/description", const Anope::string &cpermission = "") : Command(creator, cname, 1, 2, cpermission) + 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]")); @@ -32,7 +32,7 @@ class CommandCSSetDescription : public Command return; } - if (!this->permission.empty() && !ci->HasPriv(u, CA_SET)) + if (source.permission.empty() && !ci->HasPriv(u, CA_SET)) { source.Reply(ACCESS_DENIED); return; @@ -65,7 +65,7 @@ class CommandCSSetDescription : public Command class CommandCSSASetDescription : public CommandCSSetDescription { public: - CommandCSSASetDescription(Module *creator) : CommandCSSetDescription(creator, "chanserv/saset/description", "chanserv/saset/description") + CommandCSSASetDescription(Module *creator) : CommandCSSetDescription(creator, "chanserv/saset/description") { } }; diff --git a/modules/core/cs_set_founder.cpp b/modules/core/cs_set_founder.cpp index e71fd4d3e..2169af972 100644 --- a/modules/core/cs_set_founder.cpp +++ b/modules/core/cs_set_founder.cpp @@ -16,7 +16,7 @@ class CommandCSSetFounder : public Command { public: - CommandCSSetFounder(Module *creator, const Anope::string &cname = "chanserv/set/founder", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission) + 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")); @@ -32,13 +32,13 @@ class CommandCSSetFounder : public Command return; } - if (!this->permission.empty() && !ci->HasPriv(u, CA_SET)) + if (source.permission.empty() && !ci->HasPriv(u, CA_SET)) { source.Reply(ACCESS_DENIED); return; } - if (this->permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER))) + if (source.permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->HasPriv(u, CA_FOUNDER))) { source.Reply(ACCESS_DENIED); return; @@ -59,7 +59,7 @@ class CommandCSSetFounder : public Command return; } - Log(!this->permission.empty() ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to change the founder to " << nc->display; + Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to change the founder to " << nc->display; ci->SetFounder(nc); @@ -81,7 +81,7 @@ class CommandCSSetFounder : public Command class CommandCSSASetFounder : public CommandCSSetFounder { public: - CommandCSSASetFounder(Module *creator) : CommandCSSetFounder(creator, "chanserv/saset/founder", "chanserv/saset/founder") + CommandCSSASetFounder(Module *creator) : CommandCSSetFounder(creator, "chanserv/saset/founder") { } }; diff --git a/modules/core/cs_set_keeptopic.cpp b/modules/core/cs_set_keeptopic.cpp index 0322987e4..05578a2e5 100644 --- a/modules/core/cs_set_keeptopic.cpp +++ b/modules/core/cs_set_keeptopic.cpp @@ -16,7 +16,7 @@ class CommandCSSetKeepTopic : public Command { public: - CommandCSSetKeepTopic(Module *creator, const Anope::string &cname = "chanserv/set/keeptopic", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission) + 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}")); @@ -32,7 +32,7 @@ class CommandCSSetKeepTopic : public Command return; } - if (!this->permission.empty() && !ci->HasPriv(u, CA_SET)) + if (source.permission.empty() && !ci->HasPriv(u, CA_SET)) { source.Reply(ACCESS_DENIED); return; @@ -70,7 +70,7 @@ class CommandCSSetKeepTopic : public Command class CommandCSSASetKeepTopic : public CommandCSSetKeepTopic { public: - CommandCSSASetKeepTopic(Module *creator) : CommandCSSetKeepTopic(creator, "chanserv/saset/keeptopic", "chanserv/saset/keeptopic") + CommandCSSASetKeepTopic(Module *creator) : CommandCSSetKeepTopic(creator, "chanserv/saset/keeptopic") { } }; diff --git a/modules/core/cs_set_opnotice.cpp b/modules/core/cs_set_opnotice.cpp index cfcaf358c..018b89437 100644 --- a/modules/core/cs_set_opnotice.cpp +++ b/modules/core/cs_set_opnotice.cpp @@ -16,7 +16,7 @@ class CommandCSSetOpNotice : public Command { public: - CommandCSSetOpNotice(Module *creator, const Anope::string &cname = "chanserv/set/notice", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission) + CommandCSSetOpNotice(Module *creator, const Anope::string &cname = "chanserv/set/notice") : Command(creator, cname, 2, 2) { this->SetDesc(_("Send a notice when OP/DEOP commands are used")); this->SetSyntax(_("\037channel\037 {ON | OFF}")); @@ -32,7 +32,7 @@ class CommandCSSetOpNotice : public Command return; } - if (!this->permission.empty() && !ci->HasPriv(u, CA_SET)) + if (source.permission.empty() && !ci->HasPriv(u, CA_SET)) { source.Reply(ACCESS_DENIED); return; @@ -69,7 +69,7 @@ class CommandCSSetOpNotice : public Command class CommandCSSASetOpNotice : public CommandCSSetOpNotice { public: - CommandCSSASetOpNotice(Module *creator) : CommandCSSetOpNotice(creator, "chanserv/saset/opnotice", "chanserv/saset/opnotice") + CommandCSSASetOpNotice(Module *creator) : CommandCSSetOpNotice(creator, "chanserv/saset/opnotice") { } }; diff --git a/modules/core/cs_set_peace.cpp b/modules/core/cs_set_peace.cpp index cb208e540..3a045fc6d 100644 --- a/modules/core/cs_set_peace.cpp +++ b/modules/core/cs_set_peace.cpp @@ -16,7 +16,7 @@ class CommandCSSetPeace : public Command { public: - CommandCSSetPeace(Module *creator, const Anope::string &cname = "chanserv/set/peace", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission) + 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}")); @@ -32,7 +32,7 @@ class CommandCSSetPeace : public Command return; } - if (!this->permission.empty() && !ci->HasPriv(u, CA_SET)) + if (source.permission.empty() && !ci->HasPriv(u, CA_SET)) { source.Reply(ACCESS_DENIED); return; @@ -69,7 +69,7 @@ class CommandCSSetPeace : public Command class CommandCSSASetPeace : public CommandCSSetPeace { public: - CommandCSSASetPeace(Module *creator) : CommandCSSetPeace(creator, "chanserv/saset/peace", "chanserv/saset/peace") + CommandCSSASetPeace(Module *creator) : CommandCSSetPeace(creator, "chanserv/saset/peace") { } }; diff --git a/modules/core/cs_set_persist.cpp b/modules/core/cs_set_persist.cpp index 2402a3370..3cc9564c4 100644 --- a/modules/core/cs_set_persist.cpp +++ b/modules/core/cs_set_persist.cpp @@ -16,7 +16,7 @@ class CommandCSSetPersist : public Command { public: - CommandCSSetPersist(Module *creator, const Anope::string &cname = "chanserv/set/persist", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission) + 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}")); @@ -32,7 +32,7 @@ class CommandCSSetPersist : public Command return; } - if (!this->permission.empty() && !ci->HasPriv(u, CA_SET)) + if (source.permission.empty() && !ci->HasPriv(u, CA_SET)) { source.Reply(ACCESS_DENIED); return; @@ -156,7 +156,7 @@ class CommandCSSetPersist : public Command class CommandCSSASetPersist : public CommandCSSetPersist { public: - CommandCSSASetPersist(Module *creator) : CommandCSSetPersist(creator, "chanserv/saset/persist", "chanserv/saset/persist") + CommandCSSASetPersist(Module *creator) : CommandCSSetPersist(creator, "chanserv/saset/persist") { } }; diff --git a/modules/core/cs_set_private.cpp b/modules/core/cs_set_private.cpp index 85880d5da..108b11569 100644 --- a/modules/core/cs_set_private.cpp +++ b/modules/core/cs_set_private.cpp @@ -16,7 +16,7 @@ class CommandCSSetPrivate : public Command { public: - CommandCSSetPrivate(Module *creator, const Anope::string &cname = "chanserv/set/private", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission) + 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}")); @@ -32,7 +32,7 @@ class CommandCSSetPrivate : public Command return; } - if (!this->permission.empty() && !ci->HasPriv(u, CA_SET)) + if (source.permission.empty() && !ci->HasPriv(u, CA_SET)) { source.Reply(ACCESS_DENIED); return; @@ -69,7 +69,7 @@ class CommandCSSetPrivate : public Command class CommandCSSASetPrivate : public CommandCSSetPrivate { public: - CommandCSSASetPrivate(Module *creator) : CommandCSSetPrivate(creator, "chanserv/saset/private", "chanserv/saset/private") + CommandCSSASetPrivate(Module *creator) : CommandCSSetPrivate(creator, "chanserv/saset/private") { } }; diff --git a/modules/core/cs_set_restricted.cpp b/modules/core/cs_set_restricted.cpp index 9796c97da..5d675d2e7 100644 --- a/modules/core/cs_set_restricted.cpp +++ b/modules/core/cs_set_restricted.cpp @@ -15,7 +15,7 @@ class CommandCSSetRestricted : public Command { public: - CommandCSSetRestricted(Module *creator, const Anope::string &cname = "chanserv/set/restricted", const Anope::string &cpermission = "") : Command(creator, cname, 2, 2, cpermission) + 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}")); @@ -31,7 +31,7 |
