mirror of
https://github.com/anope/anope.git
synced 2026-06-30 12:06:38 +02:00
Made the flags class take an optional size arg
This commit is contained in:
+2
-2
@@ -100,7 +100,7 @@ class CoreExport NickRequest : public Extensible
|
||||
|
||||
class NickCore;
|
||||
|
||||
class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag>
|
||||
class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag, NS_END>
|
||||
{
|
||||
public:
|
||||
/** Default constructor
|
||||
@@ -135,7 +135,7 @@ class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag>
|
||||
void OnCancel(User *u);
|
||||
};
|
||||
|
||||
class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag>
|
||||
class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END>
|
||||
{
|
||||
public:
|
||||
/** Default constructor
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ enum BotFlag
|
||||
BI_END
|
||||
};
|
||||
|
||||
class CoreExport BotInfo : public Extensible, public Flags<BotFlag>
|
||||
class CoreExport BotInfo : public Extensible, public Flags<BotFlag, BI_END>
|
||||
{
|
||||
public:
|
||||
std::string uid; /* required for UID supporting servers, as opposed to the shitty struct Uid. */
|
||||
|
||||
+3
-3
@@ -39,7 +39,7 @@ struct UserContainer
|
||||
{
|
||||
User *user;
|
||||
UserData ud;
|
||||
Flags<ChannelModeName> *Status;
|
||||
Flags<ChannelModeName, CMODE_END> *Status;
|
||||
|
||||
UserContainer(User *u) : user(u) { }
|
||||
virtual ~UserContainer() { }
|
||||
@@ -55,7 +55,7 @@ enum ChannelFlags
|
||||
CH_SYNCING
|
||||
};
|
||||
|
||||
class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
class CoreExport Channel : public Extensible, public Flags<ChannelFlags, CMODE_END>
|
||||
{
|
||||
private:
|
||||
/** A map of channel modes with their parameters set on this channel
|
||||
@@ -63,7 +63,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
|
||||
std::map<ChannelModeName, std::string> Params;
|
||||
|
||||
/* Modes set on the channel */
|
||||
Flags<ChannelModeName> modes;
|
||||
Flags<ChannelModeName, CMODE_END> modes;
|
||||
|
||||
public:
|
||||
/** Default constructor
|
||||
|
||||
+2
-2
@@ -576,7 +576,7 @@ class ServerConfig
|
||||
/* Don't allow nicks to use /ns group to regroup nicks */
|
||||
bool NSNoGroupChange;
|
||||
/* Default flags for newly registered nicks */
|
||||
Flags<NickCoreFlag> NSDefFlags;
|
||||
Flags<NickCoreFlag, NI_END> NSDefFlags;
|
||||
/* Default language used by services */
|
||||
unsigned NSDefLanguage;
|
||||
/* Users must be connected this long before they can register
|
||||
@@ -616,7 +616,7 @@ class ServerConfig
|
||||
bool NSAddAccessOnReg;
|
||||
|
||||
/* Default flags for newly registered channels */
|
||||
Flags<ChannelInfoFlag> CSDefFlags;
|
||||
Flags<ChannelInfoFlag, CI_END> CSDefFlags;
|
||||
/* Max number of channels a user can own */
|
||||
unsigned CSMaxReg;
|
||||
/* Time before a channel expires */
|
||||
|
||||
+2
-2
@@ -326,8 +326,8 @@ E int str_is_cidr(char *str, uint32 * ip, uint32 * mask, char **host);
|
||||
/**** modes.cpp ****/
|
||||
/* Number of generic modes we support */
|
||||
E unsigned GenericChannelModes, GenericUserModes;
|
||||
E Flags<ChannelModeName> DefMLockOn;
|
||||
E Flags<ChannelModeName> DefMLockOff;
|
||||
E Flags<ChannelModeName, CMODE_END> DefMLockOn;
|
||||
E Flags<ChannelModeName, CMODE_END> DefMLockOff;
|
||||
E std::map<ChannelModeName, std::string> DefMLockParams;
|
||||
/* Modes to set on bots when they join the channel */
|
||||
E std::list<ChannelModeStatus *> BotModes;
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
extern CoreExport std::vector<NewsItem *> News;
|
||||
extern CoreExport std::vector<std::bitset<32> > DefCon;
|
||||
extern CoreExport bool DefConModesSet;
|
||||
extern CoreExport Flags<ChannelModeName> DefConModesOn;
|
||||
extern CoreExport Flags<ChannelModeName> DefConModesOff;
|
||||
extern CoreExport Flags<ChannelModeName, CMODE_END> DefConModesOn;
|
||||
extern CoreExport Flags<ChannelModeName, CMODE_END> DefConModesOff;
|
||||
extern CoreExport std::map<ChannelModeName, std::string> DefConModesOnParams;
|
||||
|
||||
class XLineManager;
|
||||
|
||||
@@ -62,15 +62,15 @@ enum ChannelInfoFlag
|
||||
CI_END
|
||||
};
|
||||
|
||||
class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
|
||||
class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, CI_END>
|
||||
{
|
||||
private:
|
||||
std::map<ChannelModeName, std::string> Params; /* Map of parameters by mode name for mlock */
|
||||
std::vector<ChanAccess *> access; /* List of authorized users */
|
||||
std::vector<AutoKick *> akick; /* List of users to kickban */
|
||||
std::vector<BadWord *> badwords; /* List of badwords */
|
||||
Flags<ChannelModeName> mlock_on; /* Modes mlocked on */
|
||||
Flags<ChannelModeName> mlock_off; /* Modes mlocked off */
|
||||
Flags<ChannelModeName, CMODE_END> mlock_on; /* Modes mlocked on */
|
||||
Flags<ChannelModeName, CMODE_END> mlock_off; /* Modes mlocked off */
|
||||
|
||||
public:
|
||||
/** Default constructor
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ struct CapabInfo
|
||||
CapabType Flag;
|
||||
};
|
||||
|
||||
extern CoreExport Flags<CapabType> Capab;
|
||||
extern CoreExport Flags<CapabType, CAPAB_END> Capab;
|
||||
extern CoreExport CapabInfo Capab_Info[];
|
||||
|
||||
/** Flags set on servers
|
||||
|
||||
+2
-2
@@ -308,10 +308,10 @@ class DatabaseException : public CoreException
|
||||
/** Class with the ability to keep flags on items, they should extend from this
|
||||
* where T is an enum.
|
||||
*/
|
||||
template<typename T> class Flags
|
||||
template<typename T, size_t Size = 32> class Flags
|
||||
{
|
||||
protected:
|
||||
std::bitset<128> Flag_Values;
|
||||
std::bitset<Size> Flag_Values;
|
||||
|
||||
public:
|
||||
/** Add a flag to this item
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ extern CoreExport user_uid_map UserListByUID;
|
||||
struct ChannelContainer
|
||||
{
|
||||
Channel *chan;
|
||||
Flags<ChannelModeName> *Status;
|
||||
Flags<ChannelModeName, CMODE_END> *Status;
|
||||
|
||||
ChannelContainer(Channel *c) : chan(c) { }
|
||||
virtual ~ChannelContainer() { }
|
||||
@@ -36,7 +36,7 @@ class CoreExport User : public Extensible
|
||||
std::string ident;
|
||||
std::string uid;
|
||||
bool OnAccess; /* If the user is on the access list of the nick theyre on */
|
||||
Flags<UserModeName> modes; /* Bitset of mode names the user has set on them */
|
||||
Flags<UserModeName, UMODE_END> modes; /* Bitset of mode names the user has set on them */
|
||||
std::map<UserModeName, std::string> Params; /* Map of user modes and the params this user has */
|
||||
NickCore *nc; /* NickCore account the user is currently loggged in as */
|
||||
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ void Channel::JoinUser(User *user)
|
||||
{
|
||||
Alog(LOG_DEBUG) << user->nick << " joins " << this->name;
|
||||
|
||||
Flags<ChannelModeName> *Status = new Flags<ChannelModeName>;
|
||||
Flags<ChannelModeName, CMODE_END> *Status = new Flags<ChannelModeName, CMODE_END>;
|
||||
ChannelContainer *cc = new ChannelContainer(this);
|
||||
cc->Status = Status;
|
||||
user->chans.push_back(cc);
|
||||
|
||||
+3
-3
@@ -28,9 +28,9 @@ std::map<ChannelModeName, ChannelMode *> ModeManager::ChannelModesByName;
|
||||
/* Number of generic modes we support */
|
||||
unsigned GenericChannelModes = 0, GenericUserModes = 0;
|
||||
/* Default mlocked modes on */
|
||||
Flags<ChannelModeName> DefMLockOn;
|
||||
Flags<ChannelModeName, CMODE_END> DefMLockOn;
|
||||
/* Default mlocked modes off */
|
||||
Flags<ChannelModeName> DefMLockOff;
|
||||
Flags<ChannelModeName, CMODE_END> DefMLockOff;
|
||||
/* Map for default mlocked mode parameters */
|
||||
std::map<ChannelModeName, std::string> DefMLockParams;
|
||||
/* Modes to set on bots when they join the channel */
|
||||
@@ -43,7 +43,7 @@ void SetDefaultMLock()
|
||||
DefMLockOn.ClearFlags();
|
||||
DefMLockOff.ClearFlags();
|
||||
DefMLockParams.clear();
|
||||
Flags<ChannelModeName> *ptr = NULL;
|
||||
Flags<ChannelModeName, CMODE_END> *ptr = NULL;
|
||||
|
||||
std::string modes, param;
|
||||
spacesepstream sep(Config.MLock);
|
||||
|
||||
+2
-2
@@ -18,9 +18,9 @@ std::vector<NewsItem *> News;
|
||||
std::vector<std::bitset<32> > DefCon;
|
||||
bool DefConModesSet = false;
|
||||
/* Defcon modes mlocked on */
|
||||
Flags<ChannelModeName> DefConModesOn;
|
||||
Flags<ChannelModeName, CMODE_END> DefConModesOn;
|
||||
/* Defcon modes mlocked off */
|
||||
Flags<ChannelModeName> DefConModesOff;
|
||||
Flags<ChannelModeName, CMODE_END> DefConModesOff;
|
||||
/* Map of Modesa and Params for DefCon */
|
||||
std::map<ChannelModeName, std::string> DefConModesOnParams;
|
||||
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ CapabInfo Capab_Info[] = {
|
||||
{"", CAPAB_END}
|
||||
};
|
||||
|
||||
Flags<CapabType> Capab;
|
||||
Flags<CapabType, CAPAB_END> Capab;
|
||||
|
||||
/** Constructor
|
||||
* @param uplink The uplink this server is from, is only NULL when creating Me
|
||||
|
||||
Reference in New Issue
Block a user