The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ping.cpp

Go to the documentation of this file.
00001 /*       +------------------------------------+
00002  *       | Inspire Internet Relay Chat Daemon |
00003  *       +------------------------------------+
00004  *
00005  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
00006  * See: http://www.inspircd.org/wiki/index.php/Credits
00007  *
00008  * This program is free but copyrighted software; see
00009  *            the file COPYING for details.
00010  *
00011  * ---------------------------------------------------
00012  */
00013 
00014 #include "inspircd.h"
00015 #include "commands/cmd_whois.h"
00016 #include "commands/cmd_stats.h"
00017 #include "socket.h"
00018 #include "xline.h"
00019 #include "transport.h"
00020 #include "socketengine.h"
00021 
00022 #include "m_spanningtree/main.h"
00023 #include "m_spanningtree/utils.h"
00024 #include "m_spanningtree/treeserver.h"
00025 #include "m_spanningtree/treesocket.h"
00026 
00027 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
00028 
00029 bool TreeSocket::LocalPing(const std::string &prefix, std::deque<std::string> &params)
00030 {
00031         if (params.size() < 1)
00032                 return true;
00033         if (params.size() == 1)
00034         {
00035                 std::string stufftobounce = params[0];
00036                 this->WriteLine(std::string(":")+this->ServerInstance->Config->GetSID()+" PONG "+stufftobounce);
00037                 return true;
00038         }
00039         else
00040         {
00041                 std::string forwardto = params[1];
00042                 if (forwardto == this->ServerInstance->Config->ServerName || forwardto == this->ServerInstance->Config->GetSID())
00043                 {
00044                         // this is a ping for us, send back PONG to the requesting server
00045                         params[1] = params[0];
00046                         params[0] = forwardto;
00047                         Utils->DoOneToOne(forwardto,"PONG",params,params[1]);
00048                 }
00049                 else
00050                 {
00051                         // not for us, pass it on :)
00052                         Utils->DoOneToOne(prefix,"PING",params,forwardto);
00053                 }
00054                 return true;
00055         }
00056 }
00057 
00058