diff options
author | F. Jason Park <jp@neverwas.me> | 2022-07-11 05:14:57 -0700 |
---|---|---|
committer | F. Jason Park <jp@neverwas.me> | 2022-11-16 21:34:36 -0800 |
commit | 46c765ed09422767306bd7acfc8422d5ad4cea4a (patch) | |
tree | 9f24e1baa24092c576573aa355f96899a9199fb5 /lisp/erc/erc-backend.el | |
parent | 5699e43f27ef5ca760a38572928be8a53819a430 (diff) | |
download | emacs-46c765ed09422767306bd7acfc8422d5ad4cea4a.tar.gz |
Refactor erc-select-read-args
* lisp/erc/erc-backend.el (erc--server-connect-dumb-ipv6-regexp): Add
liberal pattern for matching bracketed IPv6 addresses.
(erc-server-connect): Remove brackets from IPv6 hosts before
connecting.
* lisp/erc/erc.el (erc--ensure-url): Add compat adapter to massage
partial URLs given as input that may be missing the scheme:// portion.
(erc-select-read-args): Keep bracketed IPv6 hosts
intact. Make this function fully URL-aware (was only partially so).
Accept optional `input' argument.
* lisp/erc/erc-tests.el (erc-tests--ipv6-examples,
erc--server-connect-dumb-ipv6-regexp, erc-select-read-args): Add test
reading user input during interactive invocations of entry points.
(Bug#56514.)
Diffstat (limited to 'lisp/erc/erc-backend.el')
-rw-r--r-- | lisp/erc/erc-backend.el | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index d49e6a5f1a8..15fd6ac50f5 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -638,12 +638,18 @@ The current buffer is given by BUFFER." (let ((p (plist-put parameters :nowait t))) (apply #'open-network-stream name buffer host service p))) +(defvar erc--server-connect-dumb-ipv6-regexp + ;; Not for validation (gives false positives). + (rx bot "[" (group (+ (any xdigit digit ":.")) (? "%" (+ alnum))) "]" eot)) + (defun erc-server-connect (server port buffer &optional client-certificate) "Perform the connection and login using the specified SERVER and PORT. We will store server variables in the buffer given by BUFFER. CLIENT-CERTIFICATE may optionally be used to specify a TLS client certificate to use for authentication when connecting over TLS (see `erc-session-client-certificate' for more details)." + (when (string-match erc--server-connect-dumb-ipv6-regexp server) + (setq server (match-string 1 server))) (let ((msg (erc-format-message 'connect ?S server ?p port)) process (args `(,(format "erc-%s-%s" server port) nil ,server ,port))) (when client-certificate |