summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mode.cpp13
-rw-r--r--src/modes/cmode_k.cpp6
-rw-r--r--src/modes/cmode_l.cpp2
-rw-r--r--src/modules/m_joinflood.cpp6
-rw-r--r--src/modules/m_kicknorejoin.cpp6
-rw-r--r--src/modules/m_messageflood.cpp6
-rw-r--r--src/modules/m_nickflood.cpp6
-rw-r--r--src/modules/m_spanningtree/fmode.cpp2
8 files changed, 12 insertions, 35 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);
diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp
index 59d401ebb..b270966da 100644
--- a/src/modes/cmode_k.cpp
+++ b/src/modes/cmode_k.cpp
@@ -61,12 +61,6 @@ void ModeChannelKey::RemoveMode(User*, irc::modestacker* stack)
{
}
-bool ModeChannelKey::CheckTimeStamp(time_t, time_t, const std::string &their_param, const std::string &our_param, Channel*)
-{
- /* When TS is equal, the alphabetically later channel key wins */
- return (their_param < our_param);
-}
-
ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
{
bool exists = channel->IsModeSet('k');
diff --git a/src/modes/cmode_l.cpp b/src/modes/cmode_l.cpp
index f20256e87..d60c9b3a7 100644
--- a/src/modes/cmode_l.cpp
+++ b/src/modes/cmode_l.cpp
@@ -34,7 +34,7 @@ ModePair ModeChannelLimit::ModeSet(User*, User*, Channel* channel, const std::st
}
}
-bool ModeChannelLimit::CheckTimeStamp(time_t, time_t, const std::string &their_param, const std::string &our_param, Channel*)
+bool ModeChannelLimit::CheckTimeStamp(std::string &their_param, const std::string &our_param, Channel*)
{
/* When TS is equal, the higher channel limit wins */
return (atoi(their_param.c_str()) < atoi(our_param.c_str()));
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index 1af3ebe1d..b3abeaf61 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -97,12 +97,6 @@ class JoinFlood : public ModeHandler
return std::make_pair(false, parameter);
}
- bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel)
- {
- /* When TS is equal, the alphabetically later one wins */
- return (their_param < our_param);
- }
-
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
{
joinfloodsettings* dummy;
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 678321033..835f73443 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -40,12 +40,6 @@ class KickRejoin : public ModeHandler
return std::make_pair(false, parameter);
}
- bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel)
- {
- /* When TS is equal, the alphabetically later one wins */
- return (their_param < our_param);
- }
-
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
{
if (!adding)
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 75f88232b..087d8e47e 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -87,12 +87,6 @@ class MsgFlood : public ModeHandler
return std::make_pair(false, parameter);
}
- bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel)
- {
- /* When TS is equal, the alphabetically later one wins */
- return (their_param < our_param);
- }
-
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
{
floodsettings *f;
diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp
index 1ed30f767..edb5aff3e 100644
--- a/src/modules/m_nickflood.cpp
+++ b/src/modules/m_nickflood.cpp
@@ -101,12 +101,6 @@ class NickFlood : public ModeHandler
return std::make_pair(false, parameter);
}
- bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel)
- {
- /* When TS is equal, the alphabetically later one wins */
- return (their_param < our_param);
- }
-
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
{
nickfloodsettings* dummy;
diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp
index 3421f8045..0328ad40b 100644
--- a/src/modules/m_spanningtree/fmode.cpp
+++ b/src/modules/m_spanningtree/fmode.cpp
@@ -97,7 +97,7 @@ bool TreeSocket::ForceMode(const std::string &source, parameterlist &params)
*/
if (TS <= ourTS)
{
- ServerInstance->Modes->Process(modelist, who, (who == Utils->ServerUser));
+ ServerInstance->Modes->Process(modelist, who, (who == Utils->ServerUser), true);
/* HOT POTATO! PASS IT ON! */
Utils->DoOneToAllButSender(source,"FMODE",params,sourceserv);