1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

* rcirc.el (rcirc-sentinel): Use process-status

This commit is contained in:
Philip Kaludercic 2021-09-25 17:59:52 +02:00
parent a51aa94b6e
commit 35b8c42bcd

View file

@ -855,12 +855,13 @@ If QUIET is non-nil, no not emit a message."
#'rcirc-reconnect process t)))))))) #'rcirc-reconnect process t))))))))
(defun rcirc-sentinel (process sentinel) (defun rcirc-sentinel (process sentinel)
"Called when PROCESS receives SENTINEL." "Called on a change of the state of PROCESS.
(let ((sentinel (string-replace "\n" "" sentinel))) SENTINEL describes the change in form of a string."
(let ((status (process-status process)))
(rcirc-debug process (format "SENTINEL: %S %S\n" process sentinel)) (rcirc-debug process (format "SENTINEL: %S %S\n" process sentinel))
(with-rcirc-process-buffer process (with-rcirc-process-buffer process
(cond (cond
((string= sentinel "open") ((eq status 'open)
(let* ((server (nth 0 rcirc-connection-info)) (let* ((server (nth 0 rcirc-connection-info))
(user-name (nth 3 rcirc-connection-info)) (user-name (nth 3 rcirc-connection-info))
(full-name (nth 4 rcirc-connection-info)) (full-name (nth 4 rcirc-connection-info))
@ -904,7 +905,7 @@ If QUIET is non-nil, no not emit a message."
(dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist)))
(with-current-buffer (or buffer (current-buffer)) (with-current-buffer (or buffer (current-buffer))
(setq mode-line-process nil))))) (setq mode-line-process nil)))))
((string= sentinel "deleted") ((eq status 'closed)
(let ((now (current-time))) (let ((now (current-time)))
(with-rcirc-process-buffer process (with-rcirc-process-buffer process
(when (and (< 0 rcirc-reconnect-delay) (when (and (< 0 rcirc-reconnect-delay)
@ -912,7 +913,8 @@ If QUIET is non-nil, no not emit a message."
(time-subtract now rcirc-last-connect-time))) (time-subtract now rcirc-last-connect-time)))
(setq rcirc-last-connect-time now) (setq rcirc-last-connect-time now)
(rcirc-reconnect process))))) (rcirc-reconnect process)))))
((dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) ((eq status 'failed)
(dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist)))
(with-current-buffer (or buffer (current-buffer)) (with-current-buffer (or buffer (current-buffer))
(rcirc-print process "*rcirc*" "ERROR" rcirc-target (rcirc-print process "*rcirc*" "ERROR" rcirc-target
(format "%s: %s (%S)" (format "%s: %s (%S)"