unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "J.P." <jp@neverwas.me>
To: 52010@debbugs.gnu.org
Cc: emacs-erc@gnu.org
Subject: bug#52010: 28.0.60; ERC now ignores dialed server names in autojoin
Date: Sun, 21 Nov 2021 03:31:03 -0800	[thread overview]
Message-ID: <87bl2d7nk8.fsf__16950.9700428293$1637494338$gmane$org@neverwas.me> (raw)
In-Reply-To: <87ilwmbbz7.fsf@neverwas.me> (J. P.'s message of "Sat, 20 Nov 2021 16:15:24 -0800")

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

v2: a small tweak to leave a tidier footprint for git-blame.


Also, some slight corrections on the timeline:


  Jan 20, 2003 - Register autojoin function with `erc-after-connect'
                 hook, which passes in `erc-announced-server-name' for
                 function's server param

  Jun 26, 2005 - Add dialed server as fallback when announced name
                 missing

  Sep 16, 2005 - Deprecate `erc-announced-server-name' in favor of
                 `erc-server-announced-name'

  Jan 05, 2017 - Switch from announced to dialed, ignoring server param
                 provided by `erc-after-connect' hook

  Sep 16, 2021 - Switch from dialed to announced, but consider networks

    This patch - Stay the course, but always fall back to dialed (not
                 just when unset)

    Bug #48598 - Prefer unique session identifiers based around and
                 compatible with networks, but fall back on announced,
                 then dialed (for compatibility)



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0000-v1-v2.diff --]
[-- Type: text/x-patch, Size: 2308 bytes --]

From e804e5c160b8ee1fa1ad2e1af7bcf3dd694cd14b Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
Date: Sat, 20 Nov 2021 23:53:49 -0800
Subject: NOT A PATCH

F. Jason Park (1):
  Fall back on dialed server names in erc-join

 lisp/erc/erc-join.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Interdiff:
diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 1a6bdedc98..887c40a00c 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -105,9 +105,9 @@ erc-autojoin-domain-only
 This is important for networks that redirect you to other
 servers, presumably in the same domain.
 
-This treatment will only be applied to so-called \"announced names\",
-like zirconium.libera.chat, but not to \"dialed\" hostnames, like
-my.proxy.localdomain or my.vps.example.com."
+This treatment will only be applied to so-called \"announced\" names,
+like zirconium.libera.chat, but not to \"dialed\" names, like
+209.51.188.117 or my.vps.example.net."
   :type 'boolean)
 
 (defvar-local erc--autojoin-timer nil)
@@ -131,7 +131,7 @@ erc-autojoin-server-match
 This should be a key from `erc-autojoin-channels-alist'."
   (or (eq candidate (erc-network))
       (and (stringp candidate)
-           (or (and erc-server-announced-name ; unnecessary after #48598
+           (or (and erc-server-announced-name
                     (string-match-p candidate erc-server-announced-name))
                (string-match-p candidate erc-session-server)))))
 
@@ -188,12 +188,12 @@ erc-autojoin-channels
 (defun erc-autojoin-current-server ()
   "Compute the current server for lookup in `erc-autojoin-channels-alist'.
 Respects `erc-autojoin-domain-only'."
-  (if (and erc-autojoin-domain-only
-           erc-server-announced-name
-           (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$"
-                         erc-server-announced-name))
-      (match-string 1 erc-server-announced-name)
-    erc-session-server))
+  (let ((server erc-server-announced-name))
+    (if (and erc-autojoin-domain-only
+             server
+	     (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
+	(match-string 1 server)
+      erc-session-server)))
 
 (defun erc-autojoin-add (proc parsed)
   "Add the channel being joined to `erc-autojoin-channels-alist'."
-- 
2.31.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-Fall-back-on-dialed-server-names-in-erc-join.patch --]
[-- Type: text/x-patch, Size: 2594 bytes --]

From e804e5c160b8ee1fa1ad2e1af7bcf3dd694cd14b Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
Date: Wed, 10 Nov 2021 23:42:42 -0800
Subject: [PATCH 1/1] Fall back on dialed server names in erc-join

* lisp/erc/erc-join.el (erc-autojoin-server-match,
erc-autojoin-current-server): as a fallback, always try the original
server argument passed to `erc-open' when matching against members of
`erc-autojoin-channels-alist'.  Similarly, when adding and removing
items, only apply the `erc-autojoin-domain-only' truncation treatment
to "announced" servers.
---
 lisp/erc/erc-join.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 2ed8622b85..887c40a00c 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -103,7 +103,11 @@ erc-autojoin-domain-only
 If non-nil, and a channel on the server a.b.c is joined, then
 only b.c is used as the server for `erc-autojoin-channels-alist'.
 This is important for networks that redirect you to other
-servers, presumably in the same domain."
+servers, presumably in the same domain.
+
+This treatment will only be applied to so-called \"announced\" names,
+like zirconium.libera.chat, but not to \"dialed\" names, like
+209.51.188.117 or my.vps.example.net."
   :type 'boolean)
 
 (defvar-local erc--autojoin-timer nil)
@@ -127,9 +131,9 @@ erc-autojoin-server-match
 This should be a key from `erc-autojoin-channels-alist'."
   (or (eq candidate (erc-network))
       (and (stringp candidate)
-	   (string-match-p candidate
-                           (or erc-server-announced-name
-			       erc-session-server)))))
+           (or (and erc-server-announced-name
+                    (string-match-p candidate erc-server-announced-name))
+               (string-match-p candidate erc-session-server)))))
 
 (defun erc-autojoin-after-ident (_network _nick)
   "Autojoin channels in `erc-autojoin-channels-alist'.
@@ -184,11 +188,12 @@ erc-autojoin-channels
 (defun erc-autojoin-current-server ()
   "Compute the current server for lookup in `erc-autojoin-channels-alist'.
 Respects `erc-autojoin-domain-only'."
-  (let ((server (or erc-server-announced-name erc-session-server)))
+  (let ((server erc-server-announced-name))
     (if (and erc-autojoin-domain-only
+             server
 	     (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
 	(match-string 1 server)
-      server)))
+      erc-session-server)))
 
 (defun erc-autojoin-add (proc parsed)
   "Add the channel being joined to `erc-autojoin-channels-alist'."
-- 
2.31.1


  reply	other threads:[~2021-11-21 11:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-21  0:15 28.0.50; ERC now ignores dialed server names in autojoin J.P.
2021-11-21 11:31 ` J.P. [this message]
2021-11-22  1:43 ` bug#52010: 28.0.60; " J.P.

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='87bl2d7nk8.fsf__16950.9700428293$1637494338$gmane$org@neverwas.me' \
    --to=jp@neverwas.me \
    --cc=52010@debbugs.gnu.org \
    --cc=emacs-erc@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).