summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2015-01-26 15:10:18 -0500
committerAdam <Adam@anope.org>2015-01-26 15:10:18 -0500
commit2264a206d262f07f6c6d91df867383d6413e0c3f (patch)
tree06963ebcf94b6ee82107a7aa7e801f64abcc2757
parentd324e9152012500c7a811d7adda6ad2c6fbcd26f (diff)
Check virtual mode bases better
-rw-r--r--include/modes.h4
-rw-r--r--src/modes.cpp9
2 files changed, 12 insertions, 1 deletions
diff --git a/include/modes.h b/include/modes.h
index 9c5916c0f..729e979d4 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -107,6 +107,8 @@ class CoreExport ChannelMode : public Mode
bool CanSet(User *u) const anope_override;
+ virtual void Check() { }
+
/** 'wrap' this channel mode and param to the underlying mode and param
*/
virtual ChannelMode *Wrap(Anope::string &param);
@@ -215,6 +217,8 @@ class CoreExport ChannelModeVirtual : public T
~ChannelModeVirtual();
+ void Check() anope_override;
+
ChannelMode *Wrap(Anope::string &param) anope_override;
ChannelMode *Unwrap(ChannelMode *cm, Anope::string &param) = 0;
diff --git a/src/modes.cpp b/src/modes.cpp
index dafe2ddca..38266f95f 100644
--- a/src/modes.cpp
+++ b/src/modes.cpp
@@ -213,7 +213,7 @@ ChannelModeVirtual<T>::~ChannelModeVirtual()
}
template<typename T>
-ChannelMode *ChannelModeVirtual<T>::Wrap(Anope::string &param)
+void ChannelModeVirtual<T>::Check()
{
if (basech == NULL)
{
@@ -221,7 +221,11 @@ ChannelMode *ChannelModeVirtual<T>::Wrap(Anope::string &param)
if (basech)
basech->listeners.push_back(this);
}
+}
+template<typename T>
+ChannelMode *ChannelModeVirtual<T>::Wrap(Anope::string &param)
+{
return basech;
}
@@ -453,6 +457,9 @@ bool ModeManager::AddChannelMode(ChannelMode *cm)
FOREACH_MOD(OnChannelModeAdd, (cm));
+ for (unsigned int i = 0; i < ChannelModes.size(); ++i)
+ ChannelModes[i]->Check();
+
return true;
}