diff options
author | Adam <Adam@anope.org> | 2013-07-04 01:21:05 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-07-04 01:21:14 -0400 |
commit | 9f8b4ac382478d676d392b1649dadd7d360c2e42 (patch) | |
tree | 80fbe700930142dcbcd235b703b3fe6bc1a3a3b7 /modules/commands/cs_access.cpp | |
parent | 998925c90a7ffa3dc6c4bf715699565dac49c10c (diff) |
Allow access and flags to take privilege names
Diffstat (limited to 'modules/commands/cs_access.cpp')
-rw-r--r-- | modules/commands/cs_access.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index 9a90b7d5f..10606ca7e 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -89,13 +89,19 @@ class CommandCSAccess : public Command void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms) { Anope::string mask = params[2]; + Privilege *p = NULL; int level = ACCESS_INVALID; try { level = convertTo<int>(params[3]); } - catch (const ConvertException &) { } + catch (const ConvertException &) + { + p = PrivilegeManager::FindPrivilege(params[3]); + if (p != NULL && defaultLevels[p->name]) + level = defaultLevels[p->name]; + } if (!level) { @@ -209,9 +215,10 @@ class CommandCSAccess : public Command FOREACH_MOD(OnAccessAdd, (ci, source, access)); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << " with level " << level; - source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->mask.c_str(), ci->name.c_str(), level); - - return; + if (p != NULL) + source.Reply(_("\002%s\002 added to %s access list at privilege %s (level %d)"), access->mask.c_str(), ci->name.c_str(), p->name.c_str(), level); + else + source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->mask.c_str(), ci->name.c_str(), level); } void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms) @@ -564,12 +571,9 @@ class CommandCSAccess : public Command "access list with the given user level; if the mask is\n" "already present on the list, its access level is changed to\n" "the level specified in the command. The \037level\037 specified\n" - "must be less than that of the user giving the command, and\n" - "if the \037mask\037 is already on the access list, the current\n" - "access level of that mask must be less than the access level\n" - "of the user giving the command. When a user joins the channel\n" - "the access they receive is from the highest level entry in the\n" - "access list.")); + "may be a numerical level or the name of a privilege (eg AUTOOP).\n" + "When a user joins the channel the access they receive is from the" + "highest level entry in the access list.")); if (!Config->GetModule("chanserv")->Get<bool>("disallow_channel_access")) source.Reply(_("The given mask may also be a channel, which will use the\n" "access list from the other channel up to the given \037level\037")); |