summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-24 01:18:51 -0400
committerJune McEnroe <june@causal.agency>2019-10-24 01:18:51 -0400
commitf0db35a714ccd898b5fbae30a16c6fdfb567ad32 (patch)
tree2fcc0622335b0b5eaf7d3a6a903a1769b717bc3a /client.c
parentIgnore further CAP END (diff)
downloadpounce-f0db35a714ccd898b5fbae30a16c6fdfb567ad32.tar.gz
pounce-f0db35a714ccd898b5fbae30a16c6fdfb567ad32.zip
Intercept all CAP commands from clients
Diffstat (limited to '')
-rw-r--r--client.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/client.c b/client.c
index 18aef87..68daff6 100644
--- a/client.c
+++ b/client.c
@@ -184,6 +184,12 @@ static void clientParse(struct Client *client, char *line) {
 	}
 }
 
+static bool intercept(const char *line, size_t len) {
+	if (len >= 4 && !memcmp(line, "CAP ", 4)) return true;
+	// TODO: Intercept PRIVMSG to send to other clients.
+	return false;
+}
+
 void clientRecv(struct Client *client) {
 	ssize_t read = tls_read(
 		client->tls,
@@ -205,7 +211,7 @@ void clientRecv(struct Client *client) {
 		if (verbose) {
 			fprintf(stderr, "\x1B[33m%.*s\x1B[m\n", (int)(crlf - line), line);
 		}
-		if (client->need) {
+		if (client->need || intercept(line, crlf - line)) {
 			crlf[0] = '\0';
 			clientParse(client, line);
 		} else {
f='/src/commit/bin/title.c?id=cd25fb7a873005bda0579faeb3b2aea529679440&follow=1'>Add title -v flagJune McEnroe 2019-09-10Use curl error bufferJune McEnroe 2019-09-10Set Accept-Encoding in titleJune McEnroe 2019-09-08Set title User-AgentJune McEnroe 2019-09-07Add -x flag to titleJune McEnroe 2019-09-07Ignore SIGPIPE in relayJune McEnroe 2019-09-07Add A Memory Called EmpireJune McEnroe 2019-09-05Handle lack of Content-TypeJune McEnroe 2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe