diff options
-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); |