summary refs log tree commit diff
path: root/command.c
diff options
context:
space:
mode:
authorC. McEnroe2020-02-13 05:05:53 -0500
committerC. McEnroe2020-02-13 05:05:53 -0500
commit92ccabaafdd0f24752924dc4ce7b1e932dced561 (patch)
tree85803ecf4d9dedc24e517acfd5b3975412aa5050 /command.c
parentff518a8eb9b811f86f047ccd810c6dae85b18f1a (diff)
Refactor windows into array and add /move
Oof.
Diffstat (limited to 'command.c')
-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 },