summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-05-17 03:57:19 -0400
committerAdam <Adam@anope.org>2012-05-17 03:57:19 -0400
commitccd29085a982651ba344339af2729928973e6b4d (patch)
treea4de9c2318979b4c0d65facabf1938b25f78cc91 /include
parenta883362c149770873c52fa017bb9a1678e737410 (diff)
reinterpret_cast off of a virtual base does Bad Things
Diffstat (limited to 'include')
-rw-r--r--include/anope.h12
-rw-r--r--include/modes.h35
2 files changed, 6 insertions, 41 deletions
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<typename T, typename O> inline T anope_dynamic_static_cast(O ptr)
#endif
}
-template<typename T, typename O> inline T anope_dynamic_reinterpret_cast(O ptr)
-{
-#ifdef DEBUG_BUILD
- T ret = dynamic_cast<T>(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<T>(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<std::pair<Base *, Anope::string> > AddModes;
+ std::list<std::pair<Mode *, Anope::string> > AddModes;
/* Modes to be deleted */
- std::list<std::pair<Base *, Anope::string> > DelModes;
- /* The type of object this stacker info is for */
- StackerType Type;
+ std::list<std::pair<Mode *, Anope::string> > 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<std::pair<Base *, StackerInfo *> > 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<User *, StackerInfo *> UserStackerObjects;
+ static std::map<Channel *, StackerInfo *> 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<Anope::string> 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<ChannelMode *> 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