fixed modcmd subcommand linker: do not cut off the first parameter if no subcommand...
authorpk910 <philipp@zoelle1.de>
Sat, 3 Nov 2012 14:17:19 +0000 (15:17 +0100)
committerpk910 <philipp@zoelle1.de>
Sat, 3 Nov 2012 14:17:19 +0000 (15:17 +0100)
src/modcmd.c

index fd71523edfd64869f47cb60a0913c7f0bc762656..8ec2517ef9c640bcbeb3f909a306980c02800d94 100644 (file)
@@ -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) {