X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fijoin.cpp;h=78e05db93fbb841090e5c18257bcdf9ecd42a2f7;hb=9028c48512367394af2f790b53658bc6a197f95e;hp=637321bcb9f81cfa8af7cab4dcbb2802fe8bd256;hpb=3eb205218a321e454d873ae14e2e717ce9d64142;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/ijoin.cpp b/src/modules/m_spanningtree/ijoin.cpp index 637321bcb..78e05db93 100644 --- a/src/modules/m_spanningtree/ijoin.cpp +++ b/src/modules/m_spanningtree/ijoin.cpp @@ -38,23 +38,22 @@ CmdResult CommandIJoin::HandleRemote(RemoteUser* user, std::vector& } bool apply_modes; - if (params.size() > 1) + if (params.size() > 2) { - time_t RemoteTS = ConvToInt(params[1]); - if (!RemoteTS) - { - ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Invalid TS in IJOIN: " + params[1]); - return CMD_INVALID; - } - + time_t RemoteTS = ServerCommand::ExtractTS(params[2]); if (RemoteTS < chan->age) throw ProtocolException("Attempted to lower TS via IJOIN. LocalTS=" + ConvToStr(chan->age)); - apply_modes = ((params.size() > 2) && (RemoteTS == chan->age)); + apply_modes = ((params.size() > 3) && (RemoteTS == chan->age)); } else apply_modes = false; - chan->ForceJoin(user, apply_modes ? ¶ms[2] : NULL); + // Join the user and set the membership id to what they sent + Membership* memb = chan->ForceJoin(user, apply_modes ? ¶ms[3] : NULL); + if (!memb) + return CMD_FAILURE; + + memb->id = Membership::IdFromString(params[1]); return CMD_SUCCESS; }