summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/client.c b/client.c
index 3e8b15b..32b5b0f 100644
--- a/client.c
+++ b/client.c
@@ -28,6 +28,8 @@
 
 #include "bounce.h"
 
+static size_t count;
+
 enum Need {
 	NeedNick = 1 << 0,
 	NeedUser = 1 << 1,
@@ -54,6 +56,9 @@ struct Client *clientAlloc(struct tls *tls) {
 }
 
 void clientFree(struct Client *client) {
+	if (!client->need) {
+		if (!--count) serverFormat("AWAY :%s\r\n", clientAway);
+	}
 	tls_close(client->tls);
 	tls_free(client->tls);
 	free(client);
@@ -100,7 +105,10 @@ static void passRequired(struct Client *client) {
 
 static void maybeSync(struct Client *client) {
 	if (client->need == NeedPass) passRequired(client);
-	if (!client->need) stateSync(client);
+	if (!client->need) {
+		stateSync(client);
+		if (!count++) serverFormat("AWAY\r\n");
+	}
 }
 
 typedef void Handler(struct Client *client, struct Message *msg);
-0500'>2020-11-22Day 9, part 2June McEnroe 2020-11-22Day 9June McEnroe I was really sick at the start of the week, okay? 2020-11-22Day 8, part 2June McEnroe 2020-11-22Day 8June McEnroe 2020-11-22Day 7, part 2June McEnroe I don't even know what this is. Don't look at it. 2020-11-22Day 7June McEnroe 2020-11-22Day 6, part 2June McEnroe 2020-11-22Day 6June McEnroe 2020-11-22Day 5, part 2June McEnroe 2020-11-22Day 5June McEnroe 2020-11-22Day 4, part 2June McEnroe That ugly sort map though. 2020-11-22Day 4June McEnroe 2020-11-22Day 3, part 2June McEnroe I am super surprised that worked on the first try. 2020-11-22Day 3, clean upJune McEnroe 2020-11-22Day 3June McEnroe This is fucking awful and I'm angry. 2020-11-22Day 2, part 2June McEnroe 2020-11-22Day 2June McEnroe 2020-11-22Day 1, part 2June McEnroe 2020-11-22Day 1June McEnroe 2020-11-22Move to 2016 directoryJune McEnroe