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