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