diff options
| author | Adam <Adam@anope.org> | 2010-08-28 20:56:45 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-08-28 20:56:45 -0400 |
| commit | e820e1af0d01011dbe9d91d2971cc3518f7f3d42 (patch) | |
| tree | 9eb52cf891c4cd92ad08ad8d2f7c019780bc6223 /include | |
| parent | 26ba944d55fb4ee92dd5d7a3d2cfa869a8be151f (diff) | |
Properly store our clients internal channel status's and burst them if needed.
Also made Flag::HasFlag use test() instead of operator[] to catch errors, and fixed an out of bounds access to a
Flags
bitset causing crashes on some systems.
Diffstat (limited to 'include')
| -rw-r--r-- | include/channels.h | 2 | ||||
| -rw-r--r-- | include/extern.h | 4 | ||||
| -rw-r--r-- | include/operserv.h | 4 | ||||
| -rw-r--r-- | include/regchannel.h | 4 | ||||
| -rw-r--r-- | include/services.h | 4 | ||||
| -rw-r--r-- | include/users.h | 4 |
6 files changed, 11 insertions, 11 deletions
diff --git a/include/channels.h b/include/channels.h index d1e82fa8d..ec886c9ca 100644 --- a/include/channels.h +++ b/include/channels.h @@ -70,7 +70,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> std::map<ChannelModeName, Anope::string> Params; /* Modes set on the channel */ - Flags<ChannelModeName> modes; + Flags<ChannelModeName, CMODE_END * 2> modes; public: /** Default constructor diff --git a/include/extern.h b/include/extern.h index 05e43a980..9f2071a88 100644 --- a/include/extern.h +++ b/include/extern.h @@ -282,8 +282,8 @@ E bool str_is_cidr(const Anope::string &str, uint32 &ip, uint32 &mask, Anope::st /**** 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 * 2> DefMLockOn; +E Flags<ChannelModeName, CMODE_END * 2> DefMLockOff; E std::map<ChannelModeName, Anope::string> DefMLockParams; E void SetDefaultMLock(ServerConfig *config); diff --git a/include/operserv.h b/include/operserv.h index 679a066a0..2711520cd 100644 --- a/include/operserv.h +++ b/include/operserv.h @@ -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 * 2> DefConModesOn; +extern CoreExport Flags<ChannelModeName, CMODE_END * 2> DefConModesOff; extern CoreExport std::map<ChannelModeName, Anope::string> DefConModesOnParams; class XLineManager; diff --git a/include/regchannel.h b/include/regchannel.h index e19b07f5e..80b25abfb 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -69,8 +69,8 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, 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 * 2> mlock_on; /* Modes mlocked on */ + Flags<ChannelModeName, CMODE_END * 2> mlock_off; /* Modes mlocked off */ public: /** Default constructor diff --git a/include/services.h b/include/services.h index f8f37be6e..4702dcff1 100644 --- a/include/services.h +++ b/include/services.h @@ -301,7 +301,7 @@ template<typename T, typename O> inline T debug_cast(O ptr) { #ifdef DEBUG_BUILD T ret = dynamic_cast<T>(ptr); - if (ret == NULL) + if (ptr != NULL && ret == NULL) throw CoreException(Anope::string("debug_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail"); return ret; #else @@ -342,7 +342,7 @@ template<typename T, size_t Size = 32> class Flags */ bool HasFlag(T Value) const { - return Flag_Values[Value]; + return Flag_Values.test(Value); } /** Check how many flags are set diff --git a/include/users.h b/include/users.h index e65068f33..596f5ee39 100644 --- a/include/users.h +++ b/include/users.h @@ -17,7 +17,7 @@ typedef unordered_map_namespace::unordered_map<Anope::string, User *, Anope::has extern CoreExport user_map UserListByNick; extern CoreExport user_uid_map UserListByUID; -class ChannelStatus : public Flags<ChannelModeName> +class ChannelStatus : public Flags<ChannelModeName, CMODE_END * 2> { public: Anope::string BuildCharPrefixList() const; @@ -43,7 +43,7 @@ class CoreExport User : public Extensible Anope::string ident; Anope::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 * 2> modes; /* Bitset of mode names the user has set on them */ std::map<UserModeName, Anope::string> Params; /* Map of user modes and the params this user has */ NickCore *nc; /* NickCore account the user is currently loggged in as */ |
