]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/ping.cpp
Revert automated conversion by Special, as it (unfortunately) neglects some details...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / ping.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15 #include "commands/cmd_whois.h"
16 #include "commands/cmd_stats.h"
17 #include "socket.h"
18 #include "wildcard.h"
19 #include "xline.h"
20 #include "transport.h"
21 #include "socketengine.h"
22
23 #include "m_spanningtree/main.h"
24 #include "m_spanningtree/utils.h"
25 #include "m_spanningtree/treeserver.h"
26 #include "m_spanningtree/treesocket.h"
27
28 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
29
30 bool TreeSocket::LocalPing(const std::string &prefix, std::deque<std::string> &params)
31 {
32         if (params.size() < 1)
33                 return true;
34         if (params.size() == 1)
35         {
36                 std::string stufftobounce = params[0];
37                 this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" PONG "+stufftobounce);
38                 return true;
39         }
40         else
41         {
42                 std::string forwardto = params[1];
43                 if (forwardto == this->Instance->Config->ServerName || forwardto == this->Instance->Config->GetSID())
44                 {
45                         // this is a ping for us, send back PONG to the requesting server
46                         params[1] = params[0];
47                         params[0] = forwardto;
48                         Utils->DoOneToOne(forwardto,"PONG",params,params[1]);
49                 }
50                 else
51                 {
52                         // not for us, pass it on :)
53                         Utils->DoOneToOne(prefix,"PING",params,forwardto);
54                 }
55                 return true;
56         }
57 }
58
59