From 9aafe6d35e79a7bfd17e9e82f4fe05c19b493ca7 Mon Sep 17 00:00:00 2001 From: bg66 Date: Sun, 11 Aug 2002 10:41:35 +0000 Subject: [PATCH] * liece-dcc.el (liece-dcc-dequeue-request): Do nothing when `liece-dcc-requests' is empty. (liece-command-dcc-accept): Ditto. (liece-command-dcc-chat-connect): Ditto. --- lisp/ChangeLog | 7 +++++++ lisp/liece-dcc.el | 39 +++++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aa590e3..9b238d1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2002-08-11 OHASHI Akira + + * liece-dcc.el (liece-dcc-dequeue-request): Do nothing when + `liece-dcc-requests' is empty. + (liece-command-dcc-accept): Ditto. + (liece-command-dcc-chat-connect): Ditto. + 2002-07-15 Daiki Ueno * liece-url.el (liece-url-regexp-alist): New user option. diff --git a/lisp/liece-dcc.el b/lisp/liece-dcc.el index ff384ba..ba20d6f 100644 --- a/lisp/liece-dcc.el +++ b/lisp/liece-dcc.el @@ -59,10 +59,11 @@ (inline (queue-enqueue liece-dcc-requests request)))) (defun liece-dcc-dequeue-request (&optional type) - (when (or (not type) - (eq (liece-dcc-object-type - (queue-first liece-dcc-requests)) - type)) + (when (and (not (queue-empty liece-dcc-requests)) + (or (not type) + (eq (liece-dcc-object-type + (queue-first liece-dcc-requests)) + type))) (inline (queue-dequeue liece-dcc-requests)))) (defmacro liece-dcc-add-to-process-alist (process type &rest args) @@ -261,11 +262,11 @@ (defun liece-command-dcc-chat-connect (&optional number) (interactive "P") - (let* ((object (liece-dcc-dequeue-request 'chat)) - (nick (liece-dcc-object-from object)) - process) - (if (not object) - (liece-message (_ "DCC No chat request has been arrived.")) + (if (queue-empty liece-dcc-requests) + (liece-message (_ "DCC No chat request has been arrived.")) + (let* ((object (liece-dcc-dequeue-request 'chat)) + (nick (liece-dcc-object-from object)) + process) (liece-dcc-message (_ "Connecting to: %s") nick) (setq liece-privmsg-partner nick) (setq process @@ -347,15 +348,17 @@ (defun liece-command-dcc-accept () "Dispatch one DCC request." (interactive) - (let* ((object (queue-first liece-dcc-requests)) - (type (liece-dcc-object-type object))) - (cond ((eq type 'send) - (liece-command-dcc-receive)) - ((eq type 'chat) - (liece-command-dcc-chat-connect)) - (t - (liece-message - (_ "DCC No request has been arrived.")))))) + (if (queue-empty liece-dcc-requests) + (liece-message (_ "DCC No request has been arrived.")) + (let* ((object (queue-first liece-dcc-requests)) + (type (liece-dcc-object-type object))) + (cond ((eq type 'send) + (liece-command-dcc-receive)) + ((eq type 'chat) + (liece-command-dcc-chat-connect)) + (t + (liece-message + (_ "DCC No request has been arrived."))))))) (defun liece-command-dcc-list () "List files in receive queue." -- 1.7.10.4