class CommandSave : public ServerCommand
{
public:
+ /** Timestamp of the uuid nick of all users who collided and got their nick changed to uuid
+ */
+ static const time_t SavedTimestamp = 100;
+
CommandSave(Module* Creator) : ServerCommand(Creator, "SAVE", 2) { }
CmdResult Handle(User* user, std::vector<std::string>& parameters);
};
throw ProtocolException("Attempted to change nick to an invalid or non-matching UUID");
// Timestamp of the new nick
- const time_t newts = ServerCommand::ExtractTS(params[1]);
+ time_t newts = ServerCommand::ExtractTS(params[1]);
/*
* On nick messages, check that the nick doesn't already exist here.
// Remote client lost, or both lost, rewrite this nick change as a change to uuid before
// calling ChangeNick() and forwarding the message
params[0] = user->uuid;
+ params[1] = ConvToStr(CommandSave::SavedTimestamp);
+ newts = CommandSave::SavedTimestamp;
}
}
#include "treeserver.h"
#include "utils.h"
#include "commandbuilder.h"
+#include "commands.h"
/*
* Yes, this function looks a little ugly.
params.push_back(ConvToStr(u->age));
params.Broadcast();
- u->ChangeNick(u->uuid);
+ u->ChangeNick(u->uuid, CommandSave::SavedTimestamp);
}
if (bChangeRemote)
{
time_t ts = atol(params[1].c_str());
if (u->age == ts)
- u->ChangeNick(u->uuid);
+ u->ChangeNick(u->uuid, SavedTimestamp);
return CMD_SUCCESS;
}
if (they_change)
{
// The client being introduced needs to change nick to uuid, change the nick in the message before
- // processing/forwarding it.
+ // processing/forwarding it. Also change the nick TS to CommandSave::SavedTimestamp.
+ age_t = CommandSave::SavedTimestamp;
+ params[1] = ConvToStr(CommandSave::SavedTimestamp);
params[2] = params[0];
}
}