diff options
author | Adam <Adam@anope.org> | 2015-10-27 18:57:37 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2015-10-27 18:58:48 -0400 |
commit | 64dac60071fab652745a6e7a06cf6b7bdbbd3625 (patch) | |
tree | f8f30161150451672b381f6370a8fdcab654bbb8 /modules/commands/cs_mode.cpp | |
parent | 162fdbe5815bbdf187f549fefac94ff476d72e62 (diff) | |
parent | 830361e97d03c74e54cb1cf1bbf329dffdeb66f7 (diff) |
Merge branch '2.0' into 2.1
Diffstat (limited to 'modules/commands/cs_mode.cpp')
-rw-r--r-- | modules/commands/cs_mode.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index 67d1e5faa..121179a58 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -479,7 +479,7 @@ class CommandCSMode : public Command case '*': if (adding == -1 || !has_access) break; - for (unsigned j = 0; j < ModeManager::GetChannelModes().size(); ++j) + for (unsigned j = 0; j < ModeManager::GetChannelModes().size() && ci->c; ++j) { ChannelMode *cm = ModeManager::GetChannelModes()[j]; @@ -912,7 +912,7 @@ class CSMode : public Module } else if (cm->type == MODE_PARAM) { - /* If the channel doesnt have the mode, or it does and it isn't set correctly */ + /* If the channel doesn't have the mode, or it does and it isn't set correctly */ if (ml->GetSet()) { Anope::string param; @@ -947,16 +947,40 @@ class CSMode : public Module for (unsigned i = 0; i < mlock.length(); ++i) { if (mlock[i] == '+') + { add = true; - else if (mlock[i] == '-') + continue; + } + + if (mlock[i] == '-') + { add = false; - else + continue; + } + + ChannelMode *cm = ModeManager::FindChannelModeByChar(mlock[i]); + if (!cm) + continue; + + Anope::string param; + if (cm->type == MODE_PARAM) { - ChannelMode *cm = ModeManager::FindChannelModeByChar(mlock[i]); - Anope::string param; - if (cm && (cm->type == MODE_REGULAR || sep.GetToken(param))) - mlocks->SetMLock(ci, cm, add, param); + ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm); + if (add || !cmp->minus_no_arg) + { + sep.GetToken(param); + if (param.empty() || !cmp->IsValid(param)) + continue; + } } + else if (cm->type != MODE_REGULAR) + { + sep.GetToken(param); + if (param.empty()) + continue; + } + + mlocks->SetMLock(ci, cm, add, param); } } } |