# HG changeset patch # User Glenn Morris # Date 1196480036 0 # Node ID 1c029f7433b552a95191e5681c362b2d4db36080 # Parent bb60c896c5d24ef3d7e2bff9f75f0cce93c4db2c (erc-server-send-ping): Move after definition of erc-server-send. diff -r bb60c896c5d2 -r 1c029f7433b5 lisp/erc/erc-backend.el --- a/lisp/erc/erc-backend.el Sat Dec 01 03:24:39 2007 +0000 +++ b/lisp/erc/erc-backend.el Sat Dec 01 03:33:56 2007 +0000 @@ -461,27 +461,6 @@ (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 @@ (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'.