return MODEACTION_ALLOW;
}
-void ModeParser::Process(const std::vector<std::string>& parameters, User *user, bool merge)
+void ModeParser::Process(const std::vector<std::string>& parameters, User* user, ModeProcessFlag flags)
{
std::string target = parameters[0];
Channel* targetchannel = ServerInstance->FindChan(target);
/* Make sure the user isn't trying to slip in an invalid parameter */
if ((parameter.find(':') == 0) || (parameter.rfind(' ') != std::string::npos))
continue;
- if (merge && targetchannel && targetchannel->IsModeSet(modechar) && !mh->IsListMode())
+ if ((flags & MODE_MERGE) && targetchannel && targetchannel->IsModeSet(modechar) && !mh->IsListMode())
{
std::string ours = targetchannel->GetModeParameter(modechar);
if (!mh->ResolveModeConflict(parameter, ours, targetchannel))
LastParse.append(output_mode);
LastParse.append(output_parameters.str());
+ if (!(flags & MODE_LOCALONLY))
+ ServerInstance->PI->SendMode(user, targetuser, targetchannel, LastParseParams, LastParseTranslate);
+
if (targetchannel)
{
targetchannel->WriteChannel(user, "MODE %s", LastParse.c_str());
stackresult.push_back(chan->name);
while (stack.GetStackedLine(stackresult))
{
- ServerInstance->SendMode(stackresult, ServerInstance->FakeClient);
+ this->Process(stackresult, ServerInstance->FakeClient, MODE_LOCALONLY);
stackresult.erase(stackresult.begin() + 1, stackresult.end());
}
}