diff options
author | Adam <Adam@anope.org> | 2012-02-18 15:47:16 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-02-18 15:47:16 -0500 |
commit | f2ce9cd85ce831ba291f3a6353b308802f327e87 (patch) | |
tree | 44e784d9d54b83701e0c5f5d2b6d75cf8cb1fd20 /src | |
parent | ee5cd8493e34a1c049066ead25e9094b30cd49b5 (diff) |
Made mode lock del check status of the mode lock before removing it
Diffstat (limited to 'src')
-rw-r--r-- | src/regchannel.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/regchannel.cpp b/src/regchannel.cpp index bf85f5809..34a578917 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -806,10 +806,11 @@ bool ChannelInfo::SetMLock(ChannelMode *mode, bool status, const Anope::string & /** Remove a mlock * @param mode The mode + * @param status True for mlock on, false for mlock off * @param param The param of the mode, required if it is a list or status mode * @return true on success, false on failure */ -bool ChannelInfo::RemoveMLock(ChannelMode *mode, const Anope::string ¶m) +bool ChannelInfo::RemoveMLock(ChannelMode *mode, bool status, const Anope::string ¶m) { if (mode->Type == MODE_REGULAR || mode->Type == MODE_PARAM) { @@ -817,13 +818,21 @@ bool ChannelInfo::RemoveMLock(ChannelMode *mode, const Anope::string ¶m) if (it != this->mode_locks.end()) for (; it != it_end; it = it_next) { + const ModeLock &ml = it->second; ++it_next; + + if (status != ml.set) + continue; + EventReturn MOD_RESULT; FOREACH_RESULT(I_OnUnMLock, OnUnMLock(this, &it->second)); if (MOD_RESULT != EVENT_STOP) + { this->mode_locks.erase(it); + return true; + } } - return true; + return false; } else { @@ -835,7 +844,7 @@ bool ChannelInfo::RemoveMLock(ChannelMode *mode, const Anope::string ¶m) for (; it != it_end; ++it) { const ModeLock &ml = it->second; - if (ml.param == param) + if (ml.set == status && ml.param == param) { EventReturn MOD_RESULT; FOREACH_RESULT(I_OnUnMLock, OnUnMLock(this, &it->second)); |