]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/ping.cpp
modulemanger: check dependencies correctly
[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 "socket.h"
16 #include "xline.h"
17 #include "../transport.h"
18 #include "socketengine.h"
19
20 #include "main.h"
21 #include "utils.h"
22 #include "treeserver.h"
23 #include "treesocket.h"
24
25 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
26
27 bool TreeSocket::LocalPing(const std::string &prefix, parameterlist &params)
28 {
29         if (params.size() < 1)
30                 return true;
31         if (params.size() == 1)
32         {
33                 std::string stufftobounce = params[0];
34                 this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" PONG "+stufftobounce);
35                 return true;
36         }
37         else
38         {
39                 std::string forwardto = params[1];
40                 if (forwardto == this->ServerInstance->Config->ServerName || forwardto == this->ServerInstance->Config->GetSID())
41                 {
42                         // this is a ping for us, send back PONG to the requesting server
43                         params[1] = params[0];
44                         params[0] = forwardto;
45                         Utils->DoOneToOne(forwardto,"PONG",params,params[1]);
46                 }
47                 else
48                 {
49                         // not for us, pass it on :)
50                         Utils->DoOneToOne(prefix,"PING",params,forwardto);
51                 }
52                 return true;
53         }
54 }
55
56