diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:44:06 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:44:06 +0000 |
commit | fbe8169b82cb071dd57b66941093df654aa7b22c (patch) | |
tree | cfed61b7350374c3a3d69f5f61540b454d8f082d /src/mode.cpp | |
parent | deb6822302cb9009adc3450dd405817cc0dae9cd (diff) |
Use CheckTimeStamp to merge modes on netburst
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11596 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/mode.cpp')
-rw-r--r-- | src/mode.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index c8fecafa5..1986ed2bb 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -155,9 +155,9 @@ void ModeHandler::OnParameterMissing(User* user, User* dest, Channel* channel) { } -bool ModeHandler::CheckTimeStamp(time_t theirs, time_t ours, const std::string&, const std::string&, Channel*) +bool ModeHandler::CheckTimeStamp(std::string& theirs, const std::string& ours, Channel*) { - return (ours < theirs); + return (theirs < ours); } SimpleUserModeHandler::SimpleUserModeHandler(InspIRCd* Instance, char modeletter) : ModeHandler(Instance, modeletter, 0, 0, false, MODETYPE_USER, false) @@ -471,7 +471,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 servermode) +void ModeParser::Process(const std::vector<std::string>& parameters, User *user, bool servermode, bool merge) { std::string target = parameters[0]; Channel* targetchannel = ServerInstance->FindChan(target); @@ -562,6 +562,13 @@ 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()) + { + std::string ours = targetchannel->GetModeParameter(modechar); + if (!mh->CheckTimeStamp(parameter, ours, targetchannel)) + /* we won the mode merge, don't apply this mode */ + continue; + } } ModeAction ma = TryMode(user, targetuser, targetchannel, adding, modechar, parameter, servermode, SkipAccessChecks); |