From 4f13e22adb20200bcc875b36ee4687dbc7dd2095 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Wed, 16 Nov 2022 21:51:48 -0800 Subject: [PATCH 0/5] *** NOT A PATCH *** *** BLURB HERE *** F. Jason Park (5): Add GS2 authorization to sasl-scram-rfc Don't set erc-networks--id until network is known Support local ERC modules in erc-mode buffers Call erc-login indirectly via new generic wrapper Add non-IRCv3 SASL module to ERC doc/misc/erc.texi | 148 +++++- etc/ERC-NEWS | 20 +- lisp/erc/erc-backend.el | 15 +- lisp/erc/erc-common.el | 56 ++- lisp/erc/erc-compat.el | 116 +++++ lisp/erc/erc-goodies.el | 1 + lisp/erc/erc-networks.el | 39 +- lisp/erc/erc-sasl.el | 433 ++++++++++++++++++ lisp/erc/erc.el | 86 ++-- lisp/net/sasl-scram-rfc.el | 21 +- test/lisp/erc/erc-sasl-tests.el | 319 +++++++++++++ test/lisp/erc/erc-scenarios-sasl.el | 208 +++++++++ test/lisp/erc/erc-tests.el | 58 +++ test/lisp/erc/resources/sasl/external.eld | 33 ++ test/lisp/erc/resources/sasl/plain-failed.eld | 16 + test/lisp/erc/resources/sasl/plain.eld | 39 ++ test/lisp/erc/resources/sasl/scram-sha-1.eld | 47 ++ .../lisp/erc/resources/sasl/scram-sha-256.eld | 47 ++ 18 files changed, 1616 insertions(+), 86 deletions(-) create mode 100644 lisp/erc/erc-sasl.el create mode 100644 test/lisp/erc/erc-sasl-tests.el create mode 100644 test/lisp/erc/erc-scenarios-sasl.el create mode 100644 test/lisp/erc/resources/sasl/external.eld create mode 100644 test/lisp/erc/resources/sasl/plain-failed.eld create mode 100644 test/lisp/erc/resources/sasl/plain.eld create mode 100644 test/lisp/erc/resources/sasl/scram-sha-1.eld create mode 100644 test/lisp/erc/resources/sasl/scram-sha-256.eld Range-diff: 1: d1a5b8071b = 1: 2bdd6d498e Add GS2 authorization to sasl-scram-rfc 2: 9b31e5d96e = 2: 7cc800af5c Don't set erc-networks--id until network is known 3: 268e7593ba ! 3: d9689f4919 Support local ERC modules in erc-mode buffers @@ Metadata ## Commit message ## Support local ERC modules in erc-mode buffers - * doc/misc/erc.texi: Mention local modules in Modules Chapter. + * doc/misc/erc.texi: Mention local modules in Modules chapter. * lisp/erc/erc-compat.el (erc-compat--local-module-modes): Add helper - for finding local modules active in an ERC buffer. + for finding local modules already active as minor modes in an ERC + buffer. * lisp/erc/erc.el (erc-migrate-modules): Add some missing mappings. - (erc-update-modules): Change return value from nil to a list of - minor-mode commands for local modules. Use `custom-variable-p' to - detect flavor. Currently, all modules are global and so are their - accompanying minor modes. + (erc-update-modules): Add optional param that changes return value + from nil to a list of minor-mode commands for local modules. Use + `custom-variable-p' to detect flavor. Currently, all modules are + global and so are their accompanying minor modes. (erc-open): Defer enabling of local modules via `erc-update-modules' until after buffer is initialized with other local vars. Also defer - major mode hooks so they can detect things like whether the buffer is + major-mode hooks so they can detect things like whether the buffer is a server or target buffer. Also ensure local module setup code can detect when `erc-open' was called with a non-nil `erc--server-reconnecting'. It's reset to nil by @@ Commit message * lisp/erc/erc-common.el (erc--module-name-migrations, erc--features-to-modules, erc--modules-to-features): Add alists of old-to-new module names to support module-name migrations. - (define-erc-modules): Don't enable local modules (minor modes) unless - `erc-mode' is the major mode. And don't disable them unless the minor - mode is actually active. Also, don't mutate `erc-modules' when + (define-erc-modules): Don't toggle local modules (minor modes) unless + `erc-mode' is the major mode. Also, don't mutate `erc-modules' when dealing with a local module. (erc--normalize-module-symbol): Add helper for `erc-migrate-modules'. * lisp/erc/erc-goodies.el: Require cl-lib. + * test/lisp/erc/erc-tests.el (erc-migrate-modules, - erc-update-modules): Add rudimentary unit tests. (Bug#57955.) + erc-update-modules): Add rudimentary unit tests asserting correct + module-name mappings. (Bug#57955.) ## doc/misc/erc.texi ## @@ doc/misc/erc.texi: Modules @@ lisp/erc/erc-common.el: define-erc-module ',(intern ## lisp/erc/erc-compat.el ## -@@ lisp/erc/erc-compat.el: erc-compat--with-memoization - `(cl--generic-with-memoization ,table ,@forms)) - (t `(progn ,@forms)))) +@@ lisp/erc/erc-compat.el: erc-compat--29-browse-url-irc + (cons '("\\`irc6?s?://" . erc-compat--29-browse-url-irc) + existing)))))) +(defun erc-compat--local-module-modes () + (delq nil @@ lisp/erc/erc.el: erc-open ## test/lisp/erc/erc-tests.el ## -@@ test/lisp/erc/erc-tests.el: erc-message - (kill-buffer "ExampleNet") +@@ test/lisp/erc/erc-tests.el: erc-handle-irc-url + (kill-buffer "baznet") (kill-buffer "#chan"))) +(ert-deftest erc-migrate-modules () 4: 7dc4b37ba5 ! 4: 230377b28e Call erc-login indirectly via new generic wrapper @@ Metadata ## Commit message ## Call erc-login indirectly via new generic wrapper - * lisp/erc/erc-backend (erc--register-connection): Add new generic - function that defers to `erc-login' by default. + * lisp/erc/erc-backend (erc--register-connection): Add new internal + generic function that defers to `erc-login' by default. (erc-process-sentinel, erc-server-connect): Call `erc--register-connection' instead of `erc-login'. @@ lisp/erc/erc-backend.el: erc-open-network-stream + "Perform opening IRC protocol exchange with server." + (erc-login)) + - (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. + (defvar erc--server-connect-dumb-ipv6-regexp + ;; Not for validation (gives false positives). + (rx bot "[" (group (+ (any xdigit digit ":.")) (? "%" (+ alnum))) "]" eot)) @@ lisp/erc/erc-backend.el: erc-server-connect ;; waiting for a non-blocking connect - keep the user informed (erc-display-message nil nil buffer "Opening connection..\n") 5: 675a593881 ! 5: 4f13e22adb Add non-IRCv3 SASL module to ERC @@ doc/misc/erc.texi: Top * Connecting:: Ways of connecting to an IRC server. +* SASL:: Authenticating via SASL. * Sample Configuration:: An example configuration file. + * Integrations:: Integrations available for ERC. * Options:: Options that are available for ERC. - @@ doc/misc/erc.texi: Modules @item ring Enable an input history @@ doc/misc/erc.texi: Advanced Usage * Connecting:: Ways of connecting to an IRC server. +* SASL:: Authenticating via SASL * Sample Configuration:: An example configuration file. + * Integrations:: Integrations available for ERC. * Options:: Options that are available for ERC. - @end menu @@ doc/misc/erc.texi: Connecting @noindent For details, @pxref{Top,,auth-source, auth, Emacs auth-source Library}. @@ etc/ERC-NEWS: hell. For some, auth-source may provide a workaround in the form Commands 'erc' and 'erc-tls' now accept a ':user' keyword argument, ## lisp/erc/erc-compat.el ## -@@ lisp/erc/erc-compat.el: erc-subseq - res)))))) +@@ lisp/erc/erc-compat.el: erc-compat--auth-source-backend-parser-functions + auth-source-backend-parser-functions)) +;;;; SASL -- 2.38.1