From 0c0b4ae7ee4c62de557d5b4e71fda6c1f5fa8ccd Mon Sep 17 00:00:00 2001 From: ueno Date: Sun, 17 Aug 2003 09:41:09 +0000 Subject: [PATCH] * riece-options.el (riece-quit-timeout): New user option. * riece-server.el (riece-quit-server-process): New function. * riece-commands.el (riece-command-quit): Use it. (riece-command-close-server): Use it. * riece-commands.el (riece-command-previous-channel): Skip nil in riece-current-channels. --- lisp/ChangeLog | 12 ++++++++++++ lisp/riece-commands.el | 13 ++++--------- lisp/riece-options.el | 5 +++++ lisp/riece-server.el | 11 +++++++++++ 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 72baf78..e2f91f6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2003-08-17 Daiki Ueno + + * riece-options.el (riece-quit-timeout): New user option. + * riece-server.el (riece-quit-server-process): New function. + * riece-commands.el (riece-command-quit): Use it. + (riece-command-close-server): Use it. + +2003-08-17 Daiki Ueno + + * riece-commands.el (riece-command-previous-channel): Skip nil in + riece-current-channels. + 2003-08-09 Daiki Ueno * riece-rdcc.el (riece-command-dcc-send): Accept output only from diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index 2c8cb1a..67d3e22 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -89,7 +89,8 @@ (start riece-current-channels) channel) (while (and start (not (eq start pointer))) - (setq channel (car start)) + (if (car start) + (setq channel (car start))) (setq start (cdr start))) (when (null channel) (setq start (copy-sequence riece-current-channels)) @@ -564,10 +565,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (riece-extended-version)))) (process-list riece-process-list)) (while process-list - (riece-process-send-string (car process-list) - (if message - (format "QUIT :%s\r\n" message) - "QUIT\r\n")) + (riece-quit-server-process (car process-list) message) (setq process-list (cdr process-list)))))) (defun riece-command-raw (command) @@ -617,10 +615,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (read-string "Message: ") (or riece-quit-message (riece-extended-version))))) - (riece-process-send-string (riece-server-process server-name) - (if message - (format "QUIT :%s\r\n" message) - "QUIT\r\n"))) + (riece-quit-server-process (riece-server-process server-name) message)) (defun riece-command-universal-server-name-argument () (interactive) diff --git a/lisp/riece-options.el b/lisp/riece-options.el index 333fd5c..e76b3bb 100644 --- a/lisp/riece-options.el +++ b/lisp/riece-options.el @@ -182,6 +182,11 @@ way is to put Riece variables on .emacs or file loaded from there." :type 'boolean :group 'riece-server) +(defcustom riece-quit-timeout 60 + "Quit timeout when there is no response from server." + :type 'integer + :group 'riece-server) + (defcustom riece-channel-buffer-mode t "When non-nil, Riece will display a channel buffer." :type 'boolean diff --git a/lisp/riece-server.el b/lisp/riece-server.el index d750824..3d6e366 100644 --- a/lisp/riece-server.el +++ b/lisp/riece-server.el @@ -217,6 +217,17 @@ the `riece-server-keyword-map' variable." (throw 'found t)) (setq process-list (cdr process-list)))))) +(defun riece-quit-server-process (process &optional message) + (run-at-time riece-quit-timeout nil + (lambda (process) + (if (memq process riece-process-list) + (kill-process (process-buffer process)))) + process) + (riece-process-send-string process + (if message + (format "QUIT :%s\r\n" message) + "QUIT\r\n"))) + (provide 'riece-server) ;;; riece-server.el ends here -- 1.7.10.4