From fbe8169b82cb071dd57b66941093df654aa7b22c Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:44:06 +0000 Subject: Use CheckTimeStamp to merge modes on netburst git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11596 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/mode.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/mode.cpp') 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& parameters, User *user, bool servermode) +void ModeParser::Process(const std::vector& 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& 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); -- cgit v1.2.3