diff options
| author | F. Jason Park | 2021-05-07 01:52:41 -0700 |
|---|---|---|
| committer | F. Jason Park | 2022-06-30 15:16:46 -0700 |
| commit | 1767b0bd7e2883c9467ebf0e0aedee1fd90bcf92 (patch) | |
| tree | 3fd6f705293e8b1d5113348131cbd4d1a66a75f2 /test | |
| parent | 7c47d6c52d70225334444947824b40ad9f593c31 (diff) | |
| download | emacs-1767b0bd7e2883c9467ebf0e0aedee1fd90bcf92.tar.gz emacs-1767b0bd7e2883c9467ebf0e0aedee1fd90bcf92.zip | |
Don't call erc-auto-query twice on PRIVMSG
* lisp/erc/erc-backend.el (erc-server-JOIN): Use `erc--open-target'
instead of `erc-join'.
(erc-server-PRIVMSG): Don't call `erc-auto-query' at all, and instead
borrow the portion of its logic that detects when a query buffer
should be created instead of a channel buffer.
* lisp/erc/erc.el (erc-cmd-QUERY): Update the mode line explicitly
after calling `erc-query' in case it's needed after `erc-setup-buffer'
runs. Simplify.
(erc-query, erc--open-target): Replace uses of `erc-query'
with `erc--open-target' and make the former obsolete. Don't call
`erc-update-mode-line' because `erc-open' already does that.
(erc-auto-query): Make this function obsolete. It was previously only
used in erc-backend.el and only sewed confusion.
(erc-query-on-unjoined-chan-privmsg): Add note questioning its role.
It was previously only used by the now deprecated `erc-auto-query'.
* test/lisp/erc/erc-scenarios-misc.el
(erc-scenarios-base-mask-target-routing): Add test for server masks.
* test/lisp/erc/resources/base/mask-target-routing/foonet.eld: New file.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/erc/erc-scenarios-misc.el | 34 | ||||
| -rw-r--r-- | test/lisp/erc/resources/base/mask-target-routing/foonet.eld | 45 |
2 files changed, 79 insertions, 0 deletions
diff --git a/test/lisp/erc/erc-scenarios-misc.el b/test/lisp/erc/erc-scenarios-misc.el index 86cfa8b10bd..9d6d5bc1d6a 100644 --- a/test/lisp/erc/erc-scenarios-misc.el +++ b/test/lisp/erc/erc-scenarios-misc.el | |||
| @@ -104,4 +104,38 @@ | |||
| 104 | (should-not erc-network) | 104 | (should-not erc-network) |
| 105 | (should (string= erc-server-announced-name "irc.foonet.org")))))) | 105 | (should (string= erc-server-announced-name "irc.foonet.org")))))) |
| 106 | 106 | ||
| 107 | ;; Targets that are host/server masks like $*, $$*, and #* are routed | ||
| 108 | ;; to the server buffer: https://github.com/ircdocs/wooooms/issues/5 | ||
| 109 | |||
| 110 | (ert-deftest erc-scenarios-base-mask-target-routing () | ||
| 111 | :tags '(:expensive-test) | ||
| 112 | (erc-scenarios-common-with-cleanup | ||
| 113 | ((erc-scenarios-common-dialog "base/mask-target-routing") | ||
| 114 | (dumb-server (erc-d-run "localhost" t 'foonet)) | ||
| 115 | (port (process-contact dumb-server :service)) | ||
| 116 | (expect (erc-d-t-make-expecter))) | ||
| 117 | |||
| 118 | (ert-info ("Connect to foonet") | ||
| 119 | (with-current-buffer (erc :server "127.0.0.1" | ||
| 120 | :port port | ||
| 121 | :nick "tester" | ||
| 122 | :password "changeme" | ||
| 123 | :full-name "tester") | ||
| 124 | (should (string= (buffer-name) (format "127.0.0.1:%d" port))))) | ||
| 125 | |||
| 126 | (erc-d-t-wait-for 10 (get-buffer "foonet")) | ||
| 127 | |||
| 128 | (ert-info ("Channel buffer #foo playback received") | ||
| 129 | (with-current-buffer (erc-d-t-wait-for 3 (get-buffer "#foo")) | ||
| 130 | (funcall expect 10 "Excellent workman"))) | ||
| 131 | |||
| 132 | (ert-info ("Global notices routed to server buffer") | ||
| 133 | (with-current-buffer "foonet" | ||
| 134 | (funcall expect 10 "going down soon") | ||
| 135 | (funcall expect 10 "this is a warning") | ||
| 136 | (funcall expect 10 "second warning") | ||
| 137 | (funcall expect 10 "final warning"))) | ||
| 138 | |||
| 139 | (should-not (get-buffer "$*")))) | ||
| 140 | |||
| 107 | ;;; erc-scenarios-misc.el ends here | 141 | ;;; erc-scenarios-misc.el ends here |
diff --git a/test/lisp/erc/resources/base/mask-target-routing/foonet.eld b/test/lisp/erc/resources/base/mask-target-routing/foonet.eld new file mode 100644 index 00000000000..796d5566b65 --- /dev/null +++ b/test/lisp/erc/resources/base/mask-target-routing/foonet.eld | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | ;; -*- mode: lisp-data; -*- | ||
| 2 | ((pass 1 "PASS :changeme")) | ||
| 3 | ((nick 1 "NICK tester")) | ||
| 4 | ((user 1 "USER user 0 * :tester") | ||
| 5 | (0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester") | ||
| 6 | (0 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version oragono-2.6.0-7481bf0385b95b16") | ||
| 7 | (0 ":irc.foonet.org 003 tester :This server was created Mon, 31 May 2021 09:56:24 UTC") | ||
| 8 | (0 ":irc.foonet.org 004 tester irc.foonet.org oragono-2.6.0-7481bf0385b95b16 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv") | ||
| 9 | (0 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this server") | ||
| 10 | (0 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server") | ||
| 11 | (0 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by this server") | ||
| 12 | (0 ":irc.foonet.org 251 tester :There are 0 users and 4 invisible on 1 server(s)") | ||
| 13 | (0 ":irc.foonet.org 252 tester 0 :IRC Operators online") | ||
| 14 | (0 ":irc.foonet.org 254 tester 2 :channels formed") | ||
| 15 | (0 ":irc.foonet.org 255 tester :I have 4 clients and 0 servers") | ||
| 16 | (0 ":irc.foonet.org 265 tester 4 4 :Current local users 4, max 4") | ||
| 17 | (0 ":irc.foonet.org 266 tester 4 4 :Current global users 4, max 4") | ||
| 18 | (0 ":irc.foonet.org 422 tester :MOTD File is missing")) | ||
| 19 | |||
| 20 | ((mode-user 1.2 "MODE tester +i") | ||
| 21 | ;; No mode answer | ||
| 22 | (0 ":irc.znc.in 306 tester :You have been marked as being away") | ||
| 23 | (0 ":tester!~u@gq7yjr7gsu7nn.irc JOIN #foo") | ||
| 24 | (0 ":irc.foonet.org 353 tester = #foo :alice @bob rando tester") | ||
| 25 | (0 ":irc.foonet.org 366 tester #foo :End of /NAMES list.") | ||
| 26 | (0 ":***!znc@znc.in PRIVMSG #foo :Buffer Playback...") | ||
| 27 | (0 ":alice!~u@gq7yjr7gsu7nn.irc PRIVMSG #foo :[10:00:02] bob: All that he is hath reference to your highness.") | ||
| 28 | (0 ":bob!~u@gq7yjr7gsu7nn.irc PRIVMSG #foo :[10:00:06] alice: Excellent workman! Thou canst not paint a man so bad as is thyself.") | ||
| 29 | (0 ":***!znc@znc.in PRIVMSG #foo :Playback Complete.") | ||
| 30 | (0 ":irc.foonet.org NOTICE tester :[09:56:57] This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.") | ||
| 31 | (0 ":irc.foonet.org 305 tester :You are no longer marked as being away")) | ||
| 32 | |||
| 33 | ((mode 5 "MODE #foo") | ||
| 34 | (0 ":irc.foonet.org 324 tester #foo +nt") | ||
| 35 | (0 ":irc.foonet.org 329 tester #foo 1622454985") | ||
| 36 | ;; Invalid msg | ||
| 37 | (0.1 ":rando!~u@em2i467d4ejul.irc PRIVMSG :") | ||
| 38 | (0.1 ":alice!~u@gq7yjr7gsu7nn.irc PRIVMSG #foo :bob: Farewell, pretty lady: you must hold the credit of your father.") | ||
| 39 | (0.1 ":bob!~u@gq7yjr7gsu7nn.irc NOTICE $* :[Global notice] going down soon.") | ||
| 40 | (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #foo :bob: Well, this is the forest of Arden.") | ||
| 41 | (0.1 ":bob!~u@gq7yjr7gsu7nn.irc NOTICE $$* :[Global notice] this is a warning.") | ||
| 42 | (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #foo :bob: Be married under a bush, like a beggar ? Get you to church, and have a good priest that can tell you what marriage is: this fellow will but join you together as they join wainscot; then one of you will prove a shrunk panel, and like green timber, warp, warp.") | ||
| 43 | (0.1 ":bob!~u@gq7yjr7gsu7nn.irc PRIVMSG $* :[Global msg] second warning.") | ||
| 44 | (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #foo :bob: And will you, being a man of your breeding.") | ||
| 45 | (0.1 ":bob!~u@gq7yjr7gsu7nn.irc NOTICE #* :[Global notice] final warning.")) | ||