]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/override_stats.cpp
Add support for blocking tag messages with the deaf mode.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / override_stats.cpp
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2012, 2014, 2016 Attila Molnar <attilamolnar@hush.com>
5  *   Copyright (C) 2012 Robby <robby@chatbelgie.be>
6  *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
7  *   Copyright (C) 2007 Craig Edwards <brain@inspircd.org>
8  *
9  * This file is part of InspIRCd.  InspIRCd is free software: you can
10  * redistribute it and/or modify it under the terms of the GNU General Public
11  * License as published by the Free Software Foundation, version 2.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21
22
23 #include "inspircd.h"
24
25 #include "main.h"
26 #include "utils.h"
27 #include "link.h"
28
29 ModResult ModuleSpanningTree::OnStats(Stats::Context& stats)
30 {
31         if ((stats.GetSymbol() == 'c') || (stats.GetSymbol() == 'n'))
32         {
33                 for (std::vector<reference<Link> >::iterator i = Utils->LinkBlocks.begin(); i != Utils->LinkBlocks.end(); ++i)
34                 {
35                         Link* L = *i;
36                         std::string ipaddr = "*@";
37                         if (L->HiddenFromStats)
38                                 ipaddr.append("<hidden>");
39                         else
40                                 ipaddr.append(L->IPAddr);
41
42                         const std::string hook = (L->Hook.empty() ? "plaintext" : L->Hook);
43                         stats.AddRow(213, stats.GetSymbol(), ipaddr, '*', L->Name, L->Port, hook);
44                         if (stats.GetSymbol() == 'c')
45                                 stats.AddRow(244, 'H', '*', '*', L->Name);
46                 }
47                 return MOD_RES_DENY;
48         }
49         else if (stats.GetSymbol() == 'U')
50         {
51                 ConfigTagList tags = ServerInstance->Config->ConfTags("uline");
52                 for (ConfigIter i = tags.first; i != tags.second; ++i)
53                 {
54                         std::string name = i->second->getString("server");
55                         if (!name.empty())
56                                 stats.AddRow(248, 'U', name);
57                 }
58                 return MOD_RES_DENY;
59         }
60         return MOD_RES_PASSTHRU;
61 }