summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--catgirl.14
-rw-r--r--chat.h1
-rw-r--r--command.c11
-rw-r--r--handle.c9
4 files changed, 24 insertions, 1 deletions
diff --git a/catgirl.1 b/catgirl.1
index a84fd9a..770fcc8 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -1,4 +1,4 @@
-.Dd February 13, 2020
+.Dd February 14, 2020
 .Dt CATGIRL 1
 .Os
 .
@@ -240,6 +240,8 @@ can be typed
 .
 .Ss Chat Commands
 .Bl -tag -width Ds
+.It Ic /away Op Ar message
+Set or clear your away status.
 .It Ic /join Ar channel
 Join a channel.
 .It Ic /list Op Ar channel
diff --git a/chat.h b/chat.h
index afa8ef9..f0dadcc 100644
--- a/chat.h
+++ b/chat.h
@@ -131,6 +131,7 @@ void ircFormat(const char *format, ...)
 void ircClose(void);
 
 extern struct Replies {
+	size_t away;
 	size_t join;
 	size_t list;
 	size_t names;
diff --git a/command.c b/command.c
index e0a2e2b..00c3040 100644
--- a/command.c
+++ b/command.c
@@ -110,6 +110,16 @@ static void commandNick(size_t id, char *params) {
 	ircFormat("NICK :%s\r\n", params);
 }
 
+static void commandAway(size_t id, char *params) {
+	(void)id;
+	if (params) {
+		ircFormat("AWAY :%s\r\n", params);
+	} else {
+		ircFormat("AWAY\r\n");
+	}
+	replies.away++;
+}
+
 static void commandTopic(size_t id, char *params) {
 	if (params) {
 		ircFormat("TOPIC %s :%s\r\n", idNames[id], params);
@@ -235,6 +245,7 @@ static const struct Handler {
 	Command *fn;
 	bool restricted;
 } Commands[] = {
+	{ "/away", .fn = commandAway },
 	{ "/close", .fn = commandClose },
 	{ "/copy", .fn = commandCopy, .restricted = true },
 	{ "/debug", .fn = commandDebug, .restricted = true },
diff --git a/handle.c b/handle.c
index 2e4f56d..6dffa17 100644
--- a/handle.c
+++ b/handle.c
@@ -549,6 +549,13 @@ static void handleReplyAway(struct Message *msg) {
 	);
 }
 
+static void handleReplyNowAway(struct Message *msg) {
+	require(msg, false, 2);
+	if (!replies.away) return;
+	uiFormat(Network, Warm, tagTime(msg), "%s", msg->params[1]);
+	replies.away--;
+}
+
 static bool isAction(struct Message *msg) {
 	if (strncmp(msg->params[1], "\1ACTION ", 8)) return false;
 	msg->params[1] += 8;
@@ -675,6 +682,8 @@ static const struct Handler {
 	{ "005", handleReplyISupport },
 	{ "276", handleReplyWhoisGeneric },
 	{ "301", handleReplyAway },
+	{ "305", handleReplyNowAway },
+	{ "306", handleReplyNowAway },
 	{ "307", handleReplyWhoisGeneric },
 	{ "311", handleReplyWhoisUser },
 	{ "312", handleReplyWhoisServer },
11:09:02 -0400'>2019-05-26Add DawnJune McEnroe 2019-05-20Declare vasprintf(3) for GNUJune McEnroe who the fuck is scraeming "#define _GNU_SOURCE" at my house. show yourself, coward. i will never #define _GNU_SOURCE 2019-05-20Fix comparison warning in ttpreJune McEnroe 2019-05-20Add AuthorityJune McEnroe 2019-05-19Specify precedence of unary versions of operatorsJune McEnroe 2019-05-18Add compound assignment operators to orderJune McEnroe 2019-05-15Support simple assignment in orderJune McEnroe 2019-05-15Implement sizeof in orderJune McEnroe 2019-05-15Add orderJune McEnroe 2019-05-12Add T suffix in bitJune McEnroe 2019-05-10Highlight yacc and lex files as CJune McEnroe Their %-prefixed directives should probably be highlighted Macro. 2019-05-10Use val instead of suboptargJune McEnroe suboptarg doesn't exist in GNU. Hopefully BSD getsubopt also sets val on failure? 2019-05-09Add Parable of the SowerJune McEnroe 2019-05-07Add bit without buildJune McEnroe Need to do some stuff in the Makefile for lex and yacc and generating HTML pages for it. 2019-05-04Fix MANDIR typoJune McEnroe 2019-05-04Move relay to binJune McEnroe