/[svn]/hopm/branches/1.1.x/src/opercmd.c
ViewVC logotype

Diff of /hopm/branches/1.1.x/src/opercmd.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8580 by michael, Sun Oct 14 15:15:05 2018 UTC revision 8581 by michael, Sun Oct 14 16:58:58 2018 UTC
# Line 160  command_parse(const char *command, const Line 160  command_parse(const char *command, const
160    };    };
161    
162    if (OPT_DEBUG)    if (OPT_DEBUG)
163      log_printf("COMMAND -> Parsing command (%s) from %s [%s]", command,      log_printf("COMMAND -> Parsing command (%s) from %s [%s]",
164                 source_p, target);                 command, source_p, target);
165    
166    /* Only allow OptionsItem.command_queue_size commands in the queue */    /* Only allow OptionsItem.command_queue_size commands in the queue */
167    if (LIST_SIZE(&COMMANDS) >= OptionsItem.command_queue_size)    if (LIST_SIZE(&COMMANDS) >= OptionsItem.command_queue_size)
# Line 169  command_parse(const char *command, const Line 169  command_parse(const char *command, const
169    
170    /*    /*
171     * Parameter is the first character in command after the first space.     * Parameter is the first character in command after the first space.
172     * param will be NULL if:     * 'param' will be NULL if:
173     * 1. There was no space     * 1. There was no space
174     * 2. There was a space but it was the last character in command, in which case     * 2. There was a space but it was the last character in command, in which case
175     *    param = '\0'     *    param = '\0'
# Line 178  command_parse(const char *command, const Line 178  command_parse(const char *command, const
178    /* Skip past the botname/!all */    /* Skip past the botname/!all */
179    command = strchr(command, ' ');    command = strchr(command, ' ');
180    
   /* TBD: skip leading spaces if there's more than one */  
181    /*    /*
182     * There is no command OR there is at least nothing     * There is no command OR there is at least nothing
183     * past that first space.     * past that first space.
# Line 205  command_parse(const char *command, const Line 204  command_parse(const char *command, const
204        /* Queue this command */        /* Queue this command */
205        struct Command *cmd = command_create(tab, param, source_p, target);        struct Command *cmd = command_create(tab, param, source_p, target);
206    
207        list_add(&COMMANDS, &cmd->node);        list_add(cmd, &cmd->node, &COMMANDS);
208        break;        break;
209      }      }
210    }    }
# Line 243  command_timer(void) Line 242  command_timer(void)
242    
243      if ((present - command->added) > OptionsItem.command_timeout)      if ((present - command->added) > OptionsItem.command_timeout)
244      {      {
245        list_remove(&COMMANDS, &command->node);        list_remove(&command->node, &COMMANDS);
246        command_free(command);  /* Cleanup the command */        command_free(command);  /* Cleanup the command */
247      }      }
248      else  /* Since the queue is in order, it's also ordered by time, no nodes after this will be timed out */      else  /* Since the queue is in order, it's also ordered by time, no nodes after this will be timed out */
# Line 296  command_userhost(const char *reply) Line 295  command_userhost(const char *reply)
295        if (oper)        if (oper)
296          command->tab->handler(command->param, command->target);          command->tab->handler(command->param, command->target);
297    
298        list_remove(&COMMANDS, &command->node);        list_remove(&command->node, &COMMANDS);
299        command_free(command);  /* Cleanup the command */        command_free(command);  /* Cleanup the command */
300      }      }
301    }    }

Legend:
Removed from v.8580  
changed lines
  Added in v.8581

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28