From 3c14de32136419582ae49ad5377615df420ae6f1 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 13 Feb 2006 20:58:17 +0000 Subject: (TEST CODE) remote ping, do not use until debugged git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3188 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 56 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index e7ef43701..3ec2ece05 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1533,11 +1533,35 @@ class TreeSocket : public InspSocket { if (params.size() < 1) return true; - TreeServer* ServerSource = FindServer(prefix); - if (ServerSource) + if (params.size() == 1) { - ServerSource->SetPingFlag(); + TreeServer* ServerSource = FindServer(prefix); + if (ServerSource) + { + ServerSource->SetPingFlag(); + } } + else + { + std::string forwardto = params[1]; + if (forwardto == Srv->GetServerName()) + { + // this is a PONG for us + // if the prefix is a user, check theyre local, and if they are, + // dump the PONG reply back to their fd. If its a server, do nowt. + // Services might want to send these s->s, but we dont need to yet. + userrec* u = Srv->FindNick(prefix); + if (u) + { + WriteServ(u->fd,"PONG %s %s",params[0].c_str(),params[1].c_str()); + } + } + else + { + // not for us, pass it on :) + DoOneToOne(prefix,"PONG",params,forwardto); + } + } return true; } @@ -1801,9 +1825,29 @@ class TreeSocket : public InspSocket { if (params.size() < 1) return true; - std::string stufftobounce = params[0]; - this->WriteLine(":"+Srv->GetServerName()+" PONG "+stufftobounce); - return true; + if (params.size() == 1) + { + std::string stufftobounce = params[0]; + this->WriteLine(":"+Srv->GetServerName()+" PONG "+stufftobounce); + return true; + } + else + { + std::string forwardto = params[1]; + if (forwardto == Srv->GetServerName()) + { + // this is a ping for us, send back PONG to the requesting server + params[1] = params[0]; + params[0] = forwardto; + DoOneToOne(prefix,"PONG",params,forwardto); + } + else + { + // not for us, pass it on :) + DoOneToOne(prefix,"PING",params,forwardto); + } + return true; + } } bool RemoteServer(std::string prefix, std::deque ¶ms) -- cgit v1.2.3