summaryrefslogtreecommitdiff
path: root/modules/commands/cs_access.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-08-14 18:50:22 -0400
committerAdam <Adam@anope.org>2011-08-14 18:50:22 -0400
commit960c339a4ccb1be522ec800d9143d30db8ac7001 (patch)
tree6cf9bde695f498f5c2db5b58f97c9733e085a3e7 /modules/commands/cs_access.cpp
parentfddb2304c6a05559b4d2c550885646dc2e77e875 (diff)
Brought back the old 1.7 behavior of a level -1 matching all users and 0 matching all identified users
Diffstat (limited to 'modules/commands/cs_access.cpp')
-rw-r--r--modules/commands/cs_access.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index a8e90aadd..7ec65328a 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -588,8 +588,9 @@ class CommandCSAccess : public Command
"list specifies which users are allowed chanop status or\n"
"access to %s commands on the channel. Different\n"
"user levels allow for access to different subsets of\n"
- "privileges. Any nick not on the access list has\n"
- "a user level of 0."), source.owner->nick.c_str());
+ "privileges. Any registered user not on the access list has\n"
+ "a user level of 0, and any unregistered user has a user level\n"
+ "of -1."), source.owner->nick.c_str());
source.Reply(" ");
source.Reply(_("The \002ACCESS ADD\002 command adds the given mask to the\n"
"access list with the given user level; if the mask is\n"
@@ -635,7 +636,6 @@ class CommandCSAccess : public Command
" \002 3\002 Automatic voicing.\n"
" \002 0\002 No special privileges; can be opped by other\n"
" ops (unless \002secure-ops\002 is set).\n"
- " \002 <0\002 May not be opped.\n"
" \n"
"These levels may be changed, or new ones added, using the\n"
"\002LEVELS\002 command; type \002%s%s HELP LEVELS\002 for\n"
@@ -886,7 +886,7 @@ class CSAccess : public Module
ModuleManager::RegisterService(&commandcsaccess);
ModuleManager::RegisterService(&commandcslevels);
- Implementation i[] = { I_OnReload, I_OnChanRegistered, I_OnCreateChan };
+ Implementation i[] = { I_OnReload, I_OnChanRegistered, I_OnCreateChan, I_OnGroupCheckPriv };
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
this->OnReload();
@@ -919,6 +919,19 @@ class CSAccess : public Module
{
reset_levels(ci);
}
+
+ EventReturn OnGroupCheckPriv(const AccessGroup *group, ChannelAccess priv)
+ {
+ if (group->ci == NULL)
+ return EVENT_CONTINUE;
+ /* Special case. Allows a level of < 0 to match anyone, and a level of 0 to match anyone identified. */
+ int16 level = group->ci->levels[priv];
+ if (level < 0)
+ return EVENT_ALLOW;
+ else if (level == 0 && group->nc)
+ return EVENT_ALLOW;
+ return EVENT_CONTINUE;
+ }
};
MODULE_INIT(CSAccess)