From: Tom Tromey <tom@tromey.com>
To: Tom Tromey <tom@tromey.com>
Cc: 25349@debbugs.gnu.org
Subject: bug#25349: 25.1.90; erc join -vs- passwords
Date: Wed, 04 Jan 2017 08:13:16 -0700 [thread overview]
Message-ID: <871swiuacz.fsf@tromey.com> (raw)
In-Reply-To: <87d1g3u63z.fsf@tromey.com> (Tom Tromey's message of "Tue, 03 Jan 2017 15:32:48 -0700")
>>>>> "Tom" == Tom Tromey <tom@tromey.com> 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)
next prev parent reply other threads:[~2017-01-04 15:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-03 22:32 bug#25349: 25.1.90; erc join -vs- passwords Tom Tromey
2017-01-04 3:47 ` Nikolay Kudryavtsev
2017-01-04 11:07 ` Tom Tromey
2017-01-04 15:15 ` Tom Tromey
2017-01-05 22:36 ` Tom Tromey
2017-01-06 15:14 ` Tom Tromey
2017-01-10 3:35 ` Tom Tromey
2017-02-01 3:01 ` Tom Tromey
2017-01-05 2:20 ` Nikolay Kudryavtsev
2017-01-05 4:43 ` Tom Tromey
2017-01-04 15:13 ` Tom Tromey [this message]
2017-05-06 3:47 ` bug#25349: fix checked in Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871swiuacz.fsf@tromey.com \
--to=tom@tromey.com \
--cc=25349@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).