* riece-keepalive.el: New add-on.
authorueno <ueno>
Fri, 4 Feb 2005 04:34:17 +0000 (04:34 +0000)
committerueno <ueno>
Fri, 4 Feb 2005 04:34:17 +0000 (04:34 +0000)
* COMPILE (riece-modules): Add riece-keepalive.
* Makefile.am (EXTRA_DIST): Add riece-keepalive.el.

lisp/COMPILE
lisp/ChangeLog
lisp/Makefile.am
lisp/riece-keepalive.el [new file with mode: 0644]

index b3a868a..5937bbb 100644 (file)
@@ -75,7 +75,8 @@
                riece-yank
                riece-toolbar
                riece-eval
-               riece-google))))
+               riece-google
+               riece-keepalive))))
 
 (defvar riece-icons
   '(riece-command-quit
index d6ba125..d2fea93 100644 (file)
@@ -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  <bg66@koka-in.org>
 
        * riece-biff.el (riece-biff-functions): Abolish.
index 541bf63..aea0860 100644 (file)
@@ -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 (file)
index 0000000..a3148b3
--- /dev/null
@@ -0,0 +1,58 @@
+;;; riece-keepalive.el --- keep an IRC connection
+;; Copyright (C) 1998-2004 Daiki Ueno
+
+;; Author: Daiki Ueno <ueno@unixuser.org>
+;; 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