diff options
author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-14 21:30:38 +0000 |
---|---|---|
committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-01-14 21:30:38 +0000 |
commit | 525dfe12e634bf575c3a090f45271861da8d7bd0 (patch) | |
tree | 9cb6c21978454bd90e86007012eb51fe70dcccb0 | |
parent | 0d6fa568ecb57105561c669c936d23018b70bfe2 (diff) |
Added param arg to ChannelModeSet/Unset events, and fixed it to not ignore status and list modes
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2758 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | include/modules.h | 6 | ||||
-rw-r--r-- | src/channels.c | 12 | ||||
-rw-r--r-- | src/core/os_defcon.c | 6 |
3 files changed, 13 insertions, 11 deletions
diff --git a/include/modules.h b/include/modules.h index 45541c28c..450c48b10 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1004,16 +1004,18 @@ class CoreExport Module /** Called when a mode is set on a channel * @param c The channel * @param Name The mode name + * @param param The mode param, if there is one * @return EVENT_STOP to make mlock/secureops etc checks not happen */ - virtual EventReturn OnChannelModeSet(Channel *c, ChannelModeName Name) { return EVENT_CONTINUE; } + virtual EventReturn OnChannelModeSet(Channel *c, ChannelModeName Name, const std::string ¶m) { return EVENT_CONTINUE; } /** Called when a mode is unset on a channel * @param c The channel * @param Name The mode name + * @param param The mode param, if there is one * @return EVENT_STOP to make mlock/secureops etc checks not happen */ - virtual EventReturn OnChannelModeUnset(Channel *c, ChannelModeName Name) { return EVENT_CONTINUE; } + virtual EventReturn OnChannelModeUnset(Channel *c, ChannelModeName Name, const std::string ¶m) { return EVENT_CONTINUE; } /** Called when a mode is set on a user * @param u The user diff --git a/src/channels.c b/src/channels.c index e1c84d765..b426d73e4 100644 --- a/src/channels.c +++ b/src/channels.c @@ -269,6 +269,9 @@ void Channel::SetModeInternal(ChannelMode *cm, const std::string ¶m, bool En if (!cm) return; + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnChannelModeSet, OnChannelModeSet(this, cm->Name, param)); + /* Setting v/h/o/a/q etc */ if (cm->Type == MODE_STATUS) { @@ -342,9 +345,6 @@ void Channel::SetModeInternal(ChannelMode *cm, const std::string ¶m, bool En ci->SetFlag(CI_PERSIST); } - EventReturn MOD_RESULT; - FOREACH_RESULT(I_OnChannelModeSet, OnChannelModeSet(this, cm->Name)); - /* Check for mlock */ /* Non registered channel, no mlock */ @@ -401,6 +401,9 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const std::string ¶m, bool if (!cm) return; + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnChannelModeUnset, OnChannelModeUnset(this, cm->Name, param)); + /* Setting v/h/o/a/q etc */ if (cm->Type == MODE_STATUS) { @@ -465,9 +468,6 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const std::string ¶m, bool } } - EventReturn MOD_RESULT; - FOREACH_RESULT(I_OnChannelModeUnset, OnChannelModeUnset(this, cm->Name)); - /* We set -P in an empty channel, delete the channel */ if (cm->Name == CMODE_PERM && !users) { diff --git a/src/core/os_defcon.c b/src/core/os_defcon.c index e9583adfc..fdb2d236e 100644 --- a/src/core/os_defcon.c +++ b/src/core/os_defcon.c @@ -180,13 +180,13 @@ class OSDEFCON : public Module return EVENT_CONTINUE; } - EventReturn OnChannelModeSet(Channel *c, ChannelModeName Name) + EventReturn OnChannelModeSet(Channel *c, ChannelModeName Name, const std::string ¶m) { ChannelMode *cm = ModeManager::FindChannelModeByName(Name); if (CheckDefCon(DEFCON_FORCE_CHAN_MODES) && cm && DefConModesOff.HasFlag(Name)) { - c->RemoveMode(findbot(Config.s_OperServ), Name); + c->RemoveMode(findbot(Config.s_OperServ), Name, param); return EVENT_STOP; } @@ -194,7 +194,7 @@ class OSDEFCON : public Module return EVENT_CONTINUE; } - EventReturn OnChannelModeUnset(Channel *c, ChannelModeName Name) + EventReturn OnChannelModeUnset(Channel *c, ChannelModeName Name, const std::string &) { ChannelMode *cm = ModeManager::FindChannelModeByName(Name); |