]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/command_parse.cpp
Add amd64/linux to list of OS'es tested, but mainly CIA test :P
[user/henk/code/inspircd.git] / src / command_parse.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 using namespace std;
18
19 #include "inspircd_config.h"
20 #include "inspircd.h"
21 #include "inspircd_io.h"
22 #include <unistd.h>
23 #include <fcntl.h>
24 #include <sys/errno.h>
25 #include <sys/ioctl.h>
26 #include <sys/utsname.h>
27 #include <time.h>
28 #include <string>
29 #ifdef GCC3
30 #include <ext/hash_map>
31 #else
32 #include <hash_map>
33 #endif
34 #include <map>
35 #include <sstream>
36 #include <vector>
37 #include <deque>
38 #include <sched.h>
39 #ifdef THREADED_DNS
40 #include <pthread.h>
41 #endif
42 #include "users.h"
43 #include "globals.h"
44 #include "modules.h"
45 #include "dynamic.h"
46 #include "wildcard.h"
47 #include "message.h"
48 #include "mode.h"
49 #include "commands.h"
50 #include "xline.h"
51 #include "inspstring.h"
52 #include "dnsqueue.h"
53 #include "helperfuncs.h"
54 #include "hashcomp.h"
55 #include "socketengine.h"
56 #include "userprocess.h"
57 #include "socket.h"
58 #include "dns.h"
59 #include "typedefs.h"
60 #include "command_parse.h"
61 #include "ctables.h"
62
63 #ifdef GCC3
64 #define nspace __gnu_cxx
65 #else
66 #define nspace std
67 #endif
68
69
70 extern InspIRCd* ServerInstance;
71
72 extern std::vector<Module*> modules;
73 extern std::vector<ircd_module*> factory;
74 extern std::vector<InspSocket*> module_sockets;
75 extern std::vector<userrec*> local_users;
76
77 extern int MODCOUNT;
78 extern InspSocket* socket_ref[MAX_DESCRIPTORS];
79 extern time_t TIME;
80
81 // This table references users by file descriptor.
82 // its an array to make it VERY fast, as all lookups are referenced
83 // by an integer, meaning there is no need for a scan/search operation.
84 extern userrec* fd_ref_table[MAX_DESCRIPTORS];
85
86 extern Server* MyServer;
87 extern ServerConfig *Config;
88
89 extern user_hash clientlist;
90 extern chan_hash chanlist;
91
92 /* Special commands which may occur without registration of the user */
93 cmd_user* command_user;
94 cmd_nick* command_nick;
95 cmd_pass* command_pass;
96
97 /* This function pokes and hacks at a parameter list like the following:
98  *
99  * PART #winbot,#darkgalaxy :m00!
100  *
101  * to turn it into a series of individual calls like this:
102  *
103  * PART #winbot :m00!
104  * PART #darkgalaxy :m00!
105  *
106  * The seperate calls are sent to a callback function provided by the caller
107  * (the caller will usually call itself recursively). The callback function
108  * must be a command handler. Calling this function on a line with no list causes
109  * no action to be taken. You must provide a starting and ending parameter number
110  * where the range of the list can be found, useful if you have a terminating
111  * parameter as above which is actually not part of the list, or parameters
112  * before the actual list as well. This code is used by many functions which
113  * can function as "one to list" (see the RFC) */
114
115 int CommandParser::LoopCall(command_t* fn, char **parameters, int pcnt, userrec *u, int start, int end, int joins)
116 {
117         /* Copy of the parameter list, because like strltok, we make a bit of
118          * a mess of the parameter string we're given, and we want to keep this
119          * private.
120          */
121         char paramlist[MAXBUF];
122         /* Temporary variable used to hold one split parameter
123          */
124         char *param;
125         /* Parameter list, we can have up to 32 of these
126          */
127         char *pars[32];
128         /* Seperated items, e.g. holds the #one and #two from "#one,#two"
129          */
130         char *sep_items[32];
131         /* Seperated keys, holds the 'two' and 'three' of "two,three"
132          */
133         char *sep_keys[32];
134         /* Misc. counters, the total values hold the total number of
135          * seperated items in sep_items (total) and the total number of
136          * seperated items in sep_keys (total2)
137          */
138         int j = 0, q = 0, total = 0, total2 = 0;
139         /* A temporary copy of the comma seperated key list (see the description
140          * of the paramlist variable)
141          */
142         char keylist[MAXBUF];
143         /* Exactly what it says. Its nothing. We point invalid parameters at this.
144          */
145         char nothing = 0;
146
147         /* First, initialize our arrays */
148         for (int i = 0; i < 32; i++)
149                 sep_items[i] = sep_keys[i] = NULL;
150
151         /* Now find all parameters that are NULL, maybe above pcnt,
152          * and for safety, point them at 'nothing'
153          */
154         for (int i = 0; i < 10; i++)
155         {
156                 if (!parameters[i])
157                 {
158                         parameters[i] = &nothing;
159                 }
160         }
161         /* Check if we're doing JOIN handling. JOIN has two lists in
162          * it, potentially, if we have keys, so this is a special-case
163          * to handle the keys if they are provided.
164          */
165         if (joins)
166         {
167                 if (pcnt > 1) /* we have a key to copy */
168                 {
169                         strlcpy(keylist,parameters[1],MAXBUF);
170                 }
171         }
172
173         /* There's nothing to split! We don't do anything
174          */
175         if (!parameters[start] || (!strchr(parameters[start],',')))
176         {
177                 return 0;
178         }
179
180         /* This function can handle multiple comma seperated
181          * lists as one, which is a feature no actual commands
182          * have yet -- this is futureproofing in case we encounter
183          * a command that  does.
184          */
185         *paramlist = 0;
186
187         for (int i = start; i <= end; i++)
188         {
189                 if (parameters[i])
190                 {
191                         strlcat(paramlist,parameters[i],MAXBUF);
192                 }
193         }
194
195         /* Now we split off paramlist into seperate parameters using
196          * pointer voodoo, this parameter list goes into sep_items
197          */
198         j = 0;
199         param = paramlist;
200
201         for (char* i = paramlist; *i; i++)
202         {
203                 /* Found an item */
204                 if (*i == ',')
205                 {
206                         *i = '\0';
207                         sep_items[j++] = param;
208                         /* Iterate along to next item, if there is one */
209                         param = i+1;
210                         if ((unsigned int)j > Config->MaxTargets)
211                         {
212                                 /* BZZT! Too many items */
213                                 WriteServ(u->fd,"407 %s %s :Too many targets in list, message not delivered.",u->nick,sep_items[j-1]);
214                                 return 1;
215                         }
216                 }
217         }
218         sep_items[j++] = param;
219         total = j;
220
221         /* We add this extra comma here just to ensure we get all the keys
222          * in the event the user gave a malformed key string (yes, you guessed
223          * it, this is a mirc-ism)
224          */
225         if ((joins) && (*keylist) && (total>0)) // more than one channel and is joining
226         {
227                 charlcat(keylist,',',MAXBUF);
228         }
229
230         /* If we're doing JOIN handling (e.g. we've had to kludge for two
231          * lists being handled at once, real smart by the way JRO </sarcasm>)
232          * and we also have keys, we must seperate out this key list into
233          * our char** list sep_keys for later use.
234          */
235         if ((joins) && (*keylist))
236         {
237                 /* There is more than one key */
238                 if (strchr(keylist,','))
239                 {
240                         j = 0;
241                         param = keylist;
242                         for (char* i = keylist; *i; i++)
243                         {
244                                 if (*i == ',')
245                                 {
246                                         *i = '\0';
247                                         sep_keys[j++] = param;
248                                         param = i+1;
249                                 }
250                         }
251
252                         sep_keys[j++] = param;
253                         total2 = j;
254                 }
255         }
256
257         /* Now the easier bit. We call the command class's Handle function
258          * X times, where x is the number of parameters we've 'collated'.
259          */
260         for (j = 0; j < total; j++)
261         {
262                 if (sep_items[j])
263                 {
264                         pars[0] = sep_items[j];
265                 }
266
267                 for (q = end; q < pcnt-1; q++)
268                 {
269                         if (parameters[q+1])
270                         {
271                                 pars[q-end+1] = parameters[q+1];
272                         }
273                 }
274
275                 if ((joins) && (parameters[1]))
276                 {
277                         if (pcnt > 1)
278                         {
279                                 pars[1] = sep_keys[j];
280                         }
281                         else
282                         {
283                                 pars[1] = NULL;
284                         }
285                 }
286
287                 /* repeatedly call the function with the hacked parameter list */
288                 if ((joins) && (pcnt > 1))
289                 {
290                         if (pars[1])
291                         {
292                                 /* pars[1] already set up and containing key from sep_keys[j] */
293                                 fn->Handle(pars,2,u);
294                         }
295                         else
296                         {
297                                 pars[1] = parameters[1];
298                                 fn->Handle(pars,2,u);
299                         }
300                 }
301                 else
302                 {
303                         fn->Handle(pars,pcnt-(end-start),u);
304                 }
305         }
306
307         return 1;
308 }
309
310 bool CommandParser::IsValidCommand(const std::string &commandname, int pcnt, userrec * user)
311 {
312         nspace::hash_map<std::string,command_t*>::iterator n = cmdlist.find(commandname);
313
314         if (n != cmdlist.end())
315         {
316                 if ((pcnt>=n->second->min_params) && (n->second->source != "<core>"))
317                 {
318                         if ((strchr(user->modes,n->second->flags_needed)) || (!n->second->flags_needed))
319                         {
320                                 if (n->second->flags_needed)
321                                 {
322                                         return ((user->HasPermission(commandname)) || (is_uline(user->server)));
323                                 }
324                                 return true;
325                         }
326                 }
327         }
328         return false;
329 }
330
331 // calls a handler function for a command
332
333 bool CommandParser::CallHandler(const std::string &commandname,char **parameters, int pcnt, userrec *user)
334 {
335         nspace::hash_map<std::string,command_t*>::iterator n = cmdlist.find(commandname);
336
337         if (n != cmdlist.end())
338         {
339                 if (pcnt >= n->second->min_params)
340                 {
341                         if ((strchr(user->modes,n->second->flags_needed)) || (!n->second->flags_needed))
342                         {
343                                 if (n->second->flags_needed)
344                                 {
345                                         if ((user->HasPermission(commandname)) || (!IS_LOCAL(user)))
346                                         {
347                                                 n->second->Handle(parameters,pcnt,user);
348                                                 return true;
349                                         }
350                                 }
351                                 else
352                                 {
353                                         n->second->Handle(parameters,pcnt,user);
354                                         return true;
355                                 }
356                         }
357                 }
358         }
359         return false;
360 }
361
362 int CommandParser::ProcessParameters(char **command_p,char *parameters)
363 {
364         int j = 0;
365
366         if (!*parameters)
367         {
368                 /* no parameters, command_p invalid! */
369                 return 0;
370         }
371
372         if (*parameters == ':')
373         {
374                 command_p[0] = parameters+1;
375                 return 1;
376         }
377
378         if (*parameters)
379         {
380                 char* n = strchr(parameters,' ');
381                 if ((!n) || (*parameters == ':'))
382                 {
383                         /* only one parameter */
384                         command_p[0] = parameters;
385                         if (*parameters == ':')
386                         {
387                                 if (n)
388                                 {
389                                         command_p[0]++;
390                                 }
391                         }
392
393                         return 1;
394                 }
395         }
396
397         command_p[j++] = parameters;
398
399         for (char* i = parameters; *i; i++)
400         {
401                 if (*i == ' ')
402                 {
403                         command_p[j++] = i+1;
404                         *i = '\0';
405
406                         if (*command_p[j-1] == ':')
407                         {
408                                 *command_p[j-1]++; /* remove dodgy ":" */
409                                 break;
410                                 /* parameter like this marks end of the sequence */
411                         }
412                 }
413         }
414         return j; /* returns total number of items in the list */
415 }
416
417 void CommandParser::ProcessCommand(userrec *user, char* cmd)
418 {
419         char *parameters;
420         char *command;
421         char *command_p[127];
422         char p[MAXBUF], temp[MAXBUF];
423         int j, items, cmd_found;
424         int total_params = 0;
425
426         for (int i = 0; i < 127; i++)
427                 command_p[i] = NULL;
428
429         if (!user || !cmd || !*cmd)
430         {
431                 return;
432         }
433
434         char* first_space = NULL;
435
436         /* If the command is > 2 characters (quick and dirty way to find out) */
437         if (*cmd && *(cmd+1) && *(cmd+2))
438         {
439                 for (char* q = cmd; *q; q++)
440                 {
441                         if (*q == ' ')
442                         {
443                                 first_space = q;
444                                 if (*(q+1) == ':')
445                                 {
446                                         total_params++;
447                                         // found a 'trailing', we dont count them after this.
448                                         break;
449                                 }
450                                 else
451                                         total_params++;
452                         }
453                 }
454         }
455
456         // another phidjit bug...
457         if (total_params > 126)
458         {
459                 *first_space = 0;
460                 WriteServ(user->fd,"421 %s %s :Too many parameters given",user->nick,cmd);
461                 return;
462         }
463
464         strlcpy(temp,cmd,MAXBUF);
465
466         std::string tmp = cmd;
467
468         for (int i = 0; i <= MODCOUNT; i++)
469         {
470                 std::string oldtmp = tmp;
471                 modules[i]->OnServerRaw(tmp,true,user);
472                 if (oldtmp != tmp)
473                 {
474                         log(DEBUG,"A Module changed the input string!");
475                         log(DEBUG,"New string: %s",tmp.c_str());
476                         log(DEBUG,"Old string: %s",oldtmp.c_str());
477                         break;
478                 }
479         }
480
481         strlcpy(cmd,tmp.c_str(),MAXBUF);
482         strlcpy(temp,cmd,MAXBUF);
483
484         char* has_space = strchr(cmd,' ');
485         int cm_length = 0;
486         if (!has_space)
487         {
488                 /*
489                  * no parameters, lets skip the formalities and not chop up
490                  * the string
491                  */
492                 log(DEBUG,"About to preprocess command with no params");
493                 items = 0;
494                 command_p[0] = NULL;
495                 parameters = NULL;
496                 for (char* i = cmd; *i; i++,cm_length++)
497                         *i = toupper(*i);
498                 command = cmd;
499         }
500         else
501         {
502                 *cmd = 0;
503                 j = 0;
504
505                 /* strip out extraneous linefeeds through mirc's crappy pasting (thanks Craig) */
506                 for (char* i = temp; *i; i++)
507                 {
508                         if ((*i != 10) && (*i != 13) && (*i != 0) && (*i != 7))
509                         {
510                                 cmd[j++] = *i;
511                         }
512                 }
513                 cmd[j] = 0;
514
515                 /* split the full string into a command plus parameters */
516                 parameters = p;
517                 p[0] = ' ';
518                 p[1] = 0;
519
520                 command = cmd;
521
522                 if (has_space)
523                 {
524                         for (char* i = cmd; *i; i++)
525                         {
526                                 /* capitalise the command ONLY, leave params intact */
527                                 *i = toupper(*i);
528                                 /* are we nearly there yet?! :P */
529                                 if (*i == ' ')
530                                 {
531                                         command = cmd;
532                                         parameters = i+1;
533                                         *i = 0;
534                                         break;
535                                 }
536                         }
537                 }
538                 else
539                 {
540                         for (char* i = cmd; *i; i++,cm_length++)
541                         {
542                                 *i = toupper(*i);
543                         }
544                 }
545         }
546
547         if (cm_length > MAXCOMMAND)
548         {
549                 WriteServ(user->fd,"421 %s %s :Command too long",user->nick,command);
550                 return;
551         }
552
553         for (char* x = command; *x; x++)
554         {
555                 if (((*x < 'A') || (*x > 'Z')) && (*x != '.'))
556                 {
557                         if (((*x < '0') || (*x> '9')) && (*x != '-'))
558                         {
559                                 if (strchr("@!\"$%^&*(){}[]_=+;:'#~,<>/?\\|`",*x))
560                                 {
561                                         ServerInstance->stats->statsUnknown++;
562                                         WriteServ(user->fd,"421 %s %s :Unknown command",user->nick,command);
563                                         return;
564                                 }
565                         }
566                 }
567         }
568
569         std::string xcommand = command;
570         if ((user->registered != 7) && (xcommand == "SERVER"))
571         {
572                 kill_link(user,"Server connection to non-server port");
573                 return;
574         }
575         
576         /* Tweak by brain - why was this INSIDE the mainloop? */
577         if (parameters)
578         {
579                  if (parameters[0])
580                  {
581                          items = this->ProcessParameters(command_p,parameters);
582                  }
583                  else
584                  {
585                          items = 0;
586                          command_p[0] = NULL;
587                  }
588         }
589         else
590         {
591                 items = 0;
592                 command_p[0] = NULL;
593         }
594
595         int MOD_RESULT = 0;
596         FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,false));
597         if (MOD_RESULT == 1) {
598                 return;
599         }
600         
601         nspace::hash_map<std::string,command_t*>::iterator cm = cmdlist.find(xcommand);
602         
603         if (cm != cmdlist.end())
604         {
605                 if (user)
606                 {
607                         /* activity resets the ping pending timer */
608                         user->nping = TIME + user->pingmax;
609                         if ((items) < cm->second->min_params)
610                         {
611                                 log(DEBUG,"not enough parameters: %s %s",user->nick,command);
612                                 WriteServ(user->fd,"461 %s %s :Not enough parameters",user->nick,command);
613                                 return;
614                         }
615                         if ((!strchr(user->modes,cm->second->flags_needed)) && (cm->second->flags_needed))
616                         {
617                                 log(DEBUG,"permission denied: %s %s",user->nick,command);
618                                 WriteServ(user->fd,"481 %s :Permission Denied- You do not have the required operator privilages",user->nick);
619                                 cmd_found = 1;
620                                 return;
621                         }
622                         if ((cm->second->flags_needed) && (!user->HasPermission(xcommand)))
623                         {
624                                 log(DEBUG,"permission denied: %s %s",user->nick,command);
625                                 WriteServ(user->fd,"481 %s :Permission Denied- Oper type %s does not have access to command %s",user->nick,user->oper,command);
626                                 if (!IS_LOCAL(user))
627                                         WriteOpers("*** \2WARNING\2: Command '%s' not allowed for oper '%s', dropped.",command,user->nick);
628                                 cmd_found = 1;
629                                 return;
630                         }
631                         /* if the command isnt USER, PASS, or NICK, and nick is empty,
632                          * deny command! */
633                         if ((cm->second != command_user) && (cm->second != command_nick) && (cm->second != command_pass))
634                         {
635                                 if ((!isnick(user->nick)) || (user->registered != 7))
636                                 {
637                                         log(DEBUG,"not registered: %s %s",user->nick,command);
638                                         WriteServ(user->fd,"451 %s :You have not registered",command);
639                                         return;
640                                 }
641                         }
642                         if ((user->registered == 7) && (!*user->oper) && (*Config->DisabledCommands))
643                         {
644                                 std::stringstream dcmds(Config->DisabledCommands);
645                                 std::string thiscmd;
646                                 while (dcmds >> thiscmd)
647                                 {
648                                         if (!strcasecmp(thiscmd.c_str(),command))
649                                         {
650                                                 // command is disabled!
651                                                 WriteServ(user->fd,"421 %s %s :This command has been disabled.",user->nick,command);
652                                                 return;
653                                         }
654                                 }
655                         }
656                         if ((user->registered == 7) || (cm->second == command_user) || (cm->second == command_nick) || (cm->second == command_pass))
657                         {
658                                 /* ikky /stats counters */
659                                 if (temp)
660                                 {
661                                         cm->second->use_count++;
662                                         cm->second->total_bytes+=strlen(temp);
663                                 }
664
665                                 int MOD_RESULT = 0;
666                                 FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,true));
667                                 if (MOD_RESULT == 1)
668                                 {
669                                         return;
670                                 }
671
672                                 /*
673                                  * WARNING: nothing may come after the
674                                  * command handler call, as the handler
675                                  * may free the user structure!
676                                  */
677
678                                 cm->second->Handle(command_p,items,user);
679                                 return;
680                         }
681                         else
682                         {
683                                 WriteServ(user->fd,"451 %s :You have not registered",command);
684                                 return;
685                         }
686                 }
687         }
688         else if (user)
689         {
690                 ServerInstance->stats->statsUnknown++;
691                 WriteServ(user->fd,"421 %s %s :Unknown command",user->nick,command);
692         }
693 }
694
695 bool CommandParser::RemoveCommands(const char* source)
696 {
697         bool go_again = true;
698
699         while (go_again)
700         {
701                 go_again = false;
702
703                 for (nspace::hash_map<std::string,command_t*>::iterator i = cmdlist.begin(); i != cmdlist.end(); i++)
704                 {
705                         command_t* x = i->second;
706                         if (x->source == std::string(source))
707                         {
708                                 log(DEBUG,"removecommands(%s) Removing dependent command: %s",x->source.c_str(),x->command.c_str());
709                                 cmdlist.erase(i);
710                                 go_again = true;
711                                 break;
712                         }
713                 }
714         }
715
716         return true;
717 }
718
719 void CommandParser::ProcessBuffer(const char* cmdbuf,userrec *user)
720 {
721         char cmd[MAXBUF];
722
723         if (!user || !cmdbuf || !*cmdbuf)
724         {
725                 log(DEFAULT,"*** BUG *** process_buffer was given an invalid parameter");
726                 return;
727         }
728
729         while (*cmdbuf == ' ') cmdbuf++; // strip leading spaces
730
731         if (!*cmdbuf)
732                 return;
733         
734         strlcpy(cmd,cmdbuf,MAXBUF);
735
736         while (charremove(cmd,10));
737         while (charremove(cmd,13));
738
739         int sl = strlen(cmd)-1;
740         while (sl && (cmd[sl] == ' ')) // strip trailing spaces
741         {
742                 cmd[sl--] = 0;
743         }
744
745         if (!sl)
746                 return;
747
748         log(DEBUG,"CMDIN: %s %s",user->nick,cmd);
749
750         tidystring(cmd);
751
752         if (user && cmd)
753         {
754                 this->ProcessCommand(user,cmd);
755         }
756 }
757
758 bool CommandParser::CreateCommand(command_t *f)
759 {
760         /* create the command and push it onto the table */
761         if (cmdlist.find(f->command) == cmdlist.end())
762         {
763                 cmdlist[f->command] = f;
764                 log(DEBUG,"Added command %s (%lu parameters)",f->command.c_str(),(unsigned long)f->min_params);
765                 return true;
766         }
767         else return false;
768 }
769
770 CommandParser::CommandParser()
771 {
772         this->SetupCommandTable();
773 }
774
775 void CommandParser::SetupCommandTable()
776 {
777         /* These three are special (can occur without
778          * full user registration) and so are saved
779          * for later use.
780          */
781         command_user = new cmd_user;
782         command_nick = new cmd_nick;
783         command_pass = new cmd_pass;
784         this->CreateCommand(command_user);
785         this->CreateCommand(command_nick);
786         this->CreateCommand(command_pass);
787
788         /* The rest of these arent special. boo hoo.
789          */
790         this->CreateCommand(new cmd_quit);
791         this->CreateCommand(new cmd_version);
792         this->CreateCommand(new cmd_ping);
793         this->CreateCommand(new cmd_pong);
794         this->CreateCommand(new cmd_admin);
795         this->CreateCommand(new cmd_privmsg);
796         this->CreateCommand(new cmd_info);
797         this->CreateCommand(new cmd_time);
798         this->CreateCommand(new cmd_whois);
799         this->CreateCommand(new cmd_wallops);
800         this->CreateCommand(new cmd_notice);
801         this->CreateCommand(new cmd_join);
802         this->CreateCommand(new cmd_names);
803         this->CreateCommand(new cmd_part);
804         this->CreateCommand(new cmd_kick);
805         this->CreateCommand(new cmd_mode);
806         this->CreateCommand(new cmd_topic);
807         this->CreateCommand(new cmd_who);
808         this->CreateCommand(new cmd_motd);
809         this->CreateCommand(new cmd_rules);
810         this->CreateCommand(new cmd_oper);
811         this->CreateCommand(new cmd_list);
812         this->CreateCommand(new cmd_die);
813         this->CreateCommand(new cmd_restart);
814         this->CreateCommand(new cmd_kill);
815         this->CreateCommand(new cmd_rehash);
816         this->CreateCommand(new cmd_lusers);
817         this->CreateCommand(new cmd_stats);
818         this->CreateCommand(new cmd_userhost);
819         this->CreateCommand(new cmd_away);
820         this->CreateCommand(new cmd_ison);
821         this->CreateCommand(new cmd_summon);
822         this->CreateCommand(new cmd_users);
823         this->CreateCommand(new cmd_invite);
824         this->CreateCommand(new cmd_trace);
825         this->CreateCommand(new cmd_whowas);
826         this->CreateCommand(new cmd_connect);
827         this->CreateCommand(new cmd_squit);
828         this->CreateCommand(new cmd_modules);
829         this->CreateCommand(new cmd_links);
830         this->CreateCommand(new cmd_map);
831         this->CreateCommand(new cmd_kline);
832         this->CreateCommand(new cmd_gline);
833         this->CreateCommand(new cmd_zline);
834         this->CreateCommand(new cmd_qline);
835         this->CreateCommand(new cmd_eline);
836         this->CreateCommand(new cmd_loadmodule);
837         this->CreateCommand(new cmd_unloadmodule);
838         this->CreateCommand(new cmd_server);
839         this->CreateCommand(new cmd_commands);
840 }
841