about summary refs log tree commit diff
path: root/state.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-08-21 14:49:07 -0400
committerJune McEnroe <june@causal.agency>2021-08-21 14:49:07 -0400
commit0e3cdc19922c6ea0b3b63264b5362e1984e8b466 (patch)
treeb57849e5ea9390a3e308edfea78c951604d83030 /state.c
parentReplace verbose colors with two types of arrows (diff)
downloadpounce-0e3cdc19922c6ea0b3b63264b5362e1984e8b466.tar.gz
pounce-0e3cdc19922c6ea0b3b63264b5362e1984e8b466.zip
Avoid overwriting manual AWAY messages
Setting an AWAY message then disconnecting will no longer replace
the AWAY message with the default one. Reconnecting continues to
always clear AWAY.
Diffstat (limited to '')
-rw-r--r--state.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/state.c b/state.c
index 21669c4..edc4b92 100644
--- a/state.c
+++ b/state.c
@@ -38,6 +38,7 @@
 
 bool stateNoNames;
 enum Cap stateCaps;
+bool stateAway;
 
 typedef void Handler(struct Message *msg);
 
@@ -331,6 +332,16 @@ static void handleReplyTopic(struct Message *msg) {
 	chanTopic(msg->params[1], msg->params[2]);
 }
 
+static void handleReplyUnaway(struct Message *msg) {
+	(void)msg;
+	stateAway = false;
+}
+
+static void handleReplyNowAway(struct Message *msg) {
+	(void)msg;
+	stateAway = true;
+}
+
 static void handleError(struct Message *msg) {
 	require(msg, false, 1);
 	errx(EX_UNAVAILABLE, "%s", msg->params[0]);
@@ -345,6 +356,8 @@ static const struct {
 	{ "003", handleReplyCreated },
 	{ "004", handleReplyMyInfo },
 	{ "005", handleReplyISupport },
+	{ "305", handleReplyUnaway },
+	{ "306", handleReplyNowAway },
 	{ "332", handleReplyTopic },
 	{ "375", handleReplyMOTDStart },
 	{ "422", handleReplyMOTDStart },