InspIRCd  2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations
command_parse.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
5  * Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
6  * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
7  * Copyright (C) 2005-2007 Craig Edwards <craigedwards@brainbox.cc>
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 #ifndef COMMAND_PARSE_H
24 #define COMMAND_PARSE_H
25 
31 class CoreExport CommandParser
32 {
33  private:
39  int ProcessParameters(std::vector<std::string>& command_p, char* parameters);
40 
45  bool ProcessCommand(LocalUser *user, std::string &cmd);
46 
47  public:
50  Commandtable cmdlist;
51 
54  CommandParser();
55 
66  CmdResult CallHandler(const std::string &commandname, const std::vector<std::string>& parameters, User *user);
67 
72  Command* GetHandler(const std::string &commandname);
73 
82  bool IsValidCommand(const std::string &commandname, unsigned int pcnt, User * user);
83 
105  int LoopCall(User* user, Command* CommandObj, const std::vector<std::string>& parameters, unsigned int splithere, int extra = -1, bool usemax = true);
106 
111  bool ProcessBuffer(std::string &buffer,LocalUser *user);
112 
117  bool AddCommand(Command *f);
118 
121  void RemoveCommand(Command* x);
122 
129  int TranslateUIDs(TranslateType to, const std::string &source, std::string &dest);
130 
139  int TranslateUIDs(const std::vector<TranslateType> to, const std::vector<std::string> &source, std::string &dest, bool prefix_final = false, Command* custom_translator = NULL);
140 };
141 
147 const int duration_multi[] =
148 {
149  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
150  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
151  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
152  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
153  1, 1, 1, 1, 1, 1, 1, 1, 86400, 1, 1, 1, 3600,
154  1, 1, 1, 1, 60, 1, 1, 1, 1, 1, 1, 1, 1, 1,
155  604800, 1, 31557600, 1, 1, 1, 1, 1, 1, 1, 1,
156  1, 1, 86400, 1, 1, 1, 3600, 1, 1, 1, 1, 60,
157  1, 1, 1, 1, 1, 1, 1, 1, 1, 604800, 1, 31557600,
158  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
159  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
160  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
161  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
162  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
163  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
164  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
165  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
166  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
167 };
168 
169 #endif
Commandtable cmdlist
Definition: command_parse.h:50
Definition: users.h:230
Definition: command_parse.h:31
Definition: ctables.h:102
Definition: users.h:742