X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Ftreesocket2.cpp;h=04b850755020eebfdc0f87d820c62db5ac1e27b5;hb=afefc6bfe9e184086247fc305a41ef1c21cb136b;hp=7574be90a1d90616f1f679f68193cdd8dd2a697e;hpb=5214968e7e0e0d43e137535ac1a9369c222d79f0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 7574be90a..04b850755 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -47,7 +47,7 @@ void TreeSocket::Split(const std::string& line, std::string& prefix, std::string if (prefix[0] == ':') { - prefix = prefix.substr(1); + prefix.erase(prefix.begin()); if (prefix.empty()) { @@ -152,13 +152,13 @@ void TreeSocket::ProcessLine(std::string &line) time_t delta = them - ServerInstance->Time(); if ((delta < -600) || (delta > 600)) { - ServerInstance->SNO->WriteGlobalSno('l',"\2ERROR\2: Your clocks are out by %d seconds (this is more than five minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs((long)delta)); - SendError("Your clocks are out by "+ConvToStr(abs((long)delta))+" seconds (this is more than five minutes). Link aborted, PLEASE SYNC YOUR CLOCKS!"); + ServerInstance->SNO->WriteGlobalSno('l',"\2ERROR\2: Your clocks are out by %ld seconds (this is more than five minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",labs((long)delta)); + SendError("Your clocks are out by "+ConvToStr(labs((long)delta))+" seconds (this is more than five minutes). Link aborted, PLEASE SYNC YOUR CLOCKS!"); return; } else if ((delta < -30) || (delta > 30)) { - ServerInstance->SNO->WriteGlobalSno('l',"\2WARNING\2: Your clocks are out by %d seconds. Please consider synching your clocks.", abs((long)delta)); + ServerInstance->SNO->WriteGlobalSno('l',"\2WARNING\2: Your clocks are out by %ld seconds. Please consider synching your clocks.", labs((long)delta)); } } @@ -220,10 +220,20 @@ User* TreeSocket::FindSource(const std::string& prefix, const std::string& comma if (prefix.empty()) return MyRoot->ServerUser; - // If the prefix string is a uuid or a sid FindUUID() returns the appropriate User object - User* who = ServerInstance->FindUUID(prefix); - if (who) - return who; + if (prefix.size() == 3) + { + // Prefix looks like a sid + TreeServer* server = Utils->FindServerID(prefix); + if (server) + return server->ServerUser; + } + else + { + // If the prefix string is a uuid FindUUID() returns the appropriate User object + User* user = ServerInstance->FindUUID(prefix); + if (user) + return user; + } // Some implementations wrongly send a server name as prefix occasionally, handle that too for now TreeServer* const server = Utils->FindServer(prefix); @@ -243,9 +253,9 @@ User* TreeSocket::FindSource(const std::string& prefix, const std::string& comma * command came from a server to avoid desync. */ - who = ServerInstance->FindUUID(prefix.substr(0, 3)); - if (who) - return who; + TreeServer* const usersserver = Utils->FindServerID(prefix.substr(0, 3)); + if (usersserver) + return usersserver->ServerUser; return this->MyRoot->ServerUser; } @@ -306,6 +316,11 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, this->Error(params); return; } + else if (command == "BURST") + { + // This is sent even when there is no need for it, drop it here for now + return; + } throw ProtocolException("Unknown command"); }