Here ya go, thanks!
- Jim
master ef554176256a318ce0bc4d3d3790a66e8ddd1fc0
AuthorDate: Wed May 4 11:04:28 2016 -0400
CommitDate: Wed May 4 11:04:28 2016 -0400
Parent: 3d8b29b * lisp/vc/ediff-util.el: Use lexical-binding.
Merged: master
Containing: master
Follows: emacs-24.5-rc3-fixed (9210)
Use the domain name for auth-source-search
For the same reason we might use the domain name to query
erc-autojoin-channels-alist, we should use it for auth-source-search.
Otherwise, we'd need to include a line for every possible server to
1 file changed, 12 insertions(+), 9 deletions(-)
lisp/erc/erc-join.el | 21 ++++++++++++---------
modified lisp/erc/erc-join.el
@@ -166,10 +166,17 @@ This function is run from `erc-nickserv-identified-hook'."
;; Return nil to avoid stomping on any other hook funcs.
nil)
+(defun erc-server-name (server)
+ "Use the server's domain name if option set"
+ (if (and erc-autojoin-domain-only
+ (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
+ (match-string 1 server)
+ server))
+
(defun erc-server-join-channel (server channel)
(let* ((secret (plist-get (nth 0 (auth-source-search
:max 1
- :host server
+ :host (erc-server-name server)
:port "irc"
:user channel))
:secret))
@@ -186,11 +193,9 @@ This function is run from `erc-nickserv-identified-hook'."
(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))))
+ (erc-server-name
+ (or erc-server-announced-name erc-session-server)))))
(when (erc-current-nick-p nick)
- (when (and erc-autojoin-domain-only
- (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
- (setq server (match-string 1 server)))
(let ((elem (assoc server erc-autojoin-channels-alist)))
(if elem
(unless (member chnl (cdr elem))
@@ -209,11 +214,9 @@ This function is run from `erc-nickserv-identified-hook'."
(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))))
+ (erc-server-name
+ (or erc-server-announced-name erc-session-server)))))
(when (erc-current-nick-p nick)
- (when (and erc-autojoin-domain-only
- (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
- (setq server (match-string 1 server)))
(let ((elem (assoc server erc-autojoin-channels-alist)))
(when elem
(setcdr elem (delete chnl (cdr elem)))