1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 06:06:39 +02:00

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
This commit is contained in:
Adam-
2010-01-14 21:30:38 +00:00
parent 0d6fa568ec
commit 525dfe12e6
3 changed files with 13 additions and 11 deletions
+4 -2
View File
@@ -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 &param) { 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 &param) { return EVENT_CONTINUE; }
/** Called when a mode is set on a user
* @param u The user
+6 -6
View File
@@ -269,6 +269,9 @@ void Channel::SetModeInternal(ChannelMode *cm, const std::string &param, 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 &param, 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 &param, 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 &param, 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)
{
+3 -3
View File
@@ -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 &param)
{
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);