]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/ijoin.cpp
Optimize some behaviour in the core (#1476).
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / ijoin.cpp
index 34bd44a9b2cfd885f13569673972b6d8cbd90655..c2dbcf7f5ae2f3cdcb444cec014507d3be36f737 100644 (file)
@@ -38,17 +38,20 @@ CmdResult CommandIJoin::HandleRemote(RemoteUser* user, std::vector<std::string>&
        }
 
        bool apply_modes;
-       if (params.size() > 1)
+       if (params.size() > 3)
        {
-               time_t RemoteTS = ServerCommand::ExtractTS(params[1]);
-               if (RemoteTS < chan->age)
-                       throw ProtocolException("Attempted to lower TS via IJOIN. LocalTS=" + ConvToStr(chan->age));
-               apply_modes = ((params.size() > 2) && (RemoteTS == chan->age));
+               time_t RemoteTS = ServerCommand::ExtractTS(params[2]);
+               apply_modes = (RemoteTS <= chan->age);
        }
        else
                apply_modes = false;
 
-       chan->ForceJoin(user, apply_modes ? &params[2] : NULL);
+       // Join the user and set the membership id to what they sent
+       Membership* memb = chan->ForceJoin(user, apply_modes ? &params[3] : NULL);
+       if (!memb)
+               return CMD_FAILURE;
+
+       memb->id = Membership::IdFromString(params[1]);
        return CMD_SUCCESS;
 }