From 3ff8e96e14606c9251d52848ce7b21dc2abc8fa4 Mon Sep 17 00:00:00 2001 From: cyberbotx Date: Mon, 23 Mar 2009 00:06:40 +0000 Subject: Replace manual array for ChannelInfo's access list to use an std::vector instead, cleans up the code by a huge portion and fixes bug #1024 in the process. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2184 5417fbe8-f217-4b02-8779-1006273d7864 --- include/services.h | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'include/services.h') diff --git a/include/services.h b/include/services.h index cd8c18d84..82631d883 100644 --- a/include/services.h +++ b/include/services.h @@ -597,38 +597,39 @@ typedef struct { /*************************************************************************/ +enum AccessLevel +{ + /* Note that these two levels also serve as exclusive boundaries for valid + * access levels. ACCESS_FOUNDER may be assumed to be strictly greater + * than any valid access level, and ACCESS_INVALID may be assumed to be + * strictly less than any valid access level. Also read below. + */ + ACCESS_FOUNDER = 10000, /* Numeric level indicating founder access */ + ACCESS_INVALID = -10000, /* Used in levels[] for disabled settings */ + /* There is one exception to the above access levels: SuperAdmins will have + * access level 10001. This level is never stored, however; it is only used + * in comparison and to let SuperAdmins win from founders where needed + */ + ACCESS_SUPERADMIN = 10001, + /* Levels for xOP */ + ACCESS_VOP = 3, + ACCESS_HOP = 4, + ACCESS_AOP = 5, + ACCESS_SOP = 10 +}; + /* Channel info structures. Stored similarly to the nicks, except that * the second character of the channel name, not the first, is used to * determine the list. (Hashing based on the first character of the name * wouldn't get very far. ;) ) */ /* Access levels for users. */ -typedef struct { +struct ChanAccess { uint16 in_use; /* 1 if this entry is in use, else 0 */ int16 level; NickCore *nc; /* Guaranteed to be non-NULL if in use, NULL if not */ time_t last_seen; -} ChanAccess; - -/* Note that these two levels also serve as exclusive boundaries for valid - * access levels. ACCESS_FOUNDER may be assumed to be strictly greater - * than any valid access level, and ACCESS_INVALID may be assumed to be - * strictly less than any valid access level. Also read below. - */ -#define ACCESS_FOUNDER 10000 /* Numeric level indicating founder access */ -#define ACCESS_INVALID -10000 /* Used in levels[] for disabled settings */ -/* There is one exception to the above access levels: SuperAdmins will have - * access level 10001. This level is never stored, however; it is only used - * in comparison and to let SuperAdmins win from founders where needed - */ -#define ACCESS_SUPERADMIN 10001 - -/* Levels for xOP */ - -#define ACCESS_VOP 3 -#define ACCESS_HOP 4 -#define ACCESS_AOP 5 -#define ACCESS_SOP 10 +}; /* AutoKick data. */ typedef struct { -- cgit