]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/ping.cpp
Replace std::deque with std::vector in spanningtree and related modules
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / ping.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/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 "xline.h"
19 #include "../transport.h"
20 #include "socketengine.h"
21
22 #include "main.h"
23 #include "utils.h"
24 #include "treeserver.h"
25 #include "treesocket.h"
26
27 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
28
29 bool TreeSocket::LocalPing(const std::string &prefix, parameterlist &params)
30 {
31         if (params.size() < 1)
32                 return true;
33         if (params.size() == 1)
34         {
35                 std::string stufftobounce = params[0];
36                 this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" PONG "+stufftobounce);
37                 return true;
38         }
39         else
40         {
41                 std::string forwardto = params[1];
42                 if (forwardto == this->ServerInstance->Config->ServerName || forwardto == this->ServerInstance->Config->GetSID())
43                 {
44                         // this is a ping for us, send back PONG to the requesting server
45                         params[1] = params[0];
46                         params[0] = forwardto;
47                         Utils->DoOneToOne(forwardto,"PONG",params,params[1]);
48                 }
49                 else
50                 {
51                         // not for us, pass it on :)
52                         Utils->DoOneToOne(prefix,"PING",params,forwardto);
53                 }
54                 return true;
55         }
56 }
57
58