220 |
|
parse_handle_command(struct Message *message, struct Client *source, |
221 |
|
unsigned int i, char *para[]) |
222 |
|
{ |
223 |
+ |
const struct MessageHandler *const handler = &message->handlers[source->from->handler]; |
224 |
+ |
|
225 |
|
if (IsServer(source->from)) |
226 |
|
++message->rcount; |
227 |
|
++message->count; |
230 |
|
flood_endgrace(source); |
231 |
|
|
232 |
|
/* Check right amount of parameters is passed... --is */ |
233 |
< |
if (i < message->args_min) |
233 |
> |
if (handler->args_min && |
234 |
> |
((i < handler->args_min) || |
235 |
> |
(handler->empty_last_arg != true && EmptyString(para[handler->args_min - 1])))) |
236 |
|
sendto_one_numeric(source, &me, ERR_NEEDMOREPARAMS, message->cmd); |
237 |
|
else |
238 |
< |
message->handlers[source->from->handler](source, i, para); |
238 |
> |
handler->handler(source, i, para); |
239 |
|
} |
240 |
|
|
241 |
|
/* |
370 |
|
|
371 |
|
assert(message->cmd); |
372 |
|
|
373 |
< |
paramcount = message->args_max; |
373 |
> |
paramcount = message->handlers[from->from->handler].args_max; |
374 |
|
|
375 |
|
size_t length = bufend - ((s) ? s : ch); |
376 |
|
message->bytes += length; |
377 |
|
} |
378 |
|
|
379 |
+ |
memset(para, 0, sizeof(para)); |
380 |
+ |
|
381 |
|
/* |
382 |
|
* Must the following loop really be so devious? On surface it |
383 |
|
* splits the message to parameters from blank spaces. But, if |
399 |
|
|
400 |
|
if (s) |
401 |
|
{ |
402 |
< |
if (paramcount > MAXPARA) |
402 |
> |
if (paramcount == 0 || paramcount > MAXPARA) |
403 |
|
paramcount = MAXPARA; |
404 |
|
|
405 |
|
while (true) |