diff options
| author | 2013-06-13 18:15:34 +0200 | |
|---|---|---|
| committer | 2013-06-13 18:15:34 +0200 | |
| commit | 3624c137a6db85eaab0372550c9dca79d6d21e55 (patch) | |
| tree | cdfd14b2522583e057db26a2104397c05dc56c68 /src/mode.cpp | |
| parent | m_spanningtree Move SVSMODE -> MODE translation into the appropiate place, ig... (diff) | |
| download | inspircd++-3624c137a6db85eaab0372550c9dca79d6d21e55.tar.gz inspircd++-3624c137a6db85eaab0372550c9dca79d6d21e55.tar.bz2 inspircd++-3624c137a6db85eaab0372550c9dca79d6d21e55.zip | |
Introduce ModeProcessFlags, can be passed to ModeParser::Process() to indicate local only mode changes and mode merges
Change ProtocolInterface::SendMode() to take source and destination parameters, and call it from the mode parser whenever the mode change is global
This deprecates the ambiguous InspIRCd::SendMode() and InspIRCd::SendGlobalMode() interface (the latter sent mode changes originating from local users twice, etc.)
Diffstat (limited to 'src/mode.cpp')
| -rw-r--r-- | src/mode.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index 2f56c3327..63008f45c 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -331,7 +331,7 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool 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); @@ -411,7 +411,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user, /* 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)) @@ -465,6 +465,9 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user, 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()); @@ -656,7 +659,7 @@ bool ModeParser::DelMode(ModeHandler* mh) 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()); } } |
