Function: erc-querypoll-mode

erc-querypoll-mode is an autoloaded, interactive and byte-compiled function defined in erc-notify.el.gz.

Signature

(erc-querypoll-mode &optional ARG)

Documentation

Toggle ERC querypoll mode locally.

If called interactively, enable erc-querypoll-mode(var)/erc-querypoll-mode(fun) if ARG is positive, and disable it otherwise. If called from Lisp, enable the mode if ARG is omitted or nil.

Send periodic "WHO" requests for each query buffer. Omit query participants who are currently present in some channel. Instead of announcing arrivals and departures, rely on other modules, like nickbar, to provide UI feedback when changes occur.

Once ERC implements the monitor extension, this module will serve as an optional fallback for keeping query-participant rolls up to date on servers that lack support or are stingy with their allotments. Until such time, this module should be considered experimental and only really useful for bots and other non-interactive Lisp programs. Please note that reporting is unreliable for short periods while a query participant is parting, joining, quitting, or logging in.

This is a local ERC module, so selectively polling only a subset of query targets is possible but cumbersome. To do so, ensure erc-querypoll-mode(var)/erc-querypoll-mode(fun) is enabled in the server buffer, and then toggle it as appropriate in desired query buffers. To stop polling for the current connection, toggle off the command M-x erc-querypoll-mode (erc-querypoll-mode) from a server buffer, or run \M-x C-u erc-querypoll-disable RET from a target buffer. Note that this module's minor mode must remain active in at least the server buffer.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-notify.el.gz
;;;###autoload(autoload 'erc-querypoll-mode "erc-notify" nil t)
(define-erc-module querypoll nil
  "Send periodic \"WHO\" requests for each query buffer.
Omit query participants who are currently present in some channel.
Instead of announcing arrivals and departures, rely on other modules,
like `nickbar', to provide UI feedback when changes occur.

Once ERC implements the `monitor' extension, this module will serve as
an optional fallback for keeping query-participant rolls up to date on
servers that lack support or are stingy with their allotments.  Until
such time, this module should be considered experimental and only really
useful for bots and other non-interactive Lisp programs.  Please note
that reporting is unreliable for short periods while a query participant
is parting, joining, quitting, or logging in.

This is a local ERC module, so selectively polling only a subset of
query targets is possible but cumbersome.  To do so, ensure
`erc-querypoll-mode' is enabled in the server buffer, and then toggle it
as appropriate in desired query buffers.  To stop polling for the
current connection, toggle off the command \\[erc-querypoll-mode] from a
server buffer, or run \\`M-x C-u erc-querypoll-disable RET' from a
target buffer.  Note that this module's minor mode must remain active in
at least the server buffer."
  ((if erc--target
       (if (erc-query-buffer-p)
           (progn ; accommodate those who eschew `erc-modules'
             (erc-with-server-buffer
               (unless erc-querypoll-mode
                 (erc-querypoll-mode +1)))
             (add-function :override (local 'erc--query-table-synced-predicate)
                           #'erc--querypoll-active-p)
             (erc--querypoll-subscribe (current-buffer)))
         (erc-querypoll-mode -1))
     (cl-assert (not erc--decouple-query-and-channel-membership-p))
     (setq-local erc--querypoll-ring (make-ring 5))
     (erc-with-all-buffers-of-server erc-server-process nil
       (unless erc-querypoll-mode
         (erc-querypoll-mode +1)))))
  ((when erc--querypoll-timer
     (cancel-timer erc--querypoll-timer))
   (if erc--target
       (when-let* (((erc-query-buffer-p))
                   (ring (erc-with-server-buffer erc--querypoll-ring))
                   (index (ring-member ring (current-buffer)))
                   ((not (erc--querypoll-target-in-chan-p (current-buffer)))))
         (ring-remove ring index)
         (remove-function (local 'erc--query-table-synced-predicate)
                          #'erc--querypoll-active-p)
         (unless (erc-current-nick-p (erc-target))
           (erc-remove-current-channel-member (erc-target))))
     (erc-with-all-buffers-of-server erc-server-process #'erc-query-buffer-p
       (erc-querypoll-mode -1)))
   (kill-local-variable 'erc--querypoll-ring)
   (kill-local-variable 'erc--querypoll-timer))
  localp)