]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/override_stats.cpp
m_spanningtree Fix crash in SVSPART handler when the given channel doesn't exist
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / override_stats.cpp
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2010 Daniel De Graaf <danieldg@inspircd.org>
5  *   Copyright (C) 2007 Craig Edwards <craigedwards@brainbox.cc>
6  *
7  * This file is part of InspIRCd.  InspIRCd is free software: you can
8  * redistribute it and/or modify it under the terms of the GNU General Public
9  * License as published by the Free Software Foundation, version 2.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20
21 /* $ModDesc: Provides a spanning tree server link protocol */
22
23 #include "inspircd.h"
24 #include "socket.h"
25
26 #include "main.h"
27 #include "utils.h"
28 #include "treeserver.h"
29 #include "link.h"
30 #include "treesocket.h"
31
32 ModResult ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results)
33 {
34         if ((statschar == 'c') || (statschar == 'n'))
35         {
36                 for (unsigned int i = 0; i < Utils->LinkBlocks.size(); i++)
37                 {
38                         results.push_back(std::string(ServerInstance->Config->ServerName)+" 213 "+user->nick+" "+statschar+" *@"+(Utils->LinkBlocks[i]->HiddenFromStats ? "<hidden>" : Utils->LinkBlocks[i]->IPAddr)+" * "+Utils->LinkBlocks[i]->Name.c_str()+" "+ConvToStr(Utils->LinkBlocks[i]->Port)+" "+(Utils->LinkBlocks[i]->Hook.empty() ? "plaintext" : Utils->LinkBlocks[i]->Hook));
39                         if (statschar == 'c')
40                                 results.push_back(std::string(ServerInstance->Config->ServerName)+" 244 "+user->nick+" H * * "+Utils->LinkBlocks[i]->Name.c_str());
41                 }
42                 return MOD_RES_DENY;
43         }
44         return MOD_RES_PASSTHRU;
45 }
46