Function: erc-networks--examine-targets

erc-networks--examine-targets is a byte-compiled function defined in erc-networks.el.gz.

Signature

(erc-networks--examine-targets IDENTITY TARGET ON-DUPE ON-COLLISION)

Documentation

Visit all ERC target buffers with the same TARGET.

Call ON-DUPE when a buffer's identity belongs to a network IDENTITY or "should" after reconciliation. Call ON-COLLISION otherwise. Neither function should accept any args. Expect TARGET to be an erc--target object.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-networks.el.gz
(defun erc-networks--examine-targets (identity target on-dupe on-collision)
  "Visit all ERC target buffers with the same TARGET.
Call ON-DUPE when a buffer's identity belongs to a network
IDENTITY or \"should\" after reconciliation.  Call ON-COLLISION
otherwise.  Neither function should accept any args. Expect
TARGET to be an `erc--target' object."
  (declare (indent 2))
  (let ((announced erc-server-announced-name))
    (erc-buffer-filter
     (lambda ()
       (when (and erc--target (eq (erc--target-symbol erc--target)
                                  (erc--target-symbol target)))
         ;; When a server sends administrative queries immediately
         ;; after connection registration and before the session has a
         ;; net-id, the buffer remains orphaned until reassociated
         ;; here retroactively.
         (unless erc-networks--id
           (let ((id (erc-with-server-buffer erc-networks--id))
                 (server-buffer (process-buffer erc-server-process)))
             (apply #'erc-button--display-error-notice-with-keys
                    server-buffer
                    (concat "Missing network session (ID) for %S. "
                            (if id "Using `%S' from %S." "Ignoring."))
                    (current-buffer)
                    (and id (list (erc-networks--id-symbol
                                   (setq erc-networks--id id))
                                  server-buffer)))))
         (when erc-networks--id
           (let ((oursp (if (erc--target-channel-local-p target)
                            (equal announced erc-server-announced-name)
                          (erc-networks--id-equal-p identity
                                                    erc-networks--id))))
             (funcall (if oursp on-dupe on-collision)))))))))