summaryrefslogtreecommitdiff
path: root/src/coremods
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-06-11 15:07:27 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-06-11 15:07:27 +0200
commited11e05d5b6463f582dc22140794837e97796bf9 (patch)
treeccc6b76a63d622ac168a56e95f0f7ecbaf12fe5c /src/coremods
parent91a069642bce550ccc3b8081ba33b8b04109917f (diff)
Send the membership id when kicking a remote user and drop KICKs with mismatching membership ids
This fixes the desync happening when a PART+JOIN crosses a KICK targetting the same user.
Diffstat (limited to 'src/coremods')
-rw-r--r--src/coremods/core_channel/cmd_kick.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/coremods/core_channel/cmd_kick.cpp b/src/coremods/core_channel/cmd_kick.cpp
index dfa9bf217..051cc2678 100644
--- a/src/coremods/core_channel/cmd_kick.cpp
+++ b/src/coremods/core_channel/cmd_kick.cpp
@@ -73,6 +73,17 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User
}
Membership* const memb = victimiter->second;
+ // KICKs coming from servers can carry a membership id
+ if ((!IS_LOCAL(user)) && (parameters.size() > 3))
+ {
+ // If the current membership id is not equal to the one in the message then the user rejoined
+ if (memb->id != Membership::IdFromString(parameters[2]))
+ {
+ ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Dropped KICK due to membership id mismatch: " + ConvToStr(memb->id) + " != " + parameters[2]);
+ return CMD_FAILURE;
+ }
+ }
+
const bool has_reason = (parameters.size() > 2);
const std::string reason((has_reason ? parameters.back() : user->nick), 0, ServerInstance->Config->Limits.MaxKick);