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