From: pk910 Date: Sat, 3 Nov 2012 14:17:19 +0000 (+0100) Subject: fixed modcmd subcommand linker: do not cut off the first parameter if no subcommand... X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=be42ae9721e6c4dc079539ee60b1c2f06e1241d9 fixed modcmd subcommand linker: do not cut off the first parameter if no subcommand was found --- diff --git a/src/modcmd.c b/src/modcmd.c index fd71523..8ec2517 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -194,17 +194,21 @@ static struct cmd_binding *modcmd_sub_linker_command(struct ClientSocket *client args++; } sprintf(command, "%s %s", parent_bind->cmd, subcmd); + if(args) + args[-1] = ' '; for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) { if(cbind->botid == client->botid && (cbind->botid || cbind->clientid == client->clientid) && stricmp(cbind->cmd, command) == 0) break; } - *args_ptr = args; - if(cbind && cbind->func->func == modcmd_linker) { - return modcmd_linker_command(client, textclient, user, cbind, bind_index, args_ptr); + if(cbind) { + *args_ptr = args; + if(cbind->func->func == modcmd_linker) + parent_bind = modcmd_linker_command(client, textclient, user, cbind, bind_index, args_ptr); + else + parent_bind = cbind; } - return (cbind ? cbind : parent_bind); - } else - return parent_bind; + } + return parent_bind; } static void handle_command(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, char *message) {