… | |
… | |
2 | * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
2 | * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
3 | * Rights to this code are as documented in doc/pod/gplicense.pod. |
3 | * Rights to this code are as documented in doc/pod/gplicense.pod. |
4 | * |
4 | * |
5 | * Commandtree manipulation routines. |
5 | * Commandtree manipulation routines. |
6 | * |
6 | * |
7 | * $Id: commandtree.C,v 1.4 2007/08/29 08:04:33 pippijn Exp $ |
7 | * $Id: commandtree.C,v 1.5 2007/08/29 21:01:18 pippijn Exp $ |
8 | */ |
8 | */ |
9 | |
9 | |
10 | #include <algorithm> |
10 | #include <algorithm> |
11 | |
11 | |
12 | #include "atheme.h" |
12 | #include "atheme.h" |
13 | #include "users.h" |
13 | #include "users.h" |
14 | #include "privs.h" |
14 | #include "privs.h" |
15 | |
15 | |
16 | static char const rcsid[] = "$Id: commandtree.C,v 1.4 2007/08/29 08:04:33 pippijn Exp $"; |
16 | static char const rcsid[] = "$Id: commandtree.C,v 1.5 2007/08/29 21:01:18 pippijn Exp $"; |
17 | |
17 | |
18 | cmdvec null_cmdvec; |
18 | cmdvec null_cmdvec; |
19 | |
19 | |
20 | struct cmd_eq |
20 | struct cmd_eq |
21 | { |
21 | { |
… | |
… | |
141 | |
141 | |
142 | void |
142 | void |
143 | command_exec_split (service_t *svs, sourceinfo_t *si, char const * const cmd, char const * const text, cmdvec &commandlist) |
143 | command_exec_split (service_t *svs, sourceinfo_t *si, char const * const cmd, char const * const text, cmdvec &commandlist) |
144 | { |
144 | { |
145 | size_t i; |
145 | size_t i; |
146 | char *parv[20]; |
146 | char *parv[20] = { 0 }; |
147 | command_t const *c; |
147 | command_t const *c; |
148 | |
148 | |
149 | if ((c = commandlist.find (cmd))) |
149 | if ((c = commandlist.find (cmd))) |
150 | { |
150 | { |
151 | unsigned const parc = sjtoken (text, ' ', parv, c->maxparc); |
151 | unsigned const parc = sjtoken (text, ' ', parv, c->maxparc); |
152 | for (i = parc; i < (sizeof (parv) / sizeof (parv[0])); i++) |
|
|
153 | parv[i] = NULL; |
|
|
154 | c->exec (svs, si, parc, parv); |
152 | c->exec (svs, si, parc, parv); |
155 | } |
153 | } |
156 | else |
154 | else |
157 | notice (svs->name, si->su->nick, _("Invalid command. Use \2/%s%s help\2 for a command listing."), (ircd->uses_rcommand == false) ? "msg " : "", svs->disp); |
155 | notice (svs->name, si->su->nick, _("Invalid command. Use \2/%s%s help\2 for a command listing."), (ircd->uses_rcommand == false) ? "msg " : "", svs->disp); |
158 | } |
156 | } |