From 46c435a6711ad9825520d9e5df29b12872afaefb Mon Sep 17 00:00:00 2001 From: Tobias Girstmair Date: Sun, 26 May 2024 13:54:01 +0200 Subject: [PATCH] Revert "send all initialization commands at once" nope, causes hangs. This reverts commit c92baa7c54cfc57df2bbd9ca2df9e79bddb9cc3a. --- ircpipe.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ircpipe.c b/ircpipe.c index 09c1036..034c2fb 100644 --- a/ircpipe.c +++ b/ircpipe.c @@ -237,17 +237,20 @@ int irc_setup(const sock_t sock, const int outfd, const char *nick, const char * WRITE(sock, "CAP END\r\n", 9); } + /* block until we get a RPL_WELCOME or an error: */ + n = irc_wait(sock, outfd, NICK, buf); + if (n < 0) return n; + if (chan) { n = snprintf(buf, BUFSIZ, "JOIN %s\r\n", chan); WRITE(sock, buf, n); + /* block until we get a JOIN response or an error: */ n = irc_wait(sock, outfd, JOIN, buf); - } else { - /* block until we get a RPL_WELCOME or an error: */ - n = irc_wait(sock, outfd, NICK, buf); + if (n < 0) return n; } - return n; + return 0; } long irc_time() { -- 2.39.3