diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree/commands.h | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/nick.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/nickcollide.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_spanningtree/save.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/uid.cpp | 4 |
5 files changed, 13 insertions, 4 deletions
diff --git a/src/modules/m_spanningtree/commands.h b/src/modules/m_spanningtree/commands.h index 3047e7e60..c3ef2676c 100644 --- a/src/modules/m_spanningtree/commands.h +++ b/src/modules/m_spanningtree/commands.h @@ -295,6 +295,10 @@ class CommandPush : public ServerCommand 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); }; diff --git a/src/modules/m_spanningtree/nick.cpp b/src/modules/m_spanningtree/nick.cpp index 43b713e14..9496c2874 100644 --- a/src/modules/m_spanningtree/nick.cpp +++ b/src/modules/m_spanningtree/nick.cpp @@ -36,7 +36,7 @@ CmdResult CommandNick::HandleRemote(RemoteUser* user, std::vector<std::string>& 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. @@ -53,6 +53,8 @@ CmdResult CommandNick::HandleRemote(RemoteUser* user, std::vector<std::string>& // 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; } } diff --git a/src/modules/m_spanningtree/nickcollide.cpp b/src/modules/m_spanningtree/nickcollide.cpp index a46e103e4..3401041aa 100644 --- a/src/modules/m_spanningtree/nickcollide.cpp +++ b/src/modules/m_spanningtree/nickcollide.cpp @@ -24,6 +24,7 @@ #include "treeserver.h" #include "utils.h" #include "commandbuilder.h" +#include "commands.h" /* * Yes, this function looks a little ugly. @@ -107,7 +108,7 @@ bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remo params.push_back(ConvToStr(u->age)); params.Broadcast(); - u->ChangeNick(u->uuid); + u->ChangeNick(u->uuid, CommandSave::SavedTimestamp); } if (bChangeRemote) { diff --git a/src/modules/m_spanningtree/save.cpp b/src/modules/m_spanningtree/save.cpp index aac5795af..a382b8d66 100644 --- a/src/modules/m_spanningtree/save.cpp +++ b/src/modules/m_spanningtree/save.cpp @@ -35,7 +35,7 @@ CmdResult CommandSave::Handle(User* user, std::vector<std::string>& params) time_t ts = atol(params[1].c_str()); if (u->age == ts) - u->ChangeNick(u->uuid); + u->ChangeNick(u->uuid, SavedTimestamp); return CMD_SUCCESS; } diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index c7a98b2f4..958718202 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -65,7 +65,9 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st 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]; } } |