1.1 --- a/public/IAdminSystem.h Wed Jan 24 21:51:49 2007 +0000
1.2 +++ b/public/IAdminSystem.h Wed Jan 24 23:43:31 2007 +0000
1.3 @@ -62,14 +62,30 @@
1.4
1.5 enum ImmunityType
1.6 {
1.7 - Immunity_Default = 1, /* Immune from everyone with no immunity */
1.8 + Immunity_Default = 1, /* Immune from everyone with no immunity */
1.9 Immunity_Global, /* Immune from everyone (except root admins) */
1.10 };
1.11
1.12 typedef int GroupId;
1.13
1.14 + #define ADMIN_CACHE_OVERRIDES (1<<0)
1.15 + #define ADMIN_CACHE_ADMINS (1<<1)
1.16 + #define ADMIN_CACHE_GROUPS ((1<<2)|ADMIN_CACHE_ADMINS)
1.17 +
1.18 #define INVALID_GROUP_ID -1
1.19
1.20 + class IAdminListener
1.21 + {
1.22 + public:
1.23 + /**
1.24 + * Called when part of the admin cache needs to be rebuilt.
1.25 + * Groups should always be rebuilt before admins.
1.26 + *
1.27 + * @param cache_flags Flags for which cache to dump.
1.28 + */
1.29 + virtual void OnRebuildAdminCache(int cache_flags) =0;
1.30 + };
1.31 +
1.32 /**
1.33 * @brief This is the administration options cache.
1.34 */
1.35 @@ -114,13 +130,6 @@
1.36 virtual void UnsetCommandOverride(const char *cmd, OverrideType type) =0;
1.37
1.38 /**
1.39 - * @brief Dumps the global command override cache (unset all).
1.40 - *
1.41 - * @param type Override type (specific command or group).
1.42 - */
1.43 - virtual void DumpCommandOverrideCache(OverrideType type) =0;
1.44 -
1.45 - /**
1.46 * @brief Adds a new group. Name must be unique.
1.47 *
1.48 * @param group_name String containing the group name.
1.49 @@ -156,15 +165,15 @@
1.50 virtual bool GetGroupAddFlag(GroupId id, AdminFlag flag) =0;
1.51
1.52 /**
1.53 - * @brief Returns the flag set that is added to a user from their group.
1.54 + * @brief Returns an array of flag bits that are added to a user from their group.
1.55 * Note: These are called "add flags" because they add to a user's flags.
1.56 *
1.57 * @param id GroupId of the group.
1.58 - * @param flags Array to store flags in.
1.59 + * @param flags Array to store flags bits in.
1.60 * @param total Total number of flags that can be stored in the array.
1.61 * @return Number of flags that were written to the array.
1.62 */
1.63 - virtual unsigned int GetGroupAddFlags(GroupId id, AdminFlag flags[], unsigned int total) =0;
1.64 + virtual unsigned int GetGroupAddFlagBits(GroupId id, bool flags[], unsigned int total) =0;
1.65
1.66 /**
1.67 * @brief Toggles a generic immunity type.
1.68 @@ -244,10 +253,27 @@
1.69 virtual void InvalidateGroup(GroupId id) =0;
1.70
1.71 /**
1.72 - * @brief Invalidates the entire group cache. WARNING: This will trigger
1.73 - * an admin cache dump as well!
1.74 + * @brief Tells the admin system to dump a portion of the cache.
1.75 + * This calls into plugin forwards to rebuild the cache.
1.76 + *
1.77 + * @param cache_flags Flags for which cache to dump. Specifying groups also dumps admins.
1.78 + * @param rebuild If true, the rebuild forwards/events will fire.
1.79 */
1.80 - virtual void InvalidateGroupCache() =0;
1.81 + virtual void DumpAdminCache(int cache_flags, bool rebuild) =0;
1.82 +
1.83 + /**
1.84 + * @brief Adds an admin interface listener.
1.85 + *
1.86 + * @param pListener Pointer to an IAdminListener to add.
1.87 + */
1.88 + virtual void AddAdminListener(IAdminListener *pListener) =0;
1.89 +
1.90 + /**
1.91 + * @brief Removes an admin interface listener.
1.92 + *
1.93 + * @param pListener Pointer to an IAdminListener to remove.
1.94 + */
1.95 + virtual void RemoveAdminListener(IAdminListener *pListener) =0;
1.96 };
1.97 };
1.98