Function: erc-dcc-member

erc-dcc-member is a byte-compiled function defined in erc-dcc.el.gz.

Signature

(erc-dcc-member &rest ARGS)

Documentation

Return first matching entry in erc-dcc-list satisfying constraints in ARGS.

ARGS is a plist. Return nil on no match.

The property :nick is treated specially, if it contains a ! character, it is treated as a nick!user@host string, and compared with the :nick property value of the individual elements using string-equal. Otherwise it is compared with erc-nick-equal-p which is IRC case-insensitive.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-dcc.el.gz
;;; Misc macros and utility functions

(defun erc-dcc-member (&rest args)
  "Return first matching entry in `erc-dcc-list' satisfying constraints in ARGS.
ARGS is a plist.  Return nil on no match.

The property :nick is treated specially, if it contains a `!' character,
it is treated as a nick!user@host string, and compared with the :nick property
value of the individual elements using string-equal.  Otherwise it is
compared with `erc-nick-equal-p' which is IRC case-insensitive."
  (let ((list erc-dcc-list)
        result test)
    ;; for each element in erc-dcc-list
    (while (and list (not result))
      (let ((elt (car list))
            (prem args)
            (cont t))
        ;; loop through the constraints
        (while (and prem cont)
          (let ((prop (car prem))
                (val (cadr prem)))
            (setq prem (cddr prem)
                  test (cadr (plist-member elt prop)))
            ;; if the property exists and is equal, we continue, else, try the
            ;; next element of the list
            (or (and (eq prop :nick) (string-search "!" val)
                     test (string-equal test val))
                (and (eq prop :nick)
                     test val
                     (erc-nick-equal-p
                      (erc-extract-nick test)
                      (erc-extract-nick val)))
                ;; not a nick
                (equal test val)
                (setq cont nil))))
        (if cont
            (setq result elt)
          (setq list (cdr list)))))
    result))