From ccd29085a982651ba344339af2729928973e6b4d Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 17 May 2012 03:57:19 -0400 Subject: reinterpret_cast off of a virtual base does Bad Things --- include/anope.h | 12 ------------ include/modes.h | 35 ++++++----------------------------- 2 files changed, 6 insertions(+), 41 deletions(-) (limited to 'include') diff --git a/include/anope.h b/include/anope.h index 88c7eab98..2a51514e0 100644 --- a/include/anope.h +++ b/include/anope.h @@ -589,18 +589,6 @@ template inline T anope_dynamic_static_cast(O ptr) #endif } -template inline T anope_dynamic_reinterpret_cast(O ptr) -{ -#ifdef DEBUG_BUILD - T ret = dynamic_cast(ptr); - if (ptr != NULL && ret == NULL) - throw CoreException(Anope::string("anope_dynamic_reinterpret_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail"); - return ret; -#else - return reinterpret_cast(ptr); -#endif -} - /*************************************************************************/ /** Class with the ability to keep flags on items, they should extend from this diff --git a/include/modes.h b/include/modes.h index 52545d1b9..1bd928ed1 100644 --- a/include/modes.h +++ b/include/modes.h @@ -343,21 +343,13 @@ class CoreExport ChannelModeRegistered : public ChannelMode bool CanSet(User *u) const anope_override; }; -enum StackerType -{ - ST_CHANNEL, - ST_USER -}; - class StackerInfo { public: /* Modes to be added */ - std::list > AddModes; + std::list > AddModes; /* Modes to be deleted */ - std::list > DelModes; - /* The type of object this stacker info is for */ - StackerType Type; + std::list > DelModes; /* Bot this is sent from */ const BotInfo *bi; @@ -379,13 +371,8 @@ class CoreExport ModeManager { protected: /* List of pairs of user/channels and their stacker info */ - static std::list > StackerObjects; - - /** Get the stacker info for an item, if one doesnt exist it is created - * @param Item The user/channel etc - * @return The stacker info - */ - static StackerInfo *GetInfo(Base *Item); + static std::map UserStackerObjects; + static std::map ChannelStackerObjects; /** Build a list of mode strings to send to the IRCd from the mode stacker * @param info The stacker info for a channel or user @@ -393,16 +380,6 @@ class CoreExport ModeManager */ static std::list BuildModeStrings(StackerInfo *info); - /** Really add a mode to the stacker, internal use only - * @param bi The client to set the modes from - * @param Object The object, user/channel - * @param mode The mode - * @param Set Adding or removing? - * @param Param A param, if there is one - * @param Type The type this is, user or channel - */ - static void StackerAddInternal(const BotInfo *bi, Base *Object, Mode *mode, bool Set, const Anope::string &Param, StackerType Type); - public: /* List of all modes Anope knows about */ static std::vector ChannelModes; @@ -485,9 +462,9 @@ class CoreExport ModeManager static void ProcessModes(); /** Delete a user or channel from the stacker - * @param b The user/channel */ - static void StackerDel(Base *b); + static void StackerDel(User *u); + static void StackerDel(Channel *c); }; /** Entry flags -- cgit