fixed cmd_linker output for empty subcommand list
authorpk910 <philipp@zoelle1.de>
Wed, 21 Dec 2011 23:31:49 +0000 (00:31 +0100)
committerpk910 <philipp@zoelle1.de>
Wed, 21 Dec 2011 23:33:03 +0000 (00:33 +0100)
src/modcmd.c

index aca47f66a14682780e54fe289904bf28fabd771a..6f0ade7bd31efd52a261e21d409327d5ff4cf7f9 100644 (file)
@@ -163,6 +163,8 @@ static void handle_command(struct ClientSocket *client, struct UserNode *user, s
     struct cmd_binding *cbind;
     for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) {
         if(cbind->botid == client->botid && (cbind->botid || cbind->clientid == client->clientid) && stricmp(cbind->cmd, message) == 0) {
+            //get a text bot
+            tmp_text_client = get_botwise_prefered_bot(client->botid, (client->botid == 0 ? client->clientid : 0));
             if(cbind->func->func == modcmd_linker) {
                 //links subcommands
                 char command[MAXLEN];
@@ -191,7 +193,7 @@ static void handle_command(struct ClientSocket *client, struct UserNode *user, s
                             subcompos += sprintf(subcommands + subcompos, (subcompos ? ", %s" : "%s"), cbind->cmd + commandlen);
                         }
                     }
-                    reply(tmp_text_client, user, "MODCMD_SUBCOMMANDS", parent_bind->cmd, subcommands);
+                    reply(tmp_text_client, user, "MODCMD_SUBCOMMANDS", parent_bind->cmd, (subcompos ? subcommands : "\1dnone\1d"));
                     break;
                 }
             }
@@ -204,8 +206,6 @@ static void handle_command(struct ClientSocket *client, struct UserNode *user, s
                     break;
                 chan = sent_chan;
             }
-            //get a text bot
-            tmp_text_client = get_botwise_prefered_bot(client->botid, (client->botid == 0 ? client->clientid : 0));
             //parse the arguments...
             char *arga[MAXNUMPARAMS];
             char **argv;