about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-16 22:19:23 -0400
committerJune McEnroe <june@causal.agency>2018-08-16 22:19:23 -0400
commita38738c93885fc177a42b280a328471424fc030a (patch)
tree3e87460f1ff301c9fa703fcbdb0f9c28731ec447
parentDetect pings in ACTIONs (diff)
downloadcatgirl-a38738c93885fc177a42b280a328471424fc030a.tar.gz
catgirl-a38738c93885fc177a42b280a328471424fc030a.zip
Don't treat input as command if word contains extra slash
-rw-r--r--input.c10
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) {
e 2022-07-30Add Normal PeopleJune McEnroe 2022-07-26Rewrite glitch from new pngoJune McEnroe 2022-07-26Update Care with time-to-ID and piercingsJune McEnroe 2022-07-26Add -w to upJune McEnroe 2022-07-13Set push.autoSetupRemoteJune McEnroe 2022-07-08Remove TOURJune McEnroe 2022-07-03Add The Bone Shard EmperorJune McEnroe 2022-06-25Bump xterm font size to 12June McEnroe 2022-06-10Handle subshells (and functions) inside substitutionsJune McEnroe 2022-06-10Switch to jorts Install scriptJune McEnroe 2022-06-08Indicate if still reading or no resultsJune McEnroe 2022-06-08Add Maiden, Mother, CroneJune McEnroe 2022-06-05FIRST SHOW IN 2.5 YEARS BABEY!!!June McEnroe 2022-06-03Set line number on File linesJune McEnroe 2022-06-03Stop polling stdin after EOFJune McEnroe 2022-06-02Set TABSIZE=4June McEnroe 2022-06-02Do basic match highlightingJune McEnroe 2022-06-02Clean up parsing a littleJune McEnroe 2022-06-02Don't duplicate path stringJune McEnroe 2022-06-02Use stderr instead of /dev/tty, realloc buffer if lines too longJune McEnroe 2022-06-02Add initial working version of qfJune McEnroe 2022-05-29Set prompt for okshJune McEnroe