From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Steve Scott Newsgroups: gmane.emacs.bugs Subject: bug#10162: [PATCH] 24.0.91; rcirc autojoin broken (freenode/oftc) when rcirc-authenticate-before-join is set Date: Sun, 02 Jun 2019 21:55:34 -0300 Message-ID: <875zpn5vy1.fsf@stevescott.ca> References: <87ipm2o2m7.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="50008"; mail-complaints-to="usenet@blaine.gmane.org" To: 10162@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 03 04:27:51 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hXchQ-000Cmi-E1 for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Jun 2019 04:27:49 +0200 Original-Received: from localhost ([127.0.0.1]:56542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXchO-0002NN-UU for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Jun 2019 22:27:46 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXcgk-0001vu-Jr for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2019 22:27:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hXcSA-0001V5-SN for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2019 22:12:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55959) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hXcSA-0001Ut-Ll for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2019 22:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hXcSA-0008MP-Fb for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2019 22:12:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87ipm2o2m7.fsf@gmail.com> Resent-From: Steve Scott Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Jun 2019 02:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10162 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.155952790432110 (code B ref -1); Mon, 03 Jun 2019 02:12:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Jun 2019 02:11:44 +0000 Original-Received: from localhost ([127.0.0.1]:41270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hXcRr-0008Lq-OV for submit@debbugs.gnu.org; Sun, 02 Jun 2019 22:11:44 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hXbmO-0007GW-C5 for submit@debbugs.gnu.org; Sun, 02 Jun 2019 21:28:53 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:43916) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hXbmH-00053h-P3 for submit@debbugs.gnu.org; Sun, 02 Jun 2019 21:28:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXbmG-0002l1-G1 for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2019 21:28:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hXbaO-0003X3-UL for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2019 21:16:33 -0400 Original-Received: from 23.ip-144-217-85.net ([144.217.85.23]:43208 helo=mailserv.stevescott.ca) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hXbaO-0003WX-Q1 for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2019 21:16:28 -0400 Original-Received: from localhost (mailserv.stevescott.ca [127.0.0.1]) by mailserv.stevescott.ca (Postfix) with ESMTP id 8EC253EA4B for ; Sun, 2 Jun 2019 21:55:36 -0300 (ADT) X-Virus-Scanned: Debian amavisd-new at mailserv.stevescott.ca Original-Received: from mailserv.stevescott.ca ([127.0.0.1]) by localhost (mailserv.stevescott.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hWidqxchhZ5s for ; Sun, 2 Jun 2019 21:55:35 -0300 (ADT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=stevescott.ca; s=dkim; t=1559523335; bh=rc1CliMEarIcXxN7dcRCLYocBJObRm8eIq4Z/8cJGV8=; h=From:To:Subject:Date:From; b=EuZKeEG3HNFsrJfY5gTUYeL2e/8C8MIan29LDnSEcxmT57kXZpIIALBHeq0vSVZbG oJKf/p0BjfG8gt2HtYqkNAj84ilRgsbvX+5Jf8FCDdKz9bJaVpFn8hk2OdiMTNQG5y lMAzzkNlveCc6/knos66O8RcIhvAH7jnZNO5kzxA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Sun, 02 Jun 2019 22:11:41 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:160039 Archived-At: Since the hostname returned by irc.freenode.net can be something other than irc.freenode.net, e.g. niven.freenode.net, the entries for rcirc-authinfo and rcirc-server-alist will not match. Hence checking rcirc-server-name (the hostname returned) instead of rcirc-server (the hostname connected to) will cause the auth-required condition to fail because of the mismatch. The hostname in rcirc-authinfo won't be found and the authentication hook will be skipped. The authenticate and join functions still get called in the ELSE in this case but there is no waiting for the authentication to be successful before joining the channels. Moreover, if rcirc-auto-authenticate-flag is set, there should indeed be a check for the corresponding rcirc-authinfo, regardless of whether the rcirc-authenticate-before-join must happen. Otherwise, there's no point in calling authenticate. My proposed patch enclosed. Thanks, Steve Scott diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 9c3828caf5..0f1904ea0e 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2545,16 +2545,15 @@ rcirc-handler-001 (setq rcirc-server-name sender) (setq rcirc-nick (car args)) (rcirc-update-prompt) - (if rcirc-auto-authenticate-flag - (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. - (let (auth-required) - (dolist (s rcirc-authinfo auth-required) - (when (string-match (car s) rcirc-server-name) - (setq auth-required t))))) + (if (and rcirc-auto-authenticate-flag + ;; We have to ensure that there's an authentication + ;; entry for that server. Otherwise, + ;; there's no point in calling authenticate. + (let (auth-required) + (dolist (s rcirc-authinfo auth-required) + (when (string-match (car s) rcirc-server) + (setq auth-required t))))) + (if rcirc-authenticate-before-join (progn (add-hook 'rcirc-authenticated-hook 'rcirc-join-channels-post-auth t t) (rcirc-authenticate))