Function: erc-cmd-IDLE

erc-cmd-IDLE is a byte-compiled function defined in erc.el.gz.

Signature

(erc-cmd-IDLE NICK)

Documentation

Show the length of time NICK has been idle.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-cmd-IDLE (nick)
  "Show the length of time NICK has been idle."
  (let ((origbuf (current-buffer))
        symlist)
    (erc-with-server-buffer
      (push (cons (erc-once-with-server-event
                   311 (lambda (_proc parsed)
                         (string= nick
                                  (nth 1 (erc-response.command-args
                                          parsed)))))
                  'erc-server-311-functions)
            symlist)
      (push (cons (erc-once-with-server-event
                   312 (lambda (_proc parsed)
                         (string= nick
                                  (nth 1 (erc-response.command-args
                                          parsed)))))
                  'erc-server-312-functions)
            symlist)
      (push (cons (erc-once-with-server-event
                   318 (lambda (_proc parsed)
                         (string= nick
                                  (nth 1 (erc-response.command-args
                                          parsed)))))
                  'erc-server-318-functions)
            symlist)
      (push (cons (erc-once-with-server-event
                   319 (lambda (_proc parsed)
                         (string= nick
                                  (nth 1 (erc-response.command-args
                                          parsed)))))
                  'erc-server-319-functions)
            symlist)
      (push (cons (erc-once-with-server-event
                   320 (lambda (_proc parsed)
                         (string= nick
                                  (nth 1 (erc-response.command-args
                                          parsed)))))
                  'erc-server-320-functions)
            symlist)
      (push (cons (erc-once-with-server-event
                   330 (lambda (_proc parsed)
                         (string= nick
                                  (nth 1 (erc-response.command-args
                                          parsed)))))
                  'erc-server-330-functions)
            symlist)
      (push (cons (erc-once-with-server-event
                   317
                   (lambda (_proc parsed)
                     (let ((idleseconds
                            (string-to-number
                             (cl-third
                              (erc-response.command-args parsed)))))
                       (erc-display-line
                        (erc-make-notice
                         (format "%s has been idle for %s."
                                 (erc-string-no-properties nick)
                                 (erc-seconds-to-string idleseconds)))
                        origbuf)
                       t)))
                  'erc-server-317-functions)
            symlist)

      ;; Send the WHOIS command.
      (erc-cmd-WHOIS nick)

      ;; Remove the uninterned symbols from the server hooks that did not run.
      (run-at-time 20 nil (lambda (buf symlist)
                            (with-current-buffer buf
                              (dolist (sym symlist)
                                (let ((hooksym (cdr sym))
                                      (funcsym (car sym)))
                                  (remove-hook hooksym funcsym t)))))
                   (current-buffer) symlist)))
  t)