summary refs log tree commit diff
path: root/command.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-08 18:29:01 -0500
committerJune McEnroe <june@causal.agency>2020-02-08 18:29:01 -0500
commitf502260dd0aa73b09bfbb7289b50a67592866166 (patch)
tree66c829e80fc3968b3ffcabc2b11fc25acbc610c8 /command.c
parentAdd procPipe for subprocesses (diff)
downloadcatgirl-f502260dd0aa73b09bfbb7289b50a67592866166.tar.gz
catgirl-f502260dd0aa73b09bfbb7289b50a67592866166.zip
Scan messages for URLs
Diffstat (limited to 'command.c')
-rw-r--r--command.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/command.c b/command.c
index eaabc9c..4100928 100644
--- a/command.c
+++ b/command.c
@@ -144,6 +144,16 @@ static void commandClose(size_t id, char *params) {
 	}
 }
 
+static void commandOpen(size_t id, char *params) {
+	if (!params) {
+		urlOpenCount(id, 1);
+	} else if (isdigit(params[0])) {
+		urlOpenCount(id, strtoul(params, NULL, 10));
+	} else {
+		urlOpenMatch(id, params);
+	}
+}
+
 static const struct Handler {
 	const char *cmd;
 	Command *fn;
@@ -155,6 +165,7 @@ static const struct Handler {
 	{ "/names", commandNames },
 	{ "/nick", commandNick },
 	{ "/notice", commandNotice },
+	{ "/open", commandOpen },
 	{ "/part", commandPart },
 	{ "/query", commandQuery },
 	{ "/quit", commandQuit },