From: ueno Date: Fri, 4 Feb 2005 04:34:17 +0000 (+0000) Subject: * riece-keepalive.el: New add-on. X-Git-Tag: riece-1_0_7~40 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=91579173bb6e98d5082caca2fcef080748ff6fb6;p=elisp%2Friece.git * riece-keepalive.el: New add-on. * COMPILE (riece-modules): Add riece-keepalive. * Makefile.am (EXTRA_DIST): Add riece-keepalive.el. --- diff --git a/lisp/COMPILE b/lisp/COMPILE index b3a868a..5937bbb 100644 --- a/lisp/COMPILE +++ b/lisp/COMPILE @@ -75,7 +75,8 @@ riece-yank riece-toolbar riece-eval - riece-google)))) + riece-google + riece-keepalive)))) (defvar riece-icons '(riece-command-quit diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d6ba125..d2fea93 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,10 @@ * riece-log.el (riece-log-enable): Add debug message. + * riece-keepalive.el: New add-on. + * COMPILE (riece-modules): Add riece-keepalive. + * Makefile.am (EXTRA_DIST): Add riece-keepalive.el. + 2005-02-04 OHASHI Akira * riece-biff.el (riece-biff-functions): Abolish. diff --git a/lisp/Makefile.am b/lisp/Makefile.am index 541bf63..aea0860 100644 --- a/lisp/Makefile.am +++ b/lisp/Makefile.am @@ -15,7 +15,8 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \ riece-menu.el riece-icon.el riece-async.el riece-lsdb.el \ riece-xface.el riece-ctlseq.el riece-ignore.el riece-hangman.el \ riece-biff.el riece-kakasi.el riece-foolproof.el riece-yank.el \ - riece-toolbar.el riece-eval.el riece-google.el url-riece.el \ + riece-toolbar.el riece-eval.el riece-google.el riece-keepalive.el \ + url-riece.el \ riece-command-quit.xpm riece-command-previous-channel.xpm \ riece-command-next-channel.xpm riece-submit-bug-report.xpm diff --git a/lisp/riece-keepalive.el b/lisp/riece-keepalive.el new file mode 100644 index 0000000..a3148b3 --- /dev/null +++ b/lisp/riece-keepalive.el @@ -0,0 +1,58 @@ +;;; riece-keepalive.el --- keep an IRC connection +;; Copyright (C) 1998-2004 Daiki Ueno + +;; Author: Daiki Ueno +;; Created: 1998-09-28 +;; Keywords: IRC, riece + +;; This file is part of Riece. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; To use, add the following line to your ~/.riece/init.el: +;; (add-to-list 'riece-addons 'riece-keepalive) + +;;; Code: + +(defvar riece-keepalive-ping-repeat 120) +(defvar riece-keepalive-timer nil) + +(defun riece-keepalive-after-login-hook () + (make-local-variable 'riece-keepalive-timer) + (unless riece-keepalive-timer + (setq riece-keepalive-timer + (riece-run-at-time + riece-keepalive-ping-repeat riece-keepalive-ping-repeat + (lambda (buffer) + (save-excursion + (set-buffer buffer) + (riece-send-string "PING riece-keepalive\r\n"))) + (current-buffer))))) + +(defun riece-keepalive-after-close-hook () + (when riece-keepalive-timer + (riece-cancel-timer riece-keepalive-timer) + (setq riece-keepalive-timer nil))) + +(defun riece-keepalive-insinuate () + (add-hook 'riece-after-login-hook #'riece-keepalive-after-login-hook) + (add-hook 'riece-after-close-hook #'riece-keepalive-after-close-hook)) + +(provide 'riece-keepalive) + +;;; riece-ignore.el ends here