]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/precommand.cpp
Allow changing of command string and parameter vector within OnPreCommand, allowing...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / precommand.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 /* $ModDesc: Provides a spanning tree server link protocol */
15                 
16 #include "inspircd.h"
17 #include "commands/cmd_whois.h"
18 #include "commands/cmd_stats.h"
19 #include "socket.h"
20 #include "wildcard.h"
21 #include "xline.h"      
22 #include "transport.h"  
23                         
24 #include "m_spanningtree/timesynctimer.h"
25 #include "m_spanningtree/resolvers.h"
26 #include "m_spanningtree/main.h"
27 #include "m_spanningtree/utils.h"
28 #include "m_spanningtree/treeserver.h"
29 #include "m_spanningtree/link.h"
30 #include "m_spanningtree/treesocket.h"
31 #include "m_spanningtree/rconnect.h"
32 #include "m_spanningtree/rsquit.h"
33
34 /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */
35
36 int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line)
37 {
38         /* If the command doesnt appear to be valid, we dont want to mess with it. */
39         if (!validated)
40                 return 0;
41
42         if (command == "CONNECT")
43         {
44                 return this->HandleConnect(parameters,user);
45         }
46         else if (command == "STATS")
47         {
48                 return this->HandleStats(parameters,user);
49         }
50         else if (command == "MOTD")
51         {
52                 return this->HandleMotd(parameters,user);
53         }
54         else if (command == "ADMIN")
55         {
56                 return this->HandleAdmin(parameters,user);
57         }
58         else if (command == "SQUIT")
59         {
60                 return this->HandleSquit(parameters,user);
61         }
62         else if (command == "MAP")
63         {
64                 return this->HandleMap(parameters,user);
65         }
66         else if ((command == "TIME") && (parameters.size() > 0))
67         {
68                 return this->HandleTime(parameters,user);
69         }
70         else if (command == "LUSERS")
71         {
72                 this->HandleLusers(parameters,user);
73                 return 1;
74         }
75         else if (command == "LINKS")
76         {
77                 this->HandleLinks(parameters,user);
78                 return 1;
79         }
80         else if (command == "WHOIS")
81         {
82                 if (parameters.size() > 1)
83                 {
84                         // remote whois
85                         return this->HandleRemoteWhois(parameters,user);
86                 }
87         }
88         else if ((command == "VERSION") && (parameters.size() > 0))
89         {
90                 this->HandleVersion(parameters,user);
91                 return 1;
92         }
93         else if ((command == "MODULES") && (parameters.size() > 0))
94         {
95                 return this->HandleModules(parameters,user);
96         }
97         return 0;
98 }
99