show whole binding (inclusive predefined parameters) and trigger count _per bind_
[NeonServV5.git] / src / modcmd.c
index bfefb4bdca33f4c82a320dfc029806c3fb32fb54..931c508df83daaca0d0751e056effa8720d0c28c 100644 (file)
@@ -57,6 +57,8 @@ static struct cmd_function *cmd_functions = NULL;
 static struct trigger_callback *trigger_callbacks = NULL;
 static struct cmd_bot_alias *bot_aliases = NULL;
 static struct ClientSocket *tmp_text_client;
+static int total_triggered = 0;
+int statistics_commands = 0;
 
 static const struct default_language_entry msgtab[] = {
     {"MODCMD_LESS_PARAM_COUNT", "This command requires more parameters."},
@@ -153,6 +155,15 @@ 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 && stricmp(cbind->cmd, message) == 0) {
+            if(statistics_enabled)
+                statistics_commands++;
+            total_triggered++;
+            cbind->triggered++;
+            if((cbind->func->flags & CMDFLAG_FUNCMD)) {
+                if(!sent_chan)
+                    break;
+                chan = sent_chan;
+            }
             //get a text bot
             tmp_text_client = get_prefered_bot(client->botid);
             //parse the arguments...
@@ -529,6 +540,7 @@ int bind_cmd_to_function(int botid, char *cmd, struct cmd_function *func) {
     cbind->global_access = 0;
     cbind->channel_access = NULL;
     cbind->flags = 0;
+    cbind->triggered = 0;
     cbind->next = cmd_binds[bind_index];
     cmd_binds[bind_index] = cbind;
     return 1;
@@ -574,6 +586,7 @@ int bind_cmd_to_command(int botid, char *cmd, char *func) {
     cbind->global_access = 0;
     cbind->channel_access = NULL;
     cbind->flags = 0;
+    cbind->triggered = 0;
     cmd_binds[bind_index] = cbind;
     return 1;
 }
@@ -768,7 +781,7 @@ void bind_unbound_required_functions(int botid) {
     }
 }
 
-void register_bot_alias(int botid, char *alias) {
+void register_command_alias(int botid, char *alias) {
     struct cmd_bot_alias *botalias;
     for(botalias = bot_aliases; botalias; botalias = botalias->next) {
         if(!stricmp(botalias->alias, alias))