X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Ftreesocket1.cpp;h=1e25a2fff65a24151f5cf59aebd9cf2d5d3be1a8;hb=a1c889801aed91c5ee671cb1175c56116c406f8a;hp=1ca72eee510b9208366a7b12b6f4ede6781fb254;hpb=a17174ec0aeeffc1236d0ddbcf6a63f56205acea;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 1ca72eee5..1e25a2fff 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -19,6 +19,8 @@ #include "m_spanningtree/resolvers.h" #include "m_spanningtree/handshaketimer.h" +/* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ + /** Because most of the I/O gubbins are encapsulated within * InspSocket, we just call the superclass constructor for * most of the action, and append a few of our own values @@ -33,8 +35,8 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string ho InspSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send(); } -TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, std::string ServerName, Module* HookMod) - : InspSocket(SI, host, port, listening, maxtime), Utils(Util), Hook(HookMod) +TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod) + : InspSocket(SI, host, port, listening, maxtime, bindto), Utils(Util), Hook(HookMod) { myhost = ServerName; this->LinkState = CONNECTING; @@ -979,12 +981,6 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque &p who = this->Instance->FindNick(usr); if (who) { - /* Did they get any modes? How many times? */ - strlcat(modestring, nm, MAXBUF); - for (int k = 0; k < ntimes; k++) - mode_users[modectr++] = strdup(usr); - /* Free temporary buffer used for mode sequence */ - delete[] nm; /* Check that the user's 'direction' is correct * based on the server sending the FJOIN. We must * check each nickname in turn, because the origin of @@ -995,8 +991,23 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque &p if ((!route_back_again) || (route_back_again->GetSocket() != this)) { /* Oh dear oh dear. */ + delete[] nm; continue; } + + /* NOTE: Moved this below the fake direction check, so that modes + * arent put into the mode list for users that were collided, and + * may reconnect from the other side or our side before the split + * is completed! + */ + + /* Did they get any modes? How many times? */ + strlcat(modestring, nm, MAXBUF); + for (int k = 0; k < ntimes; k++) + mode_users[modectr++] = strdup(usr); + /* Free temporary buffer used for mode sequence */ + delete[] nm; + /* Finally, we can actually place the user into the channel. * We're sure its right. Final answer, phone a friend. */ @@ -1052,7 +1063,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque &p * in case somehow we're desynched, so that other users which might be able to see * the nickname get their fair chance to process it. */ - Instance->Log(SPARSE,"Warning! Invalid user in FJOIN to channel %s IGNORED", channel.c_str()); + Instance->Log(SPARSE,"Warning! Invalid user %s in FJOIN to channel %s IGNORED", usr, channel.c_str()); continue; } }