about summary refs log tree commit diff
path: root/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'input.c')
-rw-r--r--input.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/input.c b/input.c
index c4f707e..8be8eaf 100644
--- a/input.c
+++ b/input.c
@@ -195,28 +195,29 @@ static void inputWindow(struct Tag tag, char *params) {
 static const struct {
 	const char *command;
 	Handler *handler;
+	bool limit;
 } Commands[] = {
-	{ "/close", inputClose },
-	{ "/help", inputMan },
-	{ "/join", inputJoin },
-	{ "/list", inputList },
-	{ "/man", inputMan },
-	{ "/me", inputMe },
-	{ "/move", inputMove },
-	{ "/names", inputWho },
-	{ "/nick", inputNick },
-	{ "/open", inputOpen },
-	{ "/part", inputPart },
-	{ "/query", inputQuery },
-	{ "/quit", inputQuit },
-	{ "/quote", inputQuote },
-	{ "/raw", inputRaw },
-	{ "/topic", inputTopic },
-	{ "/url", inputURL },
-	{ "/who", inputWho },
-	{ "/whois", inputWhois },
-	{ "/window", inputWindow },
-	{ "/znc", inputZNC },
+	{ "/close", .handler = inputClose },
+	{ "/help", .handler = inputMan },
+	{ "/join", .handler = inputJoin, .limit = true },
+	{ "/list", .handler = inputList },
+	{ "/man", .handler = inputMan },
+	{ "/me", .handler = inputMe },
+	{ "/move", .handler = inputMove },
+	{ "/names", .handler = inputWho },
+	{ "/nick", .handler = inputNick },
+	{ "/open", .handler = inputOpen },
+	{ "/part", .handler = inputPart },
+	{ "/query", .handler = inputQuery, .limit = true },
+	{ "/quit", .handler = inputQuit },
+	{ "/quote", .handler = inputQuote, .limit = true },
+	{ "/raw", .handler = inputRaw, .limit = true },
+	{ "/topic", .handler = inputTopic },
+	{ "/url", .handler = inputURL },
+	{ "/who", .handler = inputWho },
+	{ "/whois", .handler = inputWhois },
+	{ "/window", .handler = inputWindow },
+	{ "/znc", .handler = inputZNC },
 };
 static const size_t CommandsLen = sizeof(Commands) / sizeof(Commands[0]);
 
@@ -264,6 +265,10 @@ void input(struct Tag tag, char *input) {
 
 	for (size_t i = 0; i < CommandsLen; ++i) {
 		if (strcasecmp(command, Commands[i].command)) continue;
+		if (self.limit && Commands[i].limit) {
+			uiFmt(tag, UIHot, "%s isn't available in restricted mode", command);
+			return;
+		}
 		Commands[i].handler(tag, input);
 		return;
 	}
atgirl/commit/edit.c?h=2.2a&id=c8b6e331de95419de72546964f6b255dccddcd93&follow=1'>Assert return values in edit testsJune McEnroe 2022-02-20Move mbs out of struct Edit, use a global bufferJune McEnroe 2022-02-20Clear edit buffer before running commandJune McEnroe 2022-02-20Show indicator in status when window has pending inputJune McEnroe 2022-02-20Use separate edit buffers for each IDJune McEnroe 2022-02-20Make sure new cap is actually larger than new lengthJune McEnroe 2022-02-20Remove unused mbs.len field from struct EditJune McEnroe 2022-02-19Remove unneeded includes in ui.cJune McEnroe 2022-02-19Reimplement tab completeJune McEnroe 2022-02-19Handle errors from editFn, etc.June McEnroe 2022-02-19Reimplement text macrosJune McEnroe 2022-02-19Factor out input handling to input.cJune McEnroe 2022-02-19Factor out window management to window.cJune McEnroe 2022-02-19Enable -Wmissing-prototypesJune McEnroe 2022-02-19Fix edit.[ch] license notice additional permissionsJune McEnroe 2022-02-19Run line editing testsJune McEnroe 2022-02-18Implement new line editing "library"June McEnroe 2022-02-18Simplify cursor positioning in inputJune McEnroe 2022-02-18Fix M-f orderingJune McEnroe 2022-02-12Move sandman build to scripts/MakefileJune McEnroe 2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe 2022-02-12Copy RPP defines from oconfigureJune McEnroe