summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-13 20:58:17 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-13 20:58:17 +0000
commit3c14de32136419582ae49ad5377615df420ae6f1 (patch)
tree4dba7e4a30e28858451b5227c7f50108c3f74d3e /src/modules/m_spanningtree.cpp
parent25a96c8f5175a5910c69a3bc623036320497b34b (diff)
(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
Diffstat (limited to 'src/modules/m_spanningtree.cpp')
-rw-r--r--src/modules/m_spanningtree.cpp56
1 files 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<std::string> &params)