00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __COMMAND_PARSE_H
00015 #define __COMMAND_PARSE_H
00016
00019 typedef std::map<std::string, void*> SharedObjectList;
00020
00026 class CoreExport CommandParser : public classbase
00027 {
00028 private:
00031 InspIRCd* ServerInstance;
00032
00035 std::vector<std::string> para;
00036
00042 int ProcessParameters(std::vector<std::string>& command_p, char* parameters);
00043
00048 bool ProcessCommand(User *user, std::string &cmd);
00049
00056 bool FindSym(void** v, void* h, const std::string &name);
00057
00060 SharedObjectList RFCCommands;
00061
00066 const char* LoadCommand(const char* name);
00067
00071 void RemoveCommand(nspace::hash_map<std::string,Command*>::iterator safei, const char* source);
00072
00073
00074 public:
00077 Commandtable cmdlist;
00078
00087 bool ReloadCommand(std::string cmd, User* user);
00088
00092 CommandParser(InspIRCd* Instance);
00093
00104 CmdResult CallHandler(const std::string &commandname, const std::vector<std::string>& parameters, User *user);
00105
00110 Command* GetHandler(const std::string &commandname);
00111
00120 bool IsValidCommand(const std::string &commandname, unsigned int pcnt, User * user);
00121
00143 int LoopCall(User* user, Command* CommandObj, const std::vector<std::string>& parameters, unsigned int splithere, unsigned int extra);
00144
00166 int LoopCall(User* user, Command* CommandObj, const std::vector<std::string>& parameters, unsigned int splithere);
00167
00172 bool ProcessBuffer(std::string &buffer,User *user);
00173
00178 void DoLines(User* current, bool one_only = false);
00179
00183 void RemoveCommands(const char* source);
00184
00192 bool CreateCommand(Command *f, void* so_handle = NULL);
00193
00199 void SetupCommandTable(User* user);
00200
00207 int TranslateUIDs(TranslateType to, const std::string &source, std::string &dest);
00208 };
00209
00213 class cmd_reload : public Command
00214 {
00215 public:
00218 cmd_reload (InspIRCd* Instance) : Command(Instance,"RELOAD","o",1) { syntax = "<core-command>"; }
00221 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
00222 };
00223
00229 const int duration_multi[] =
00230 {
00231 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00232 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00233 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00234 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00235 1, 1, 1, 1, 1, 1, 1, 1, 86400, 1, 1, 1, 3600,
00236 1, 1, 1, 1, 60, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00237 604800, 1, 31557600, 1, 1, 1, 1, 1, 1, 1, 1,
00238 1, 1, 86400, 1, 1, 1, 3600, 1, 1, 1, 1, 60,
00239 1, 1, 1, 1, 1, 1, 1, 1, 1, 604800, 1, 31557600,
00240 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00241 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00242 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00243 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00244 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00245 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00246 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00247 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
00248 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
00249 };
00250
00251 #endif
00252