Subject: bug#65882: 29.1; rcirc doesn't rejoin channels automatically on reconnecting

From: Manphiz <[email-masked]>
Date: Thu, 14 Sep 2023 15:57:02 -0700

Manphiz <[email-masked]> writes:

> I have a setting of rcirc that automatically authenticates to NickServ
> and automatically join a list of channels[1].  This works when
> connecting to the servers for the first time.  However, when it gets
> disconnected from the servers (e.g. due to network issues) and
> reconnecting, it can still auto-authenticate, but won't rejoin the
> channels automatically again.
>
> After some debugging, it turns out that the first time it authenticates
> successfully, it will set rcirc-user-authenticated to `t'[2].  When
> reconnecting, it will check whether the user is authenticated and only
> run the rcirc-authenticated-hook if not[3].  As
> rcirc-user-authenticateed will be `t' after the first time, the hook
> won't be processed again and hence preventing from rejoining the
> channels.
>
> I have tested a patch that resets rcirc-user-authenticated to `nil' that
> fixes this issue (tested on 28.2 and 29.1), which is attached inline below.
>
> [1] https://gitlab.com/xiyueden/emacs.d/-/blob/master/init.el?ref_type=heads#L224-272
> [2] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/net/rcirc.el#n3343
> [3] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/net/rcirc.el#n3320
>
>
> diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
> index 1ddffe8dec9..b293a4a442f 100644
> --- a/lisp/net/rcirc.el
> +++ b/lisp/net/rcirc.el
> @@ -859,6 +859,7 @@ If QUIET is non-nil, no not emit a message."
>        (if (rcirc--connection-open-p process)
>            (throw 'exit (or quiet (message "Server process is alive")))
>          (delete-process process))
> +      (setq rcirc-user-authenticated nil)
>        (let ((conn-info rcirc-connection-info))
>          (setf (nth 5 conn-info)
>                (cl-remove-if-not #'rcirc-channel-p
>

Hi Stefan,

I noticed that you lowered the severity of this bug from "normal" to
"wishlist".  AIUI rcirc provides a way to automatically join channels
upon connecting to a server and currently this is not working as
intended, so IMHO it should be considered a bug instead of a feature
request (a wishlist).  (If you are using severity as a means to manage
bug triage priority I'm OK with that.)

Personally, as the patch is sufficiently trivial, I would hope it won't
take too much work for a review.  But I would understand if dealing with
rcirc-user-authenticated is more involved than it looks like and should
be handled with care.

Thanks!
--
Manphiz