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