summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--input.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/input.c b/input.c
index dee50f2..45de9f1 100644
--- a/input.c
+++ b/input.c
@@ -41,7 +41,8 @@ static void privmsg(struct Tag tag, bool action, const char *mesg) {
 typedef void Handler(struct Tag tag, char *params);
 
 static void inputJoin(struct Tag tag, char *params) {
-	ircFmt("JOIN :%s\r\n", params ? params : tag.name);
+	char *chan = strsep(&params, " ");
+	ircFmt("JOIN :%s\r\n", chan ? chan : tag.name);
 }
 
 static void inputMe(struct Tag tag, char *params) {
@@ -49,8 +50,9 @@ static void inputMe(struct Tag tag, char *params) {
 }
 
 static void inputNick(struct Tag tag, char *params) {
-	if (params) {
-		ircFmt("NICK :%s\r\n", params);
+	char *nick = strsep(&params, " ");
+	if (nick) {
+		ircFmt("NICK :%s\r\n", nick);
 	} else {
 		uiLog(tag, UIHot, L"/nick requires a nickname");
 	}
@@ -90,8 +92,9 @@ static void inputWho(struct Tag tag, char *params) {
 }
 
 static void inputWhois(struct Tag tag, char *params) {
-	if (params) {
-		ircFmt("WHOIS :%s\r\n", params);
+	char *nick = strsep(&params, " ");
+	if (nick) {
+		ircFmt("WHOIS :%s\r\n", nick);
 	} else {
 		uiLog(tag, UIHot, L"/whois requires a nick");
 	}
@@ -142,20 +145,22 @@ static void inputURL(struct Tag tag, char *params) {
 }
 
 static void inputWindow(struct Tag tag, char *params) {
-	if (!params) {
+	char *word = strsep(&params, " ");
+	if (!word) {
 		uiLog(tag, UIHot, L"/window requires a name or number");
 		return;
 	}
-	bool relative = (params[0] == '+' || params[0] == '-');
-	int num = strtol(params, &params, 0);
-	if (!params[0]) {
+	bool relative = (word[0] == '+' || word[0] == '-');
+	char *trail;
+	int num = strtol(word, &trail, 0);
+	if (!trail[0]) {
 		uiShowNum(num, relative);
 	} else {
-		struct Tag name = tagFind(params);
+		struct Tag name = tagFind(word);
 		if (name.id != TagNone.id) {
 			uiShowTag(name);
 		} else {
-			uiFmt(tag, UIHot, "No window for %s", params);
+			uiFmt(tag, UIHot, "No window for %s", word);
 		}
 	}
 }
span title='2021-08-21 14:49:07 -0400'>2021-08-21Avoid overwriting manual AWAY messagesJune McEnroe 2021-08-20Replace verbose colors with two types of arrowsJune McEnroe 2021-08-20Explicitly clear TLS secrets after handshakeJune McEnroe 2021-08-20Handle TLS_WANT_POLL{IN,OUT} from tls_handshake(3) with serverJune McEnroe 2021-08-20Use "secure" libtls ciphersJune McEnroe 2021-07-08Use seprintf to build final 005June McEnroe 2021-06-19Fix LDADD.crypt on DarwinJune McEnroe 2021-06-18Add -m mode option to set user modesJune McEnroe 2021-06-18Document channel keys in join optionJune McEnroe 2021-06-18Use | to separate flags from config optionsJune McEnroe 2021-06-18Stop referring to server-time as IRCv3.2June McEnroe 2021-06-17Add mailing list archive to READMEJune McEnroe 2021-06-10Stop accumulating ISUPPORT tokens once MOTD startsJune McEnroe 2021-06-09Use seprintf for snip, removing strlcpynJune McEnroe 2021-06-09Use seprintf for reserializeJune McEnroe 2021-06-09Use seprintf for capListJune McEnroe 2021-06-09Add seprintfJune McEnroe 2021-05-27Add pounce-notify to README 2.4June McEnroe 2021-05-27Fix ENVIRONMENT formatting in pounce-notify(1)June McEnroe 2021-05-27Add note about Libera.Chat SASL-only rangesJune McEnroe 2021-05-25Add QUIRKS fileJune McEnroe 2021-05-19Replace freenode with tilde.chatJune McEnroe 2021-05-04notify: Reword pounce-notify manualJune McEnroe 2021-05-02Clean up Makefiles, configure scriptsJune McEnroe 2021-04-30palaver: Exit on getopt failureJune McEnroe 2021-04-30notify: Implement pounce-notifyJune McEnroe