summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/client.c b/client.c
index 0766ef1..a598ec0 100644
--- a/client.c
+++ b/client.c
@@ -46,7 +46,6 @@ struct Client {
 	struct tls *tls;
 	enum Need need;
 	size_t consumer;
-	bool passive;
 	enum Cap caps;
 	char buf[1024];
 	size_t len;
@@ -63,7 +62,7 @@ struct Client *clientAlloc(struct tls *tls) {
 
 void clientFree(struct Client *client) {
 	if (!client->need) {
-		if (!client->passive && !--active) {
+		if (!(client->caps & CapPassive) && !--active) {
 			serverFormat("AWAY :%s\r\n", clientAway);
 		}
 	}
@@ -115,7 +114,7 @@ static void maybeSync(struct Client *client) {
 	if (client->need == NeedPass) passRequired(client);
 	if (!client->need) {
 		stateSync(client);
-		if (!client->passive && !active++) {
+		if (!(client->caps & CapPassive) && !active++) {
 			serverFormat("AWAY\r\n");
 		}
 	}
@@ -139,7 +138,7 @@ static void handleUser(struct Client *client, struct Message *msg) {
 	} else {
 		client->need &= ~NeedUser;
 		client->consumer = ringConsumer(msg->params[0]);
-		client->passive = (msg->params[0][0] == '-');
+		if (msg->params[0][0] == '-') client->caps |= CapPassive;
 		maybeSync(client);
 	}
 }
@@ -161,7 +160,7 @@ static void handlePass(struct Client *client, struct Message *msg) {
 
 static void handleCap(struct Client *client, struct Message *msg) {
 	if (!msg->params[0]) msg->params[0] = "";
-	enum Cap avail = CapServerTime | (stateCaps & ~CapSASL);
+	enum Cap avail = CapServerTime | CapPassive | (stateCaps & ~CapSASL);
 
 	if (!strcmp(msg->params[0], "END")) {
 		if (!client->need) return;
over-highlight'> So good, but so long. Reminded me of The Ten Thousand Doors of January at the beginning, and more of that N. K. Jemisin series about gods later. I like this interacting with gods and becoming something like one sort of thing. God, it took me a whole month (more?) to read and this is only my third book of the year :( I need some more novellas to read, but the other books I have from the library currently are also thick. 2022-03-22Source ~/.profile.local if it existsJune McEnroe 2022-03-18Publish "Addendum 2021"June McEnroe 2022-03-16Remove wcwidth portJune McEnroe DYLD_FORCE_FLAT_NAMESPACE no longer exists in macOS 12 so this approach doesn't work anymore. Moved to <https://git.causal.agency/jorts/tree/wcwidth> and compiled into <https://git.causal.agency/jorts/tree/ncurses>. 2022-03-16Remove -j4 from ./PlanJune McEnroe Plan learned to set this automatically! 2022-03-15Rewrite Linux install.sh for DebianJune McEnroe 2022-03-15Remove dashJune McEnroe