mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Deprecate erc-server-alist and erc-server-select
* etc/ERC-NEWS: Announce deprecation of `erc-server-alist' and `erc-server-select'. * lisp/erc/erc-networks.el: Comment out call to `erc-get' at end of file. (erc-server-alist) Change shape to accommodate a fifth member: TLS ports. Add default TLS ports for Libera.Chat and OFTC. Deprecate option. (erc-ports-list): Overload for internal use to accept a number instead of a list, but don't advertise this fact. (erc-networks--server-select): Convert `erc-server-select' into a function that performs the same prompting but returns a full URL or a host name instead of calling `erc'. (erc-server-select): Move to erc.el. * lisp/erc/erc.el (erc--prompt-for-server-functions): New variable to allow callers of `erc-select-read-args' to affect how server-prompting is handled without adding additional params. (erc-select-read-args): Defer to `erc--prompt-for-server-function' when non-nil. (erc-server-select): New transplanted function, a deprecated, now TSL-aware version of the old quirky entry point from erc-networks.el. Reimplemented as a simple wrapper for `erc'. * test/lisp/erc/erc-networks-tests.el (erc-ports-list): New test. * test/lisp/erc/erc-tests.el (erc-server-select): New test. (Bug#64478)
This commit is contained in:
parent
b95bb644ec
commit
96785a8037
5 changed files with 128 additions and 36 deletions
|
|
@ -1703,6 +1703,41 @@
|
|||
(erc-server-connect-function
|
||||
erc-open-network-stream))))))))
|
||||
|
||||
(ert-deftest erc-server-select ()
|
||||
(let (calls env)
|
||||
(cl-letf (((symbol-function 'user-login-name)
|
||||
(lambda (&optional _) "tester"))
|
||||
((symbol-function 'erc-open)
|
||||
(lambda (&rest r)
|
||||
(push `((erc-join-buffer ,erc-join-buffer)
|
||||
(erc-server-connect-function
|
||||
,erc-server-connect-function))
|
||||
env)
|
||||
(push r calls))))
|
||||
|
||||
(ert-info ("Selects Libera.Chat Europe, automatic TSL")
|
||||
(ert-simulate-keys "Libera.Chat\rirc.eu.\t\r\r\r"
|
||||
(with-suppressed-warnings ((obsolete erc-server-select))
|
||||
(call-interactively #'erc-server-select)))
|
||||
(should (equal (pop calls)
|
||||
'("irc.eu.libera.chat" 6697 "tester" "unknown" t nil
|
||||
nil nil nil nil "user" nil)))
|
||||
(should (equal (pop env)
|
||||
'((erc-join-buffer window)
|
||||
(erc-server-connect-function erc-open-tls-stream)))))
|
||||
|
||||
(ert-info ("Selects entry that doesn't support TLS")
|
||||
(ert-simulate-keys "IRCnet\rirc.fr.\t\rdummy\r\r"
|
||||
(with-suppressed-warnings ((obsolete erc-server-select))
|
||||
(call-interactively #'erc-server-select)))
|
||||
(should (equal (pop calls)
|
||||
'("irc.fr.ircnet.net" 6667 "dummy" "unknown" t nil
|
||||
nil nil nil nil "user" nil)))
|
||||
(should (equal (pop env)
|
||||
'((erc-join-buffer window)
|
||||
(erc-server-connect-function
|
||||
erc-open-network-stream))))))))
|
||||
|
||||
(defun erc-tests--make-server-buf (name)
|
||||
(with-current-buffer (get-buffer-create name)
|
||||
(erc-mode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue