diff options
| author | F. Jason Park | 2023-04-06 18:41:06 -0700 |
|---|---|---|
| committer | F. Jason Park | 2023-04-08 14:23:50 -0700 |
| commit | 8c0c98268440b27a77faf30738dfd72c909bb33f (patch) | |
| tree | 3ffaf0c484c1f0526b26638e8a03289338c0321b /test | |
| parent | 03eddc99242bb430a82f468251ed76602d457702 (diff) | |
| download | emacs-8c0c98268440b27a77faf30738dfd72c909bb33f.tar.gz emacs-8c0c98268440b27a77faf30738dfd72c909bb33f.zip | |
Add hook to regain nickname in ERC
* lisp/erc/erc-backend.el (erc-server-reconnect-timeout): Mention
`erc-nickname-in-use-functions' in doc string.
* lisp/erc/erc.el (erc-nickname-in-use-functions,
erc-regain-nick-on-connect): Add abnormal hook and possible value to
handle stale connections preventing a desired nick from being reissued
by the server. Follows directly from bug#62044.
(erc-nickname-in-use): Call `erc-nickname-in-use-functions'.
* test/lisp/erc/erc-scenarios-base-renick.el
(erc-scenarios-base-renick-auto-regain): New test.
* test/lisp/erc/resources/base/renick/regain/normal-again.eld: New file.
* test/lisp/erc/resources/base/renick/regain/normal.eld: New file.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/erc/erc-scenarios-base-renick.el | 43 | ||||
| -rw-r--r-- | test/lisp/erc/resources/base/renick/regain/normal-again.eld | 56 | ||||
| -rw-r--r-- | test/lisp/erc/resources/base/renick/regain/normal.eld | 53 |
3 files changed, 152 insertions, 0 deletions
diff --git a/test/lisp/erc/erc-scenarios-base-renick.el b/test/lisp/erc/erc-scenarios-base-renick.el index f1723200533..f8350676fb7 100644 --- a/test/lisp/erc/erc-scenarios-base-renick.el +++ b/test/lisp/erc/erc-scenarios-base-renick.el | |||
| @@ -303,4 +303,47 @@ | |||
| 303 | (should-not (search-forward "now known as frenemy" nil t)) | 303 | (should-not (search-forward "now known as frenemy" nil t)) |
| 304 | (erc-d-t-search-for 25 "I have lost")))) | 304 | (erc-d-t-search-for 25 "I have lost")))) |
| 305 | 305 | ||
| 306 | ;; The server rejects your nick during registration, so ERC acquires a | ||
| 307 | ;; placeholder and successfully renicks once the connection is up. | ||
| 308 | ;; See also `erc-scenarios-base-renick-self-auto'. | ||
| 309 | |||
| 310 | (ert-deftest erc-scenarios-base-renick-auto-regain () | ||
| 311 | :tags '(:expensive-test) | ||
| 312 | (erc-scenarios-common-with-cleanup | ||
| 313 | ((erc-server-flood-penalty 0.1) | ||
| 314 | (erc-scenarios-common-dialog "base/renick/regain") | ||
| 315 | (dumb-server (erc-d-run "localhost" t 'normal 'normal-again)) | ||
| 316 | (port (process-contact dumb-server :service)) | ||
| 317 | (erc-server-auto-reconnect t) | ||
| 318 | (erc-modules (cons 'sasl erc-modules)) | ||
| 319 | (erc-nickname-in-use-functions '(erc-regain-nick-on-connect)) | ||
| 320 | (expect (erc-d-t-make-expecter))) | ||
| 321 | |||
| 322 | (ert-info ("Session succeeds but cut short") | ||
| 323 | (with-current-buffer (erc :server "127.0.0.1" | ||
| 324 | :port port | ||
| 325 | :nick "tester" | ||
| 326 | :user "tester" | ||
| 327 | :password "changeme" | ||
| 328 | :full-name "tester") | ||
| 329 | (funcall expect 10 "Last login from") | ||
| 330 | (erc-cmd-JOIN "#test"))) | ||
| 331 | |||
| 332 | (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#test")) | ||
| 333 | (funcall expect 10 "was created on")) | ||
| 334 | |||
| 335 | (ert-info ("Service restored") | ||
| 336 | (with-current-buffer "Libera.Chat" | ||
| 337 | (erc-d-t-wait-for 10 erc--server-reconnect-timer) | ||
| 338 | (funcall expect 10 "Connection failed!") | ||
| 339 | (funcall expect 10 "already in use") | ||
| 340 | (funcall expect 10 "changed mode for tester`") | ||
| 341 | (funcall expect 10 "Last login from") | ||
| 342 | (funcall expect 10 "Your new nickname is tester"))) | ||
| 343 | |||
| 344 | (with-current-buffer (get-buffer "#test") | ||
| 345 | (funcall expect 10 "tester ") | ||
| 346 | (funcall expect 10 "was created on")))) | ||
| 347 | |||
| 348 | |||
| 306 | ;;; erc-scenarios-base-renick.el ends here | 349 | ;;; erc-scenarios-base-renick.el ends here |
diff --git a/test/lisp/erc/resources/base/renick/regain/normal-again.eld b/test/lisp/erc/resources/base/renick/regain/normal-again.eld new file mode 100644 index 00000000000..c0529052c70 --- /dev/null +++ b/test/lisp/erc/resources/base/renick/regain/normal-again.eld | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | ;; -*- mode: lisp-data; -*- | ||
| 2 | ((cap 10 "CAP REQ :sasl")) | ||
| 3 | ((nick 10 "NICK tester")) | ||
| 4 | ((user 10 "USER tester 0 * :tester")) | ||
| 5 | |||
| 6 | ((authenticate 10 "AUTHENTICATE PLAIN") | ||
| 7 | (0.04 ":tantalum.libera.chat NOTICE * :*** Checking Ident") | ||
| 8 | (0.01 ":tantalum.libera.chat NOTICE * :*** Looking up your hostname...") | ||
| 9 | (0.01 ":tantalum.libera.chat NOTICE * :*** Couldn't look up your hostname") | ||
| 10 | (0.06 ":tantalum.libera.chat NOTICE * :*** No Ident response") | ||
| 11 | (0.02 ":tantalum.libera.chat CAP * ACK :sasl") | ||
| 12 | (0.03 ":tantalum.libera.chat 433 * tester :Nickname is already in use.")) | ||
| 13 | |||
| 14 | ((nick 10 "NICK tester`") | ||
| 15 | (0.03 "AUTHENTICATE +")) | ||
| 16 | |||
| 17 | ((authenticate 10 "AUTHENTICATE AHRlc3RlcgBjaGFuZ2VtZQ==") | ||
| 18 | (0.06 ":tantalum.libera.chat 900 tester` tester`!tester@127.0.0.1 tester :You are now logged in as tester") | ||
| 19 | (0.02 ":tantalum.libera.chat 903 tester` :SASL authentication successful")) | ||
| 20 | |||
| 21 | ((cap 10 "CAP END") | ||
| 22 | (0.02 ":tantalum.libera.chat 001 tester` :Welcome to the Libera.Chat Internet Relay Chat Network tester`") | ||
| 23 | (0.02 ":tantalum.libera.chat 002 tester` :Your host is tantalum.libera.chat[93.158.237.2/6697], running version solanum-1.0-dev") | ||
| 24 | (0.02 ":tantalum.libera.chat 003 tester` :This server was created Mon Feb 13 2023 at 12:05:04 UTC") | ||
| 25 | (0.01 ":tantalum.libera.chat 004 tester` tantalum.libera.chat solanum-1.0-dev DGMQRSZaghilopsuwz CFILMPQRSTbcefgijklmnopqrstuvz bkloveqjfI") | ||
| 26 | (0.01 ":tantalum.libera.chat 005 tester` WHOX MONITOR=100 SAFELIST ELIST=CMNTU ETRACE FNC CALLERID=g KNOCK CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQRSTcgimnprstuz :are supported by this server") | ||
| 27 | (0.01 ":tantalum.libera.chat 005 tester` CHANLIMIT=#:250 PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=Libera.Chat STATUSMSG=@+ CASEMAPPING=rfc1459 NICKLEN=16 MAXNICKLEN=16 CHANNELLEN=50 TOPICLEN=390 DEAF=D :are supported by this server") | ||
| 28 | (0.03 ":tantalum.libera.chat 005 tester` TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: EXTBAN=$,ajrxz :are supported by this server") | ||
| 29 | (0.01 ":tantalum.libera.chat 251 tester` :There are 70 users and 42977 invisible on 28 servers") | ||
| 30 | (0.00 ":tantalum.libera.chat 252 tester` 38 :IRC Operators online") | ||
| 31 | (0.00 ":tantalum.libera.chat 253 tester` 87 :unknown connection(s)") | ||
| 32 | (0.00 ":tantalum.libera.chat 254 tester` 22908 :channels formed") | ||
| 33 | (0.00 ":tantalum.libera.chat 255 tester` :I have 2507 clients and 1 servers") | ||
| 34 | (0.00 ":tantalum.libera.chat 265 tester` 2507 3232 :Current local users 2507, max 3232") | ||
| 35 | (0.00 ":tantalum.libera.chat 266 tester` 43047 51777 :Current global users 43047, max 51777") | ||
| 36 | (0.00 ":tantalum.libera.chat 250 tester` :Highest connection count: 3233 (3232 clients) (284887 connections received)") | ||
| 37 | (0.03 ":tantalum.libera.chat 375 tester` :- tantalum.libera.chat Message of the Day - ") | ||
| 38 | (0.00 ":tantalum.libera.chat 372 tester` :- This server provided by Hyperfilter (https://hyperfilter.com)") | ||
| 39 | (0.00 ":tantalum.libera.chat 372 tester` :- Email: support@libera.chat") | ||
| 40 | (0.02 ":tantalum.libera.chat 376 tester` :End of /MOTD command.")) | ||
| 41 | |||
| 42 | ((mode 10 "MODE tester` +i") | ||
| 43 | (0.01 ":tester` MODE tester` :+Ziw") | ||
| 44 | (0.02 ":SaslServ!SaslServ@services.libera.chat NOTICE tester` :Last login from: \2~tester@127.0.0.1\2 on Apr 07 01:36:25 2023 +0000.")) | ||
| 45 | |||
| 46 | ((nick 10 "NICK tester") | ||
| 47 | (0.02 ":tester`!~tester@127.0.0.1 NICK :tester")) | ||
| 48 | |||
| 49 | ((join 10 "JOIN #test") | ||
| 50 | (0.02 ":tester!~tester@127.0.0.1 JOIN #test") | ||
| 51 | (0.02 ":tantalum.libera.chat 353 tester = #test :tester zbyqbepbqre7 pusevgfpu Thrfg2187 zngbeb qnexNssvavgl wrebzr- rqpentt Ilehf grfg2 AvtugZbaxrl pevfgvvbna xrivap_ fnvybePng shohxv gxan arrqyr avpx16 NeanhqW_kzcc jvyyr wrnaogeq Wnarg cnefavc0 Xbentt RcvpArb flfqrs wfgbxre hafcrag__ Lbevpx_") | ||
| 52 | (0.02 ":tantalum.libera.chat 366 tester #test :End of /NAMES list.")) | ||
| 53 | |||
| 54 | ((mode 10 "MODE #test") | ||
| 55 | (0.02 ":tantalum.libera.chat 324 tester #test +nt") | ||
| 56 | (0.02 ":tantalum.libera.chat 329 tester #test 1621432263")) | ||
diff --git a/test/lisp/erc/resources/base/renick/regain/normal.eld b/test/lisp/erc/resources/base/renick/regain/normal.eld new file mode 100644 index 00000000000..9f4df70e580 --- /dev/null +++ b/test/lisp/erc/resources/base/renick/regain/normal.eld | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | ;; -*- mode: lisp-data; -*- | ||
| 2 | ((cap 10 "CAP REQ :sasl")) | ||
| 3 | ((nick 10 "NICK tester")) | ||
| 4 | ((user 10 "USER tester 0 * :tester")) | ||
| 5 | |||
| 6 | ((authenticate 10 "AUTHENTICATE PLAIN") | ||
| 7 | (0.02 ":cadmium.libera.chat NOTICE * :*** Checking Ident") | ||
| 8 | (0.01 ":cadmium.libera.chat NOTICE * :*** Looking up your hostname...") | ||
| 9 | (0.01 ":cadmium.libera.chat NOTICE * :*** Couldn't look up your hostname") | ||
| 10 | (0.06 ":cadmium.libera.chat NOTICE * :*** No Ident response") | ||
| 11 | (0.09 ":cadmium.libera.chat CAP * ACK :sasl") | ||
| 12 | (0.01 "AUTHENTICATE +")) | ||
| 13 | |||
| 14 | ((authenticate 10 "AUTHENTICATE AHRlc3RlcgBjaGFuZ2VtZQ==") | ||
| 15 | (0.03 ":cadmium.libera.chat 900 tester tester!tester@127.0.0.1 tester :You are now logged in as tester") | ||
| 16 | (0.01 ":cadmium.libera.chat 903 tester :SASL authentication successful")) | ||
| 17 | |||
| 18 | ((cap 10 "CAP END") | ||
| 19 | (0.03 ":cadmium.libera.chat 001 tester :Welcome to the Libera.Chat Internet Relay Chat Network tester") | ||
| 20 | (0.02 ":cadmium.libera.chat 002 tester :Your host is cadmium.libera.chat[103.196.37.95/6697], running version solanum-1.0-dev") | ||
| 21 | (0.01 ":cadmium.libera.chat 003 tester :This server was created Wed Jan 25 2023 at 10:22:45 UTC") | ||
| 22 | (0.01 ":cadmium.libera.chat 004 tester cadmium.libera.chat solanum-1.0-dev DGMQRSZaghilopsuwz CFILMPQRSTbcefgijklmnopqrstuvz bkloveqjfI") | ||
| 23 | (0.00 ":cadmium.libera.chat 005 tester CALLERID=g WHOX ETRACE FNC SAFELIST ELIST=CMNTU KNOCK MONITOR=100 CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQRSTcgimnprstuz :are supported by this server") | ||
| 24 | (0.01 ":cadmium.libera.chat 005 tester CHANLIMIT=#:250 PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=Libera.Chat STATUSMSG=@+ CASEMAPPING=rfc1459 NICKLEN=16 MAXNICKLEN=16 CHANNELLEN=50 TOPICLEN=390 DEAF=D :are supported by this server") | ||
| 25 | (0.01 ":cadmium.libera.chat 005 tester TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: EXTBAN=$,ajrxz :are supported by this server") | ||
| 26 | (0.01 ":cadmium.libera.chat 251 tester :There are 70 users and 42996 invisible on 28 servers") | ||
| 27 | (0.02 ":cadmium.libera.chat 252 tester 38 :IRC Operators online") | ||
| 28 | (0.01 ":cadmium.libera.chat 253 tester 57 :unknown connection(s)") | ||
| 29 | (0.01 ":cadmium.libera.chat 254 tester 22912 :channels formed") | ||
| 30 | (0.01 ":cadmium.libera.chat 255 tester :I have 2499 clients and 1 servers") | ||
| 31 | (0.01 ":cadmium.libera.chat 265 tester 2499 4187 :Current local users 2499, max 4187") | ||
| 32 | (0.01 ":cadmium.libera.chat 266 tester 43066 51827 :Current global users 43066, max 51827") | ||
| 33 | (0.01 ":cadmium.libera.chat 250 tester :Highest connection count: 4188 (4187 clients) (319420 connections received)") | ||
| 34 | (0.01 ":cadmium.libera.chat 375 tester :- cadmium.libera.chat Message of the Day - ") | ||
| 35 | (0.01 ":cadmium.libera.chat 372 tester :- This server kindly provided by Mach Dilemma (www.m-d.net)") | ||
| 36 | (0.01 ":cadmium.libera.chat 372 tester :- Welcome to Libera Chat, the IRC network for") | ||
| 37 | (0.00 ":cadmium.libera.chat 372 tester :- Email: support@libera.chat") | ||
| 38 | (0.00 ":cadmium.libera.chat 376 tester :End of /MOTD command.") | ||
| 39 | (0.00 ":tester MODE tester :+Ziw") | ||
| 40 | (0.02 ":SaslServ!SaslServ@services.libera.chat NOTICE tester :Last login from: \2~tester@127.0.0.1\2 on Apr 07 01:02:11 2023 +0000.")) | ||
| 41 | |||
| 42 | ((mode 10 "MODE tester +i")) | ||
| 43 | |||
| 44 | ((join 10 "JOIN #test") | ||
| 45 | (0.09 ":tester!~tester@127.0.0.1 JOIN #test")) | ||
| 46 | |||
| 47 | ((mode 10 "MODE #test") | ||
| 48 | (0.03 ":cadmium.libera.chat 353 tester = #test :tester zbyqbepbqre7 pusevgfpu Thrfg2187 zngbeb qnexNssvavgl wrebzr- rqpentt Ilehf grfg2 AvtugZbaxrl pevfgvvbna xrivap_ fnvybePng shohxv gxan arrqyr avpx16 NeanhqW_kzcc Lbevpx_ hafcrag__ wfgbxre flfqrs RcvpArb Xbentt jvyyr cnefavc0 Wnarg wrnaogeq") | ||
| 49 | (0.02 ":cadmium.libera.chat 366 tester #test :End of /NAMES list.") | ||
| 50 | (0.00 ":cadmium.libera.chat 324 tester #test +nt") | ||
| 51 | (0.01 ":cadmium.libera.chat 329 tester #test 1621432263")) | ||
| 52 | |||
| 53 | ((drop 0 DROP)) | ||