aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorF. Jason Park2024-05-08 19:04:13 -0700
committerF. Jason Park2024-05-27 16:39:18 -0700
commit04477cf97be9eb2bb5ae09eff114252864461f05 (patch)
tree07ac197732c45a1cc5e1c808a9f78e83ee3a297e
parent75aefe6514854bfdbe2a398cf1b7265012c9a88b (diff)
downloademacs-04477cf97be9eb2bb5ae09eff114252864461f05.tar.gz
emacs-04477cf97be9eb2bb5ae09eff114252864461f05.zip
Tether query rolls to channel membership in ERC
* lisp/erc/erc-backend.el (erc-server-JOIN): Update query membership via `erc--ensure-query-member' when someone else joins a channel. (erc-server-NICK): Update query membership via `erc--ensure-query-member' after someone else changes their nick. (erc-server-PRIVMSG): After printing a query message from some other person, remove their nick's data from the query buffer's user table if they're "untracked," i.e., not a member of a channel. (erc-server-263, erc-server-263-functions): New function and variable, a default response handler and hook for "RPL_TRYAGAIN", which servers send for things like rejecting "WHO" and "WHOX" responses due to rate limiting. (erc-server-311): Fix call to `erc-update-user-nick' so the userhost login component is no longer supplied as the `info' parameter but rather, correctly, as the `login'. (erc--extract-352-full-name): Factor out trailing hop-count and GECOS parsing for use by overriding handlers or those for adjacent numerics. (erc-server-352): Refactor to handle asterisk as `channel' parameter, which indicates a nick rather than a channel target. (erc-server-366): Update membership in all query buffers via `erc--ensure-query-members' after all names have been received. (erc-server-401): Forget a known user completely when the server reports them as nonexistent. * lisp/erc/erc-common.el (erc--get-server-user): New function, a thin wrapper around `erc-get-server-user' for cases were inlining would require declaring symbols not defined in erc-common. * lisp/erc/erc.el (erc-channel-members): Mention that instances are used for query-participant tables as well. (erc--decouple-query-and-channel-membership-p): New variable, a compatibility flag to access pre-5.6 query bookkeeping behavior. (erc--ensure-query-member, erc--ensure-query-members): New functions. (erc-cmd-QUERY): Ensure parties are present in the query buffer's membership table if they're known to be on the server by simple virtue of being present in some joined channel. (erc-message-english-s352-you): New variable. * test/lisp/erc/erc-scenarios-base-query-participants.el (erc-scenarios-base-query-participants) (erc-scenarios-base-query-participants/legacy): Rename former to latter. Enable compat flag to activate legacy query behavior in which channel membership does not impact query membership. (erc-scenarios-base-query-participants/coupled): New test asserting new behavior in which channel membership dictates query membership. (Bug#70928)
-rw-r--r--lisp/erc/erc-backend.el70
-rw-r--r--lisp/erc/erc-common.el3
-rw-r--r--lisp/erc/erc.el43
-rw-r--r--test/lisp/erc/erc-scenarios-base-query-participants.el93
4 files changed, 183 insertions, 26 deletions
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 97aab0e25c3..a26cdd50dd7 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -118,6 +118,8 @@
118(defvar erc-nick-change-attempt-count) 118(defvar erc-nick-change-attempt-count)
119(defvar erc-verbose-server-ping) 119(defvar erc-verbose-server-ping)
120 120
121(declare-function erc--ensure-query-member "erc" (name))
122(declare-function erc--ensure-query-members "erc" ())
121(declare-function erc--init-channel-modes "erc" (channel raw-args)) 123(declare-function erc--init-channel-modes "erc" (channel raw-args))
122(declare-function erc--open-target "erc" (target)) 124(declare-function erc--open-target "erc" (target))
123(declare-function erc--parse-nuh "erc" (string)) 125(declare-function erc--parse-nuh "erc" (string))
@@ -1781,6 +1783,8 @@ add things to `%s' instead."
1781 (list 'JOIN ?n nick ?u login ?h host ?c chnl))))) 1783 (list 'JOIN ?n nick ?u login ?h host ?c chnl)))))
1782 (when buffer (set-buffer buffer)) 1784 (when buffer (set-buffer buffer))
1783 (erc-update-channel-member chnl nick nick t nil nil nil nil nil host login) 1785 (erc-update-channel-member chnl nick nick t nil nil nil nil nil host login)
1786 (unless (erc-current-nick-p nick)
1787 (erc--ensure-query-member nick))
1784 ;; on join, we want to stay in the new channel buffer 1788 ;; on join, we want to stay in the new channel buffer
1785 ;;(set-buffer ob) 1789 ;;(set-buffer ob)
1786 (apply #'erc-display-message parsed 'notice buffer args)))))) 1790 (apply #'erc-display-message parsed 'notice buffer args))))))
@@ -1906,7 +1910,8 @@ Return a list of buffers in which to announce the change."
1906 (run-hook-with-args 'erc-nick-changed-functions nn nick)) 1910 (run-hook-with-args 'erc-nick-changed-functions nn nick))
1907 (t 1911 (t
1908 (when erc-server-connected 1912 (when erc-server-connected
1909 (erc-networks--id-reload erc-networks--id proc parsed)) 1913 (erc-networks--id-reload erc-networks--id proc parsed)
1914 (erc--ensure-query-member nn))
1910 (erc-handle-user-status-change 'nick (list nick login host) (list nn)) 1915 (erc-handle-user-status-change 'nick (list nick login host) (list nn))
1911 (erc-display-message parsed 'notice bufs 'NICK ?n nick 1916 (erc-display-message parsed 'notice bufs 'NICK ?n nick
1912 ?u login ?h host ?N nn)))))) 1917 ?u login ?h host ?N nn))))))
@@ -2054,7 +2059,7 @@ like `erc-insert-modify-hook'.")
2054 (erc--speaker-status-prefix-wanted-p nil) 2059 (erc--speaker-status-prefix-wanted-p nil)
2055 (erc-current-message-catalog erc--message-speaker-catalog) 2060 (erc-current-message-catalog erc--message-speaker-catalog)
2056 ;; 2061 ;;
2057 buffer statusmsg cmem-prefix fnick) 2062 finalize buffer statusmsg cmem-prefix fnick)
2058 (setq buffer (erc-get-buffer (if privp nick tgt) proc)) 2063 (setq buffer (erc-get-buffer (if privp nick tgt) proc))
2059 ;; Even worth checking for empty target here? (invalid anyway) 2064 ;; Even worth checking for empty target here? (invalid anyway)
2060 (unless (or buffer noticep (string-empty-p tgt) (eq ?$ (aref tgt 0)) 2065 (unless (or buffer noticep (string-empty-p tgt) (eq ?$ (aref tgt 0))
@@ -2081,10 +2086,14 @@ like `erc-insert-modify-hook'.")
2081 (setq buffer (erc--open-target tgt)))))) 2086 (setq buffer (erc--open-target tgt))))))
2082 (when buffer 2087 (when buffer
2083 (with-current-buffer buffer 2088 (with-current-buffer buffer
2084 (when privp (erc--unhide-prompt)) 2089 (when privp
2085 ;; update the chat partner info. Add to the list if private 2090 (erc--unhide-prompt)
2086 ;; message. We will accumulate private identities indefinitely 2091 ;; Remove untracked query partners after display.
2087 ;; at this point. 2092 (defvar erc--decouple-query-and-channel-membership-p)
2093 (unless (or erc--decouple-query-and-channel-membership-p
2094 (erc--get-server-user nick))
2095 (setq finalize (lambda ()
2096 (erc-remove-channel-member buffer nick)))))
2088 (erc-update-channel-member (if privp nick tgt) nick nick 2097 (erc-update-channel-member (if privp nick tgt) nick nick
2089 privp nil nil nil nil nil host login nil nil t) 2098 privp nil nil nil nil nil host login nil nil t)
2090 (defvar erc--cmem-from-nick-function) 2099 (defvar erc--cmem-from-nick-function)
@@ -2123,7 +2132,9 @@ like `erc-insert-modify-hook'.")
2123 (run-hook-with-args 'erc-echo-notice-always-hook 2132 (run-hook-with-args 'erc-echo-notice-always-hook
2124 fmtmsg parsed buffer nick) 2133 fmtmsg parsed buffer nick)
2125 (run-hook-with-args-until-success 2134 (run-hook-with-args-until-success
2126 'erc-echo-notice-hook fmtmsg parsed buffer nick)))))))))) 2135 'erc-echo-notice-hook fmtmsg parsed buffer nick)))))
2136 (when finalize (funcall finalize)))
2137 nil))))
2127 2138
2128(define-erc-response-handler (QUIT) 2139(define-erc-response-handler (QUIT)
2129 "Another user has quit IRC." nil 2140 "Another user has quit IRC." nil
@@ -2335,6 +2346,9 @@ A server may send more than one 005 message."
2335See `erc-display-server-message'." nil 2346See `erc-display-server-message'." nil
2336 (erc-display-server-message proc parsed)) 2347 (erc-display-server-message proc parsed))
2337 2348
2349(define-erc-response-handler (263) "RPL_TRYAGAIN." nil
2350 (erc-handle-unknown-server-response proc parsed))
2351
2338(define-erc-response-handler (275) 2352(define-erc-response-handler (275)
2339 "Display secure connection message." nil 2353 "Display secure connection message." nil
2340 (pcase-let ((`(,nick ,_user ,_message) 2354 (pcase-let ((`(,nick ,_user ,_message)
@@ -2387,7 +2401,7 @@ See `erc-display-server-message'." nil
2387 (catalog-entry (intern (format "s%s" (erc-response.command parsed))))) 2401 (catalog-entry (intern (format "s%s" (erc-response.command parsed)))))
2388 (pcase-let ((`(,nick ,user ,host) 2402 (pcase-let ((`(,nick ,user ,host)
2389 (cdr (erc-response.command-args parsed)))) 2403 (cdr (erc-response.command-args parsed))))
2390 (erc-update-user-nick nick nick host nil fname user) 2404 (erc-update-user-nick nick nick host user fname)
2391 (erc-display-message 2405 (erc-display-message
2392 parsed 'notice 'active catalog-entry 2406 parsed 'notice 'active catalog-entry
2393 ?n nick ?f fname ?u user ?h host)))) 2407 ?n nick ?f fname ?u user ?h host))))
@@ -2549,18 +2563,28 @@ See `erc-display-server-message'." nil
2549 (erc-display-message parsed 'notice (erc-get-buffer channel proc) 2563 (erc-display-message parsed 'notice (erc-get-buffer channel proc)
2550 's341 ?n nick ?c channel))) 2564 's341 ?n nick ?c channel)))
2551 2565
2552;; FIXME update or add server user instead when channel is "*". 2566(defun erc--extract-352-full-name (contents)
2567 "Return full name from 352 trailing param, discarding hop count."
2568 (pcase contents
2569 ((rx (: bot (+ (any "0-9")) " ") (let full-name (group (* nonl))) eot)
2570 full-name)
2571 (_ contents)))
2572
2553(define-erc-response-handler (352) 2573(define-erc-response-handler (352)
2554 "WHO notice." nil 2574 "RPL_WHOREPLY response." nil
2555 (pcase-let ((`(,channel ,user ,host ,_server ,nick ,away-flag) 2575 (pcase-let*
2556 (cdr (erc-response.command-args parsed)))) 2576 ((`(,_ ,channel ,user ,host ,_server ,nick ,flags, hop-real)
2557 (let ((full-name (erc-response.contents parsed))) 2577 (erc-response.command-args parsed))
2558 (when (string-match "\\(^[0-9]+ \\)\\(.*\\)$" full-name) 2578 (full-name (erc--extract-352-full-name hop-real))
2559 (setq full-name (match-string 2 full-name))) 2579 (selfp (string= channel "*"))
2560 (erc-update-channel-member channel nick nick nil nil nil nil nil nil host user full-name) 2580 (template (if selfp 's352-you 's352)))
2561 (erc-display-message parsed 'notice 'active 's352 2581 (if selfp
2562 ?c channel ?n nick ?a away-flag 2582 (erc-update-user-nick nick nick host user full-name)
2563 ?u user ?h host ?f full-name)))) 2583 (erc-update-channel-member channel nick nick nil nil nil nil nil nil
2584 host user full-name))
2585 (erc-display-message parsed 'notice 'active template
2586 ?c channel ?n nick ?a flags
2587 ?u user ?h host ?f full-name)))
2564 2588
2565(define-erc-response-handler (353) 2589(define-erc-response-handler (353)
2566 "NAMES notice." nil 2590 "NAMES notice." nil
@@ -2575,7 +2599,9 @@ See `erc-display-server-message'." nil
2575(define-erc-response-handler (366) 2599(define-erc-response-handler (366)
2576 "End of NAMES." nil 2600 "End of NAMES." nil
2577 (erc-with-buffer ((cadr (erc-response.command-args parsed)) proc) 2601 (erc-with-buffer ((cadr (erc-response.command-args parsed)) proc)
2578 (erc-channel-end-receiving-names))) 2602 (erc-channel-end-receiving-names))
2603 (erc--ensure-query-members)
2604 nil)
2579 2605
2580(define-erc-response-handler (367) 2606(define-erc-response-handler (367)
2581 "Channel ban list entries." nil 2607 "Channel ban list entries." nil
@@ -2641,7 +2667,9 @@ See `erc-display-server-message'." nil
2641 (erc-log (format "cmd: WHOWAS: %s" nick/channel)) 2667 (erc-log (format "cmd: WHOWAS: %s" nick/channel))
2642 (erc-server-send (format "WHOWAS %s 1" nick/channel))) 2668 (erc-server-send (format "WHOWAS %s 1" nick/channel)))
2643 (erc-display-message parsed '(notice error) 'active 2669 (erc-display-message parsed '(notice error) 'active
2644 's401 ?n nick/channel))) 2670 's401 ?n nick/channel)
2671 (unless (erc-channel-p nick/channel)
2672 (erc-remove-user nick/channel))))
2645 2673
2646(define-erc-response-handler (402) 2674(define-erc-response-handler (402)
2647 "No such server." nil 2675 "No such server." nil
diff --git a/lisp/erc/erc-common.el b/lisp/erc/erc-common.el
index 51a93bdaa50..c01ee6546cb 100644
--- a/lisp/erc/erc-common.el
+++ b/lisp/erc/erc-common.el
@@ -557,6 +557,9 @@ Use the CASEMAPPING ISUPPORT parameter to determine the style."
557 (gethash (erc-downcase ,nick) 557 (gethash (erc-downcase ,nick)
558 (erc-with-server-buffer erc-server-users))))) 558 (erc-with-server-buffer erc-server-users)))))
559 559
560(defun erc--get-server-user (nick)
561 (erc-get-server-user nick))
562
560(defmacro erc--with-dependent-type-match (type &rest features) 563(defmacro erc--with-dependent-type-match (type &rest features)
561 "Massage Custom :type TYPE with :match function that pre-loads FEATURES." 564 "Massage Custom :type TYPE with :match function that pre-loads FEATURES."
562 `(backquote-list* ',(car type) 565 `(backquote-list* ',(car type)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 4de7f089aaf..5be557dee4a 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -509,7 +509,7 @@ Functions are passed a buffer as the first argument."
509 509
510(defvaralias 'erc-channel-users 'erc-channel-members) 510(defvaralias 'erc-channel-users 'erc-channel-members)
511(defvar-local erc-channel-members nil 511(defvar-local erc-channel-members nil
512 "Hash table of members in the current channel. 512 "Hash table of members in the current channel or query buffer.
513It associates nicknames with cons cells of the form 513It associates nicknames with cons cells of the form
514\(SERVER-USER . MEMBER-DATA), where SERVER-USER is a 514\(SERVER-USER . MEMBER-DATA), where SERVER-USER is a
515`erc-server-user' object and MEMBER-DATA is a `erc-channel-user' 515`erc-server-user' object and MEMBER-DATA is a `erc-channel-user'
@@ -549,6 +549,37 @@ Adds USER with nickname NICK to the `erc-server-users' hash table."
549 (erc-with-server-buffer 549 (erc-with-server-buffer
550 (puthash (erc-downcase nick) user erc-server-users))) 550 (puthash (erc-downcase nick) user erc-server-users)))
551 551
552(defvar erc--decouple-query-and-channel-membership-p nil
553 "When non-nil, don't tether query participation to channel membership.
554Specifically, add users to query tables when they speak, don't remove
555them when they leave all channels, and allow removing the client's own
556user from `erc-server-users'. Note that enabling this compatibility
557flag degrades the user experience and isn't guaranteed to correctly
558restore the described historical behavior.")
559
560(defun erc--ensure-query-member (nick)
561 "Populate membership table in query buffer for online NICK."
562 (erc-with-buffer (nick)
563 (when-let (((not erc--decouple-query-and-channel-membership-p))
564 ((zerop (hash-table-count erc-channel-users)))
565 (user (erc-get-server-user nick)))
566 (erc-update-current-channel-member nick nil t)
567 (erc--unhide-prompt)
568 t)))
569
570(defun erc--ensure-query-members ()
571 "Update membership tables in all query buffers.
572Ensure targets with an entry in `erc-server-users' are present in
573`erc-channel-members'."
574 (erc-with-all-buffers-of-server erc-server-process #'erc-query-buffer-p
575 (when-let (((not erc--decouple-query-and-channel-membership-p))
576 ((zerop (hash-table-count erc-channel-users)))
577 (target (erc-target))
578 ((erc-get-server-user target)))
579 (erc-update-current-channel-member target nil t)
580 (erc--unhide-prompt))
581 erc-server-process))
582
552(defun erc-remove-server-user (nick) 583(defun erc-remove-server-user (nick)
553 "This function is for internal use only. 584 "This function is for internal use only.
554 585
@@ -5155,8 +5186,7 @@ just as you provided it. Use this command with care!"
5155 5186
5156(defun erc-cmd-QUERY (&optional user) 5187(defun erc-cmd-QUERY (&optional user)
5157 "Open a query with USER. 5188 "Open a query with USER.
5158How the query is displayed (in a new window, frame, etc.) depends 5189Display the query buffer in accordance with `erc-interactive-display'."
5159on the value of `erc-interactive-display'."
5160 ;; FIXME: The doc string used to say at the end: 5190 ;; FIXME: The doc string used to say at the end:
5161 ;; "If USER is omitted, close the current query buffer if one exists 5191 ;; "If USER is omitted, close the current query buffer if one exists
5162 ;; - except this is broken now ;-)" 5192 ;; - except this is broken now ;-)"
@@ -5172,7 +5202,11 @@ on the value of `erc-interactive-display'."
5172 (erc--display-context `((erc-interactive-display . /QUERY) 5202 (erc--display-context `((erc-interactive-display . /QUERY)
5173 ,@erc--display-context))) 5203 ,@erc--display-context)))
5174 (erc-with-server-buffer 5204 (erc-with-server-buffer
5175 (erc--open-target user)))) 5205 (if-let ((buffer (erc-get-buffer user erc-server-process)))
5206 (prog1 buffer
5207 (erc-setup-buffer buffer))
5208 (prog1 (erc--open-target user) ; becomes current buffer
5209 (erc--ensure-query-member user))))))
5176 5210
5177(defalias 'erc-cmd-Q #'erc-cmd-QUERY) 5211(defalias 'erc-cmd-Q #'erc-cmd-QUERY)
5178 5212
@@ -9525,6 +9559,7 @@ SOFTP, only do so when defined as a variable."
9525 (s333 . "%c: topic set by %n, %t") 9559 (s333 . "%c: topic set by %n, %t")
9526 (s341 . "Inviting %n to channel %c") 9560 (s341 . "Inviting %n to channel %c")
9527 (s352 . "%-11c %-10n %-4a %u@%h (%f)") 9561 (s352 . "%-11c %-10n %-4a %u@%h (%f)")
9562 (s352-you . "%n %a %u@%h (%f)")
9528 (s353 . "Users on %c: %u") 9563 (s353 . "Users on %c: %u")
9529 (s367 . "Ban for %b on %c") 9564 (s367 . "Ban for %b on %c")
9530 (s367-set-by . "Ban for %b on %c set by %s on %t") 9565 (s367-set-by . "Ban for %b on %c set by %s on %t")
diff --git a/test/lisp/erc/erc-scenarios-base-query-participants.el b/test/lisp/erc/erc-scenarios-base-query-participants.el
index 9e9109091ac..30c04974bb6 100644
--- a/test/lisp/erc/erc-scenarios-base-query-participants.el
+++ b/test/lisp/erc/erc-scenarios-base-query-participants.el
@@ -24,7 +24,7 @@
24 (let ((load-path (cons (ert-resource-directory) load-path))) 24 (let ((load-path (cons (ert-resource-directory) load-path)))
25 (require 'erc-scenarios-common))) 25 (require 'erc-scenarios-common)))
26 26
27(ert-deftest erc-scenarios-base-query-participants () 27(ert-deftest erc-scenarios-base-query-participants/legacy ()
28 :tags '(:expensive-test) 28 :tags '(:expensive-test)
29 29
30 (erc-scenarios-common-with-cleanup 30 (erc-scenarios-common-with-cleanup
@@ -32,6 +32,7 @@
32 (erc-server-flood-penalty 0.1) 32 (erc-server-flood-penalty 0.1)
33 (dumb-server (erc-d-run "localhost" t 'legacy)) 33 (dumb-server (erc-d-run "localhost" t 'legacy))
34 (expect (erc-d-t-make-expecter)) 34 (expect (erc-d-t-make-expecter))
35 (erc--decouple-query-and-channel-membership-p t)
35 (port (process-contact dumb-server :service))) 36 (port (process-contact dumb-server :service)))
36 37
37 (ert-info ("Connect to foonet") 38 (ert-info ("Connect to foonet")
@@ -113,5 +114,95 @@
113 (should-not (erc-get-server-user "bob")) ; missing from query 114 (should-not (erc-get-server-user "bob")) ; missing from query
114 (should (erc-get-server-user "dummy")))))) 115 (should (erc-get-server-user "dummy"))))))
115 116
117(ert-deftest erc-scenarios-base-query-participants/coupled ()
118 :tags '(:expensive-test)
119
120 (erc-scenarios-common-with-cleanup
121 ((erc-scenarios-common-dialog "base/query-participants")
122 (erc-server-flood-penalty 0.1)
123 (dumb-server (erc-d-run "localhost" t 'legacy))
124 (expect (erc-d-t-make-expecter))
125 (port (process-contact dumb-server :service)))
126
127 (ert-info ("Connect to foonet")
128 (with-current-buffer (erc :server "127.0.0.1"
129 :port port
130 :nick "tester"
131 :user "tester"
132 :full-name "tester")
133 (funcall expect 10 "This server is in debug mode")
134 (erc-scenarios-common-say "/query bob")))
135
136 (ert-info ("Opening query on untracked user bob doesn't create entry.")
137 (with-current-buffer "bob"
138 (should-not (erc-get-channel-member "bob"))))
139
140 (ert-info ("DM from untracked user also doesn't create a query entry.")
141 (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "dummy"))
142 (funcall expect 10 "<dummy> hi")
143 (should-not (erc-get-channel-member "dummy"))
144 (should-not (erc-get-server-user "dummy"))))
145
146 (with-current-buffer "foonet"
147 (erc-scenarios-common-say "/join #chan"))
148
149 (ert-info ("Members in new chan added to existing query buffers")
150 (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan"))
151 (funcall expect 10 "bob ")) ; bob is present in #chan (353)
152 (with-current-buffer "bob"
153 (should (erc-get-server-user "bob"))
154 ;; Can't assert immediately: must wait until 366 arrives.
155 (erc-d-t-wait-for 10 (erc-get-channel-member "bob"))))
156
157 (ert-info ("Opening query on tracked user creates entry")
158 (with-current-buffer "#chan"
159 (funcall expect 10 " alice") ;; alice is present
160 (erc-scenarios-common-say "hi channel") ; gate
161 (funcall expect 10 "<tester> hi channel")
162 (erc-scenarios-common-say "/query alice"))
163 (with-current-buffer "alice"
164 (should (erc-get-channel-member "alice"))))
165
166 ;; Bob says something.
167 (with-current-buffer "bob"
168 (funcall expect 10 "<bob> hi")
169 (should (erc-get-channel-member "bob")))
170
171 (ert-info ("Query pal parting channel removes them from query")
172 ;; Identical result if they're kicked: they're removed from the
173 ;; server AND their target buffers
174 (with-current-buffer "#chan"
175 (funcall expect 10 "has left")
176 (should-not (erc-get-channel-member "dummy"))
177 (should-not (erc-get-server-user "dummy")))
178 (with-current-buffer "dummy"
179 (should-not (erc-get-channel-member "dummy"))))
180
181 ;; This is unchanged from legacy behavior.
182 (ert-info ("Query pal quitting channel removes them everywhere")
183 (with-current-buffer "#chan"
184 (funcall expect 10 "has quit")
185 (should-not (erc-get-channel-member "bob"))
186 (should-not (erc-get-server-user "bob")))
187 (with-current-buffer "bob"
188 (should-not (erc-get-channel-member "bob"))))
189
190 (ert-info ("Query pal re-joining repopulates query")
191 (with-current-buffer "#chan"
192 (erc-scenarios-common-say "bob gone")
193 (funcall expect 10 "<alice> bob, welcome back!")
194 (should (erc-get-server-user "bob")))
195 (with-current-buffer "bob"
196 (should (erc-get-channel-member "bob"))))
197
198 (ert-info ("Parting removes chan members from server and queries")
199 (with-current-buffer "#chan"
200 (erc-scenarios-common-say "/part")
201 (funcall expect 10 "you have left")
202 (should-not (erc-get-server-user "fsbot"))
203 (should-not (erc-get-server-user "alice")) ; she never said anything
204 (should-not (erc-get-server-user "bob")) ; missing from query
205 (should-not (erc-get-server-user "dummy"))))))
206
116 207
117;;; erc-scenarios-base-query-participants.el ends here 208;;; erc-scenarios-base-query-participants.el ends here