From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.bugs Subject: bug#25349: 25.1.90; erc join -vs- passwords Date: Wed, 04 Jan 2017 08:13:16 -0700 Message-ID: <871swiuacz.fsf@tromey.com> References: <87d1g3u63z.fsf@tromey.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1483542989 13376 195.159.176.226 (4 Jan 2017 15:16:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 4 Jan 2017 15:16:29 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.90 (gnu/linux) Cc: 25349@debbugs.gnu.org To: Tom Tromey Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 04 16:16:25 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOnIT-0001p6-3z for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 Jan 2017 16:16:13 +0100 Original-Received: from localhost ([::1]:39969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOnIX-0000c1-2s for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 Jan 2017 10:16:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOnIL-0000bp-RR for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 10:16:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOnII-0006Wq-Lm for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 10:16:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54112) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cOnII-0006Wm-Hn for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 10:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cOnII-0006t1-CQ for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 10:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tom Tromey Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Jan 2017 15:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25349 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148354290726386 (code B ref -1); Wed, 04 Jan 2017 15:16:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Jan 2017 15:15:07 +0000 Original-Received: from localhost ([127.0.0.1]:41275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOnHO-0006rV-HB for submit@debbugs.gnu.org; Wed, 04 Jan 2017 10:15:06 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:59553) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOnHM-0006qi-9O for submit@debbugs.gnu.org; Wed, 04 Jan 2017 10:15:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOnHF-00061r-Ns for submit@debbugs.gnu.org; Wed, 04 Jan 2017 10:14:58 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:55135) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cOnHF-00061e-Lf for submit@debbugs.gnu.org; Wed, 04 Jan 2017 10:14:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOnHE-0000UM-BZ for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 10:14:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOnHB-0005wh-6D for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 10:14:56 -0500 Original-Received: from gproxy10-pub.mail.unifiedlayer.com ([69.89.20.226]:43663) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1cOnHA-0005vV-Qq for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2017 10:14:53 -0500 Original-Received: (qmail 27169 invoked by uid 0); 4 Jan 2017 15:13:26 -0000 Original-Received: from unknown (HELO cmgw3) (10.0.90.84) by gproxy10.mail.unifiedlayer.com with SMTP; 4 Jan 2017 15:13:26 -0000 Original-Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id UFDJ1u00l2f2jeq01FDMSd; Wed, 04 Jan 2017 08:13:26 -0700 X-Authority-Analysis: v=2.1 cv=JpVi8qIC c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IgFoBzBjUZAA:10 a=zstS-IiYAAAA:8 a=du-0XSF7_GxAfZF4CNEA:9 a=4G6NA9xxw8l3yy4pmD5M:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From; bh=r73ilVUSvA8ZtNyjj38WryY1foTDKIf4huk7HF7lC2k=; b=oOVO3ZMXrw1P7vgIJU6+6RP7iE EgoxeGq8pqnpG7iIBkH/rowwWoGczKOHgZdIKhsjAw7QSdBYiKMPKIPeRC6FA5tE+Qyw5abNmGKrI /cKUJLfDNtKU8ps8QZpY2TWba; Original-Received: from 174-16-146-181.hlrn.qwest.net ([174.16.146.181]:46520 helo=pokyo) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1cOnFe-0008Ci-CG; Wed, 04 Jan 2017 08:13:18 -0700 X-Attribution: Tom In-Reply-To: <87d1g3u63z.fsf@tromey.com> (Tom Tromey's message of "Tue, 03 Jan 2017 15:32:48 -0700") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.146.181 X-Exim-ID: 1cOnFe-0008Ci-CG X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-146-181.hlrn.qwest.net (pokyo) [174.16.146.181]:46520 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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: 208.118.235.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:127737 Archived-At: >>>>> "Tom" == Tom Tromey writes: Tom> I'm using erc and joining a channel that has a channel password. Tom> I've tried to put the password in my ~/.authinfo. However, there Tom> are two erc bugs that prevent this from working. This patch seems to work for me. Tom diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el index 151ea15..9474b11 100644 --- a/lisp/erc/erc-join.el +++ b/lisp/erc/erc-join.el @@ -129,7 +129,7 @@ erc-autojoin-after-ident (setq erc--autojoin-timer (erc-cancel-timer erc--autojoin-timer))) (when (eq erc-autojoin-timing 'ident) - (let ((server (or erc-server-announced-name erc-session-server)) + (let ((server (or erc-session-server erc-server-announced-name)) (joined (mapcar (lambda (buf) (with-current-buffer buf (erc-default-target))) (erc-channel-list erc-server-process)))) @@ -166,27 +166,12 @@ erc-autojoin-channels ;; Return nil to avoid stomping on any other hook funcs. nil) -(defun erc-server-join-channel (server channel) - (let* ((secret (plist-get (nth 0 (auth-source-search - :max 1 - :host server - :port "irc" - :user channel)) - :secret)) - (password (if (functionp secret) - (funcall secret) - secret))) - (erc-server-send (concat "JOIN " channel - (if password - (concat " " password) - ""))))) - (defun erc-autojoin-add (proc parsed) "Add the channel being joined to `erc-autojoin-channels-alist'." (let* ((chnl (erc-response.contents parsed)) (nick (car (erc-parse-user (erc-response.sender parsed)))) (server (with-current-buffer (process-buffer proc) - (or erc-server-announced-name erc-session-server)))) + (or erc-session-server erc-server-announced-name)))) (when (erc-current-nick-p nick) (when (and erc-autojoin-domain-only (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server)) @@ -209,7 +194,7 @@ erc-autojoin-remove (let* ((chnl (car (erc-response.command-args parsed))) (nick (car (erc-parse-user (erc-response.sender parsed)))) (server (with-current-buffer (process-buffer proc) - (or erc-server-announced-name erc-session-server)))) + (or erc-session-server erc-server-announced-name)))) (when (erc-current-nick-p nick) (when (and erc-autojoin-domain-only (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server)) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 3dcb7ef..3cc9f52 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3022,6 +3022,23 @@ erc-cmd-HELP (defalias 'erc-cmd-H 'erc-cmd-HELP) (put 'erc-cmd-HELP 'process-not-needed t) +(defun erc-server-join-channel (server channel &optional secret) + (let* ((secret (or secret + (plist-get (nth 0 (auth-source-search + :max 1 + :host server + :port "irc" + :user channel)) + :secret))) + (password (if (functionp secret) + (funcall secret) + secret))) + (erc-log (format "cmd: JOIN: %s" channel)) + (erc-server-send (concat "JOIN " channel + (if password + (concat " " password) + ""))))) + (defun erc-cmd-JOIN (channel &optional key) "Join the channel given in CHANNEL, optionally with KEY. If CHANNEL is specified as \"-invite\", join the channel to which you @@ -3041,10 +3058,9 @@ erc-cmd-JOIN (if (erc-member-ignore-case chnl joined-channels) (switch-to-buffer (car (erc-member-ignore-case chnl joined-channels))) - (erc-log (format "cmd: JOIN: %s" chnl)) - (erc-server-send (if (and chnl key) - (format "JOIN %s %s" chnl key) - (format "JOIN %s" chnl))))))) + (let ((server (with-current-buffer (process-buffer erc-server-process) + (or erc-session-server erc-server-announced-name)))) + (erc-server-join-channel server chnl key)))))) t) (defalias 'erc-cmd-CHANNEL 'erc-cmd-JOIN)