all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Crossley <jim@crossleys.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 23438@debbugs.gnu.org
Subject: bug#23438: 24.5; ERC autojoin should use erc-autojoin-domain-only searching channel keys
Date: Wed, 4 May 2016 11:10:38 -0400	[thread overview]
Message-ID: <CACMdBJBkXCk1EWgbEeGK_oeC6VvfrSP6RU7OW0fDzF1BxJZSOw@mail.gmail.com> (raw)
In-Reply-To: <8737py22er.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 3539 bytes --]

Here ya go, thanks!

- Jim

master ef554176256a318ce0bc4d3d3790a66e8ddd1fc0
Author:     Jim Crossley <jim@crossleys.org>
AuthorDate: Wed May 4 11:04:28 2016 -0400
Commit:     Jim Crossley <jim@crossleys.org>
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
which chat.freenode.net might redirect us in ~/.authinfo.gpg

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)))


On Tue, May 3, 2016 at 6:38 PM, Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Jim Crossley <jim@crossleys.org> writes:
>
> > It's impossible to know what round-robin server you'll actually connect
> > to when connecting to chat.freenode.net, for example. Therefore, it's
> > impossible to include the correct host lines for channel keys in the
> > auth-source files. It would be far better to search for the channel keys
> > using the same name used to query erc-autojoin-channels-alist when
> > erc-autojoin-domain-only is non-nil. I have a patch that works, but I'm
> > not sure where to submit it.
>
> Submit it here, please.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>

[-- Attachment #2: Type: text/html, Size: 6432 bytes --]

  reply	other threads:[~2016-05-04 15:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03 21:59 bug#23438: 24.5; ERC autojoin should use erc-autojoin-domain-only searching channel keys Jim Crossley
2016-05-03 22:38 ` Lars Ingebrigtsen
2016-05-04 15:10   ` Jim Crossley [this message]
2017-01-11  5:52 ` bug#23438: see also bug#25349 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACMdBJBkXCk1EWgbEeGK_oeC6VvfrSP6RU7OW0fDzF1BxJZSOw@mail.gmail.com \
    --to=jim@crossleys.org \
    --cc=23438@debbugs.gnu.org \
    --cc=larsi@gnus.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.