diff options
author | June McEnroe <june@causal.agency> | 2018-08-16 22:19:23 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-08-16 22:19:23 -0400 |
commit | a38738c93885fc177a42b280a328471424fc030a (patch) | |
tree | 3e87460f1ff301c9fa703fcbdb0f9c28731ec447 | |
parent | Detect pings in ACTIONs (diff) | |
download | catgirl-a38738c93885fc177a42b280a328471424fc030a.tar.gz catgirl-a38738c93885fc177a42b280a328471424fc030a.zip |
Don't treat input as command if word contains extra slash
-rw-r--r-- | input.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/input.c b/input.c index 2d9bc46..997c570 100644 --- a/input.c +++ b/input.c @@ -155,7 +155,14 @@ static const struct { static const size_t COMMANDS_LEN = sizeof(COMMANDS) / sizeof(COMMANDS[0]); void input(struct Tag tag, char *input) { - if (input[0] != '/') { + bool slash = (input[0] == '/'); + if (slash) { + char *space = strchr(&input[1], ' '); + char *extra = strchr(&input[1], '/'); + if (extra && (!space || extra < space)) slash = false; + } + + if (!slash) { if (tag.id == TAG_VERBOSE.id) { ircFmt("%s\r\n", input); } else if (tag.id != TAG_STATUS.id) { @@ -163,6 +170,7 @@ void input(struct Tag tag, char *input) { } return; } + char *command = strsep(&input, " "); if (input && !input[0]) input = NULL; for (size_t i = 0; i < COMMANDS_LEN; ++i) { |