diff options
author | June McEnroe <june@causal.agency> | 2020-02-25 19:07:44 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-02-25 19:07:44 -0500 |
commit | e05150a6fb93de818074a3328bf617291910d606 (patch) | |
tree | fa526bad38a56e6aba72ad4d55dfd410f0ab6fd1 | |
parent | Request server-time from the server and filter tags for clients (diff) | |
download | pounce-e05150a6fb93de818074a3328bf617291910d606.tar.gz pounce-e05150a6fb93de818074a3328bf617291910d606.zip |
Respond to tagged PINGs correctly
Yikes.
-rw-r--r-- | server.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/server.c b/server.c index 1741f14..e8c8880 100644 --- a/server.c +++ b/server.c @@ -165,8 +165,13 @@ void serverRecv(void) { if (!crlf) break; crlf[0] = '\0'; if (verbose) fprintf(stderr, "\x1B[32m%s\x1B[m\n", line); - if (!strncmp(line, "PING ", 5)) { - serverFormat("PONG %s\r\n", &line[5]); + const char *ping = line; + if (ping[0] == '@') { + ping += strcspn(ping, " "); + if (*ping) ping++; + } + if (!strncmp(ping, "PING ", 5)) { + serverFormat("PONG %s\r\n", &ping[5]); } else { if (stateReady()) ringProduce(line); stateParse(line); |