Tobias Girstmair [Fri, 17 May 2024 14:55:37 +0000 (16:55 +0200)]
initiate PING if socket idles for too long
note that we only start tracking the monotonic timestamp of last
incoming socket activity in irc_poll(). because of that, we must
initialize recv_ts or we risk never sending the first PING when the
server doesn't send anything after the 001 numeric (e.g. znc with no
joined channels).
there isn't really a reason to configure ping interval/pong timeout, so
we just pick some values.
Tobias Girstmair [Fri, 17 May 2024 12:10:06 +0000 (14:10 +0200)]
simplify sasl handling
note that we still don't support multiple SASL chunks; the error
handling was just removed from irc_base64() (OR_DIE is incompatible with
assignment). we should probably verify this constraint in main().
Tobias Girstmair [Sun, 12 May 2024 18:29:46 +0000 (20:29 +0200)]
NULL-terminate read() calls
we reuse the samme buffer for all network and local read(2)s. irc_answer
(or more specifically, strtok(3)) expects NULL-terminated strings. this
caused us to re-parse older strings when the buffer shrank between two
consecutive read(2) calls.
we always listen for POLLIN events, so we don't need to explicitly check
for it. not sure if this implementation is correct. modeled after
https://github.com/openbsd/src/blob/master/usr.bin/nc/netcat.c