changed how the admin cache is rebuilt

renamed the plugin and fixed compilation errors

--HG--
rename : plugins/admin-flatfile/admin-base.sp => plugins/admin-flatfile/admin-flatfile.sp
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40444
This commit is contained in:
David Anderson
2007-02-06 05:13:24 +00:00
parent 0186e26344
commit 8860ff6224
10 changed files with 101 additions and 72 deletions
@@ -19,14 +19,13 @@ new g_ErrorCount = 0;
#include "admin-overrides.sp"
#include "admin-groups.sp"
public OnRebuildAdminCache(cache_flags)
public OnRebuildAdminCache(AdminCachePart:part)
{
RefreshLevels();
if (cache_flags & ADMIN_CACHE_OVERRIDES)
if (part == AdminCache_Overrides)
{
ReadOverrides();
}
if (cache_flags & ADMIN_CACHE_GROUPS)
} else if (part == AdminCache_Groups)
{
ReadGroups();
}
-4
View File
@@ -81,10 +81,6 @@ public SMCResult:ReadGroups_KeyValue(Handle:smc,
continue;
}
flag = g_FlagLetters[value[i] - 'a'];
if (flag == Admin_None)
{
continue;
}
SetAdmGroupAddFlag(g_CurGrp, flag, true);
}
} else if (StrEqual(key, "immunity")) {
+4 -10
View File
@@ -9,12 +9,6 @@ static g_LevelState = LEVEL_STATE_NONE;
LoadDefaultLetters()
{
/* Clear letters first */
for (new i='a'; i<='z'; i++)
{
g_FlagLetters[i-'a'] = Admin_None;
}
g_FlagLetters['a'-'a'] = Admin_Reservation;
g_FlagLetters['b'-'a'] = Admin_Kick;
g_FlagLetters['c'-'a'] = Admin_Ban;
@@ -22,7 +16,7 @@ LoadDefaultLetters()
g_FlagLetters['e'-'a'] = Admin_Slay;
g_FlagLetters['f'-'a'] = Admin_Changemap;
g_FlagLetters['g'-'a'] = Admin_Convars;
g_FlagLetters['h'-'a'] = Admin_Configs;
g_FlagLetters['h'-'a'] = Admin_Config;
g_FlagLetters['i'-'a'] = Admin_Chat;
g_FlagLetters['j'-'a'] = Admin_Vote;
g_FlagLetters['h'-'a'] = Admin_Password;
@@ -78,7 +72,7 @@ public SMCResult:ReadLevels_KeyValue(Handle:smc, const String:key[], const Strin
chr -= 'a';
new AdminFlag:flag = Admin_None;
new AdminFlag:flag;
if (StrEqual(key, "reservation"))
{
@@ -95,8 +89,8 @@ public SMCResult:ReadLevels_KeyValue(Handle:smc, const String:key[], const Strin
flag = Admin_Changemap;
} else if (StrEqual(key, "cvars")) {
flag = Admin_Convars;
} else if (StrEqual(key, "configs")) {
flag = Admin_Configs;
} else if (StrEqual(key, "config")) {
flag = Admin_Config;
} else if (StrEqual(key, "chat")) {
flag = Admin_Chat;
} else if (StrEqual(key, "vote")) {
+3 -3
View File
@@ -50,7 +50,7 @@ public SMCResult:ReadOverrides_KeyValue(Handle:smc,
return SMCParse_Continue;
}
new AdminFlag:flag = Admin_None;
new AdminFlag:flag;
if (strlen(value) > 1)
{
@@ -65,9 +65,9 @@ public SMCResult:ReadOverrides_KeyValue(Handle:smc,
if (key[0] == '@')
{
AddCommandOverride(key[1], Override_CommandGroup, flag);
AddCommandOverride(key[1], Override_CommandGroup, FlagToBit(flag));
} else {
AddCommandOverride(key, Override_Command, flag);
AddCommandOverride(key, Override_Command, FlagToBit(flag));
}
return SMCParse_Continue;
+14 -9
View File
@@ -113,26 +113,31 @@ enum AdmAccessMode
Access_Effective, /**< Access the user has from their groups */
};
#define ADMIN_CACHE_OVERRIDES (1<<0)
#define ADMIN_CACHE_ADMINS (1<<1)
#define ADMIN_CACHE_GROUPS ((1<<2)|ADMIN_CACHE_ADMINS)
/**
* @brief Represents the various cache regions.
*/
enum AdminCachePart
{
AdminCache_Overrides = 0, /**< Global overrides */
AdminCache_Groups = 1, /**< All groups (automatically invalidates admins too) */
AdminCache_Admins = 2, /**< All admins */
};
/**
* Called when part of the admin cache needs to be rebuilt.
* @note Groups should always be rebuilt before admins.
* Called when part of the cache which needs to be rebuilt.
*
* @param cache_flags Flags for which cache to dump.
* @param part Part of the admin cache to rebuild.
*/
forward OnRebuildAdminCache(cache_flags);
forward OnRebuildAdminCache(AdminCachePart:part);
/**
* Tells the admin system to dump a portion of the cache.
*
* @param cache_flags Flags for which cache to dump. Specifying groups also dumps admins.
* @param part Part of the cache to dump. Specifying groups also dumps admins.
* @param rebuild If true, the rebuild forwards will fire.
* @noreturn
*/
native DumpAdminCache(cache_flags, bool:rebuild);
native DumpAdminCache(AdminCachePart:part, bool:rebuild);
/**
* Adds a global command flag override. Any command registered with this name