about summary refs log tree commit diff
path: root/command.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-13 05:05:53 -0500
committerJune McEnroe <june@causal.agency>2020-02-13 05:05:53 -0500
commit92ccabaafdd0f24752924dc4ce7b1e932dced561 (patch)
tree85803ecf4d9dedc24e517acfd5b3975412aa5050 /command.c
parentClean up manual lints (diff)
downloadcatgirl-92ccabaafdd0f24752924dc4ce7b1e932dced561.tar.gz
catgirl-92ccabaafdd0f24752924dc4ce7b1e932dced561.zip
Refactor windows into array and add /move
Oof.
Diffstat (limited to '')
-rw-r--r--command.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/command.c b/command.c
index 8166e2b..f801666 100644
--- a/command.c
+++ b/command.c
@@ -159,6 +159,17 @@ static void commandWindow(size_t id, char *params) {
 	}
 }
 
+static void commandMove(size_t id, char *params) {
+	if (!params) return;
+	char *name = strsep(&params, " ");
+	if (params) {
+		id = idFind(name);
+		if (id) uiMoveID(id, strtoul(params, NULL, 10));
+	} else {
+		uiMoveID(id, strtoul(name, NULL, 10));
+	}
+}
+
 static void commandClose(size_t id, char *params) {
 	if (!params) {
 		uiCloseID(id);
@@ -213,6 +224,7 @@ static const struct Handler {
 	{ "/join", .fn = commandJoin, .restricted = true },
 	{ "/list", .fn = commandList },
 	{ "/me", .fn = commandMe },
+	{ "/move", .fn = commandMove },
 	{ "/msg", .fn = commandMsg, .restricted = true },
 	{ "/names", .fn = commandNames },
 	{ "/nick", .fn = commandNick },