Don't treat input as command if word contains extra slash

weechat-hashes
Curtis McEnroe 2018-08-16 22:19:23 -04:00
parent 7082820299
commit a38738c938
No known key found for this signature in database
GPG Key ID: CEA2F97ADCFCD77C
1 changed files with 9 additions and 1 deletions

10
input.c
View File

@ -155,7 +155,14 @@ static const struct {
static const size_t COMMANDS_LEN = sizeof(COMMANDS) / sizeof(COMMANDS[0]); static const size_t COMMANDS_LEN = sizeof(COMMANDS) / sizeof(COMMANDS[0]);
void input(struct Tag tag, char *input) { 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) { if (tag.id == TAG_VERBOSE.id) {
ircFmt("%s\r\n", input); ircFmt("%s\r\n", input);
} else if (tag.id != TAG_STATUS.id) { } else if (tag.id != TAG_STATUS.id) {
@ -163,6 +170,7 @@ void input(struct Tag tag, char *input) {
} }
return; return;
} }
char *command = strsep(&input, " "); char *command = strsep(&input, " ");
if (input && !input[0]) input = NULL; if (input && !input[0]) input = NULL;
for (size_t i = 0; i < COMMANDS_LEN; ++i) { for (size_t i = 0; i < COMMANDS_LEN; ++i) {