diff options
author | June McEnroe <june@causal.agency> | 2020-02-13 05:05:53 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-02-13 05:05:53 -0500 |
commit | 92ccabaafdd0f24752924dc4ce7b1e932dced561 (patch) | |
tree | 85803ecf4d9dedc24e517acfd5b3975412aa5050 /command.c | |
parent | Clean up manual lints (diff) | |
download | catgirl-92ccabaafdd0f24752924dc4ce7b1e932dced561.tar.gz catgirl-92ccabaafdd0f24752924dc4ce7b1e932dced561.zip |
Refactor windows into array and add /move
Oof.
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 12 |
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(¶ms, " "); + 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 }, |