Function: erc-process-away

erc-process-away is a byte-compiled function defined in erc.el.gz.

Signature

(erc-process-away PROC AWAY-P)

Documentation

Toggle the away status of the user depending on the value of AWAY-P.

If nil, set the user as away. If non-nil, return from being away.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-process-away (proc away-p)
  "Toggle the away status of the user depending on the value of AWAY-P.

If nil, set the user as away.
If non-nil, return from being away."
  (let ((sessionbuf (process-buffer proc)))
    (when sessionbuf
      (with-current-buffer sessionbuf
        (when erc-away-nickname
          (erc-log (format "erc-process-away: away-nick: %s, away-p: %s"
                           erc-away-nickname away-p))
          (erc-cmd-NICK (if away-p
                            erc-away-nickname
                          erc-nick)))
        (cond
         (away-p
          (setq erc-away (current-time)))
         (t
          (let ((away-time erc-away))
            ;; away must be set to NIL BEFORE sending anything to prevent
            ;; an infinite recursion
            (setq erc-away nil)
            (with-current-buffer (erc-active-buffer)
              (when erc-public-away-p
                (erc-send-action
                 (erc-default-target)
                 (if away-time
                     (format "is back (gone for %s)"
                             (erc-sec-to-time (erc-time-diff away-time nil)))
                   "is back")))))))))
    (erc-update-mode-line)))