summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bounce.h1
-rw-r--r--client.c9
-rw-r--r--pounce.113
3 files changed, 14 insertions, 9 deletions
diff --git a/bounce.h b/bounce.h
index 497640d..5bff619 100644
--- a/bounce.h
+++ b/bounce.h
@@ -63,6 +63,7 @@ static inline struct Message parse(char *line) {
 #define ENUM_CAP \
 	X("account-notify", CapAccountNotify) \
 	X("away-notify", CapAwayNotify) \
+	X("causal.agency/passive", CapPassive) \
 	X("chghost", CapChghost) \
 	X("extended-join", CapExtendedJoin) \
 	X("invite-notify", CapInviteNotify) \
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;
diff --git a/pounce.1 b/pounce.1
index 06ffc94..3b7f8e1 100644
--- a/pounce.1
+++ b/pounce.1
@@ -1,4 +1,4 @@
-.Dd January 7, 2020
+.Dd January 10, 2020
 .Dt POUNCE 1
 .Os
 .
@@ -284,12 +284,17 @@ New clients with the same username
 are assumed to be reconnections
 and will cause previous connections
 to stop receiving messages.
-Clients with usernames beginning with hyphen
+The nickname and real name
+sent by clients are ignored.
+.
+.Pp
+Clients which request the
+.Sy causal.agency/passive
+capability
+or with usernames beginning with hyphen
 .Ql -
 are considered passive
 and do not affect away status.
-The nickname and real name sent by clients
-are ignored.
 .
 .Pp
 Pass-through of the following IRCv3 capabilities
> 2009-06-07Add head-include configuration option.Mark Lodato This patch adds an option to the configuration file, "head-include", which works just like "header" or "footer", except the content is put into the HTML's <head> tag. 2009-03-15CGIT 0.8.2.1Lars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-03-15Fix doc-related glitches in Makefile and .gitignoreLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-03-15ui-snapshot: avoid segfault when no filename is specifiedLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-03-15fix segfault when displaying empty blobsEric Wong When size is zero, subtracting one from it turns it into ULONG_MAX which causes an out-of-bounds access on buf. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-19Add support for HEAD requestsLars Hjemli This is a quick 'n dirty hack which makes cgit honor HEAD requests. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-19Add support for ETag in 'plain' viewLars Hjemli When downloading a blob identified by its path, the client might want to know if the blob has been modified since a previous download of the same path. To this end, an ETag containing the blob SHA1 seems to be ideal. Todo: add support for HEAD requests... Suggested-by: Owen Taylor <otaylor@redhat.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-12ui-tree: escape ascii-text properly in hexdump viewLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-12Makefile: add doc-related targetsLars Hjemli