From afa803d576eb966d7180190312c33a949459ae72 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 1 Dec 2007 03:34:03 +0000 Subject: [PATCH] (erc-server-send-ping): Move after definition of erc-server-send. --- lisp/erc/ChangeLog | 5 +++++ lisp/erc/erc-backend.el | 42 ++++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index 61757622454..376a8a60a55 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,8 @@ +2007-12-01 Glenn Morris + + * erc-backend.el (erc-server-send-ping): Move after definition of + erc-server-send. + 2007-11-30 Dan Nicolaescu * erc.el (open-ssl-stream, open-tls-stream, erc-network-name): diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 338696f37d6..c0f4205c012 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -461,27 +461,6 @@ Currently this is called by `erc-send-input'." (upcase-word 1) (buffer-string))) -(defun erc-server-send-ping (buf) - "Send a ping to the IRC server buffer in BUF. -Additionally, detect whether the IRC process has hung." - (if (buffer-live-p buf) - (with-current-buffer buf - (if (and erc-server-send-ping-timeout - (> - (erc-time-diff (erc-current-time) - erc-server-last-received-time) - erc-server-send-ping-timeout)) - (progn - ;; if the process is hung, kill it - (setq erc-server-timed-out t) - (delete-process erc-server-process)) - (erc-server-send (format "PING %.0f" (erc-current-time))))) - ;; remove timer if the server buffer has been killed - (let ((timer (assq buf erc-server-ping-timer-alist))) - (when timer - (erc-cancel-timer (cdr timer)) - (setcdr timer nil))))) - (defun erc-server-setup-periodical-ping (buffer) "Set up a timer to periodically ping the current server. The current buffer is given by BUFFER." @@ -775,6 +754,27 @@ protection algorithm." (message "ERC: No process running") nil))) +(defun erc-server-send-ping (buf) + "Send a ping to the IRC server buffer in BUF. +Additionally, detect whether the IRC process has hung." + (if (buffer-live-p buf) + (with-current-buffer buf + (if (and erc-server-send-ping-timeout + (> + (erc-time-diff (erc-current-time) + erc-server-last-received-time) + erc-server-send-ping-timeout)) + (progn + ;; if the process is hung, kill it + (setq erc-server-timed-out t) + (delete-process erc-server-process)) + (erc-server-send (format "PING %.0f" (erc-current-time))))) + ;; remove timer if the server buffer has been killed + (let ((timer (assq buf erc-server-ping-timer-alist))) + (when timer + (erc-cancel-timer (cdr timer)) + (setcdr timer nil))))) + ;; From Circe (defun erc-server-send-queue (buffer) "Send messages in `erc-server-flood-queue'. -- 2.39.2