about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--command.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/command.c b/command.c
index a127af3..511bc62 100644
--- a/command.c
+++ b/command.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2020  C. McEnroe <june@causal.agency>
+/* Copyright (C) 2020  June McEnroe <june@causal.agency>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -639,6 +639,12 @@ size_t commandWillSplit(uint id, const char *input) {
 	return 0;
 }
 
+static bool commandAvailable(const struct Handler *handler) {
+	if (handler->flags & Restrict && self.restricted) return false;
+	if (handler->flags & Kiosk && self.kiosk) return false;
+	return true;
+}
+
 void command(uint id, char *input) {
 	if (id == Debug && input[0] != '/' && !self.restricted) {
 		commandQuote(id, input);
@@ -667,10 +673,7 @@ void command(uint id, char *input) {
 		uiFormat(id, Warm, NULL, "No such command %s", cmd);
 		return;
 	}
-	if (
-		(self.restricted && handler->flags & Restrict) ||
-		(self.kiosk && handler->flags & Kiosk)
-	) {
+	if (!commandAvailable(handler)) {
 		uiFormat(id, Warm, NULL, "Command %s is unavailable", cmd);
 		return;
 	}
>Add photos from September 5June McEnroe 2024-09-15Add some more film stocks to the listJune McEnroe 2024-09-13Add photos from September 2June McEnroe 2024-09-13Add Fomapan 200 to films listJune McEnroe 2024-09-10Add August 29 picnic photosJune McEnroe 2024-09-08Apply some bold to trips renderingJune McEnroe 2024-09-08Render trips hopefully more efficientlyJune McEnroe 2024-09-08Allow removing bodies and lensesJune McEnroe 2024-09-08Limit body width so it looks less silly on desktopJune McEnroe 2024-09-07Handle no film being loadedJune McEnroe 2024-09-07Fancy up the text a littleJune McEnroe