From be42ae9721e6c4dc079539ee60b1c2f06e1241d9 Mon Sep 17 00:00:00 2001 From: pk910 Date: Sat, 3 Nov 2012 15:17:19 +0100 Subject: [PATCH] fixed modcmd subcommand linker: do not cut off the first parameter if no subcommand was found --- src/modcmd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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) { -- 2.20.1