summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-23 16:52:44 -0400
committerJune McEnroe <june@causal.agency>2019-10-23 16:52:44 -0400
commit94ab6f9585df00595bd46c8affb7fb5d202f0ea8 (patch)
tree9a15b8a11c82362517d16b4188465f0e435c2efd
parentAdd verbose flag (diff)
downloadpounce-94ab6f9585df00595bd46c8affb7fb5d202f0ea8.tar.gz
pounce-94ab6f9585df00595bd46c8affb7fb5d202f0ea8.zip
Respond to pings
-rw-r--r--server.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/server.c b/server.c
index 5cb7776..1583d1c 100644
--- a/server.c
+++ b/server.c
@@ -155,7 +155,10 @@ void serverLogin(
 }
 
 void serverAuth(void) {
+	assert(authBase64);
 	format("AUTHENTICATE PLAIN\r\nAUTHENTICATE %s\r\nCAP END\r\n", authBase64);
+	free(authBase64);
+	authBase64 = NULL;
 }
 
 void serverJoin(const char *join) {
@@ -180,8 +183,13 @@ void serverRecv(void) {
 		crlf[0] = '\0';
 
 		if (verbose) fprintf(stderr, "\x1B[32m%s\x1B[m\n", line);
-		// TODO: Add line to ring if stateReady().
-		stateParse(line);
+		if (!strncmp(line, "PING ", 5)) {
+			line[1] = 'O';
+			format("%s\r\n", line);
+		} else {
+			// TODO: Add line to ring if stateReady().
+			stateParse(line);
+		}
 
 		line = crlf + 2;
 	}