summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-07-02 19:34:19 -0400
committerJune McEnroe <june@causal.agency>2019-07-02 19:34:19 -0400
commitfe38982b435b557ae6f28985dc2458f762e2ca14 (patch)
tree53b510fbb4a2bc7e83674457107a58b80d1ae489
parentSplit /raw and /quote (diff)
downloadcatgirl-fe38982b435b557ae6f28985dc2458f762e2ca14.tar.gz
catgirl-fe38982b435b557ae6f28985dc2458f762e2ca14.zip
Clean up input parameter handling
-rw-r--r--input.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/input.c b/input.c
index 77c57cc..81ff1cf 100644
--- a/input.c
+++ b/input.c
@@ -56,11 +56,11 @@ static void inputMe(struct Tag tag, char *params) {
 
 static void inputNick(struct Tag tag, char *params) {
 	char *nick = strsep(&params, " ");
-	if (nick) {
-		ircFmt("NICK :%s\r\n", nick);
-	} else {
-		uiLog(tag, UIHot, L"/nick requires a nickname");
+	if (!nick) {
+		uiLog(tag, UIHot, L"/nick requires a name");
+		return;
 	}
+	ircFmt("NICK %s\r\n", nick);
 }
 
 static void inputPart(struct Tag tag, char *params) {
@@ -69,13 +69,13 @@ static void inputPart(struct Tag tag, char *params) {
 
 static void inputQuery(struct Tag tag, char *params) {
 	char *nick = strsep(&params, " ");
-	if (nick) {
-		tabTouch(TagNone, nick);
-		uiShowTag(tagFor(nick));
-		logReplay(tagFor(nick));
-	} else {
-		uiLog(tag, UIHot, L"/query requires a nickname");
+	if (!nick) {
+		uiLog(tag, UIHot, L"/query requires a nick");
+		return;
 	}
+	tabTouch(TagNone, nick);
+	uiShowTag(tagFor(nick));
+	logReplay(tagFor(nick));
 }
 
 static void inputQuit(struct Tag tag, char *params) {
@@ -103,11 +103,11 @@ static void inputWho(struct Tag tag, char *params) {
 
 static void inputWhois(struct Tag tag, char *params) {
 	char *nick = strsep(&params, " ");
-	if (nick) {
-		ircFmt("WHOIS :%s\r\n", nick);
-	} else {
+	if (!nick) {
 		uiLog(tag, UIHot, L"/whois requires a nick");
+		return;
 	}
+	ircFmt("WHOIS %s\r\n", nick);
 }
 
 static void inputZNC(struct Tag tag, char *params) {
@@ -129,11 +129,11 @@ static void inputMan(struct Tag tag, char *params) {
 
 static void inputMove(struct Tag tag, char *params) {
 	char *num = strsep(&params, " ");
-	if (num) {
-		uiMoveTag(tag, strtol(num, NULL, 0), num[0] == '+' || num[0] == '-');
-	} else {
+	if (!num) {
 		uiLog(tag, UIHot, L"/move requires a number");
+		return;
 	}
+	uiMoveTag(tag, strtol(num, NULL, 0), num[0] == '+' || num[0] == '-');
 }
 
 static void inputOpen(struct Tag tag, char *params) {
aade20410afadf84b14898fb39aa47eaf61d42&follow=1'>Add scheme -i to swap white and blackJune McEnroe 2018-09-21Map caps lock to escape on Linux consoleJune McEnroe 2018-09-19Fix README mandoc lintsJune McEnroe 2018-09-19Un-NOT trans.alpha values in pngoJune McEnroe 2018-09-18Refactor reads in pngo and clear palette between filesJune McEnroe 2018-09-17Add tRNS support to pngoJune McEnroe 2018-09-11Move gfx man pages to gfx/manJune McEnroe 2018-09-11Move bin man pages to bin/manJune McEnroe 2018-09-11Rewrite gfx.7 and render plaintext READMEJune McEnroe 2018-09-11Remove GAMES from BINSJune McEnroe 2018-09-11Rewrite bin.7 and render to plaintext READMEJune McEnroe 2018-09-11Add "blank" lines to man pagesJune McEnroe 2018-09-10Add mdoc syntax fileJune McEnroe 2018-09-08Fix Nm usage in multi-name man pagesJune McEnroe 2018-09-08Put real dates on man pagesJune McEnroe 2018-09-08Replace gfx README with REAMDE.7June McEnroe 2018-09-08Link gfx man pages in ~/.localJune McEnroe