]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/stats.cpp
Fix total mess of makefile dependency macros (all depending on stuff they dont NEED...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / stats.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/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 "wildcard.h"
19 #include "xline.h"
20 #include "transport.h"
21 #include "socketengine.h"
22
23 #include "m_spanningtree/main.h"
24 #include "m_spanningtree/utils.h"
25 #include "m_spanningtree/treeserver.h"
26 #include "m_spanningtree/link.h"
27 #include "m_spanningtree/treesocket.h"
28
29 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
30
31 bool TreeSocket::Stats(const std::string &prefix, std::deque<std::string> &params)
32 {
33         /* Get the reply to a STATS query if it matches this servername,
34          * and send it back as a load of PUSH queries
35          */
36         if (params.size() > 1)
37         {
38                 if (this->Instance->MatchText(this->Instance->Config->ServerName, params[1]))
39                 {
40                         /* It's for our server */
41                         string_list results;
42                         User* source = this->Instance->FindNick(prefix);
43                         if (source)
44                         {
45                                 std::deque<std::string> par;
46                                 par.push_back(prefix);
47                                 par.push_back("");
48                                 DoStats(this->Instance, *(params[0].c_str()), source, results);
49                                 for (size_t i = 0; i < results.size(); i++)
50                                 {
51                                         par[1] = "::" + results[i];
52                                         Utils->DoOneToOne(this->Instance->Config->GetSID(), "PUSH",par, source->server);
53                                 }
54                         }
55                 }
56                 else
57                 {
58                         /* Pass it on */
59                         User* source = this->Instance->FindNick(prefix);
60                         if (source)
61                                 Utils->DoOneToOne(source->uuid, "STATS", params, params[1]);
62                 }
63         }
64         return true;
65 }
66