Subject: bug#8385: 24.0.50; rcirc auto-authentication slightly broken

From: Tassilo Horn <[email-masked]>
Date: Thu, 31 Mar 2011 12:13:17 +0200

Deniz Dogan <[email-masked]> writes:

> Currently when the user connects to an IRC server, rcirc checks if
> `rcirc-auto-authenticate-flag' is non-nil and
> `rcirc-authenticate-before-join' is non-nil.  If they are, a hook is
> added to join the user's channels after successfully authenticating.
>
> However, this is done regardless of whether the user has set up any
> authinfo for the server being connected to, i.e., regardless of
> whether any of the entries in `rcirc-authinfo' matches the server
> address.
>
> `rcirc-handler-001' needs to be modified so that it first checks whether
> the server matches any `rcirc-authinfo' entry before it decides to wait
> with auto-joining channels until after authentication.

Could you please check if this patch does the trick?

=== modified file 'lisp/net/rcirc.el'
--- lisp/net/rcirc.el	2011-03-22 11:51:48 +0000
+++ lisp/net/rcirc.el	2011-03-31 07:40:16 +0000
@@ -2454,7 +2454,14 @@
     (setq rcirc-nick (car args))
     (rcirc-update-prompt)
     (if rcirc-auto-authenticate-flag
-        (if rcirc-authenticate-before-join
+        (if (and rcirc-authenticate-before-join
+		 ;; We have to ensure that there's an authentication
+		 ;; entry for that server.  Else,
+		 ;; rcirc-authenticated-hook won't be triggered, and
+		 ;; autojoin won't happen at all.
+		 (dolist (s rcirc-authinfo ret)
+		   (when (string-match (car s) rcirc-server-name)
+		     (setq ret t))))
             (progn
 	      (add-hook 'rcirc-authenticated-hook 'rcirc-join-channels-post-auth t t)
               (rcirc-authenticate))

Bye,
Tassilo