From: teranisi Date: Fri, 15 Jun 2001 03:34:38 +0000 (+0000) Subject: * elmo-pop3.el (elmo-pop3-debug): New variable. X-Git-Tag: wl-2_6-root~3 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=79cf50712898f5a7db4e2cf627b28caa8b451a5b;p=elisp%2Fwanderlust.git * elmo-pop3.el (elmo-pop3-debug): New variable. (elmo-pop3-debug-inhibit-logging): Ditto. (elmo-pop3-debug): New function. (elmo-pop3-send-command): Call elmo-pop3-debug. (elmo-pop3-read-response): Added keep-lock optional argument; Don't unlock if keep-lock is non-nil. (elmo-pop3-process-filter): Call elmo-pop3-debug. (elmo-network-authenticate-session): Bind elmo-pop3-debug-inhibit-logging as t. (elmo-network-setup-session): Call elmo-pop3-read-response with keep-lock argument. (elmo-pop3-read-msg): Ditto. (elmo-pop3-locked-p): Call elmo-pop3-debug. (elmo-pop3-read-body): Call elmo-pop3-unlock. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 73becaf..cade251 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,20 @@ +2001-06-15 Yuuichi Teranishi + + * elmo-pop3.el (elmo-pop3-debug): New variable. + (elmo-pop3-debug-inhibit-logging): Ditto. + (elmo-pop3-debug): New function. + (elmo-pop3-send-command): Call elmo-pop3-debug. + (elmo-pop3-read-response): Added keep-lock optional argument; + Don't unlock if keep-lock is non-nil. + (elmo-pop3-process-filter): Call elmo-pop3-debug. + (elmo-network-authenticate-session): Bind + elmo-pop3-debug-inhibit-logging as t. + (elmo-network-setup-session): Call elmo-pop3-read-response with + keep-lock argument. + (elmo-pop3-read-msg): Ditto. + (elmo-pop3-locked-p): Call elmo-pop3-debug. + (elmo-pop3-read-body): Call elmo-pop3-unlock. + 2001-06-13 Yuuichi Teranishi * elmo-pop3.el (elmo-pop3-lock): New buffer local variable. diff --git a/elmo/elmo-pop3.el b/elmo/elmo-pop3.el index acf13cc..3bd9729 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -45,6 +45,22 @@ (defvar elmo-pop3-total-size nil) +;; For debugging. +(defvar elmo-pop3-debug nil + "Non-nil forces POP3 folder as debug mode. +Debug information is inserted in the buffer \"*POP3 DEBUG*\"") + +(defvar elmo-pop3-debug-inhibit-logging nil) + +;;; Debug +(defsubst elmo-pop3-debug (message &rest args) + (if elmo-pop3-debug + (with-current-buffer (get-buffer-create "*POP3 DEBUG*") + (goto-char (point-max)) + (if elmo-pop3-debug-inhibit-logging + (insert "NO LOGGING\n") + (insert (apply 'format message args) "\n"))))) + (luna-define-class elmo-pop3-session (elmo-network-session)) ;; buffer-local @@ -96,10 +112,11 @@ (goto-char (point-min)) (setq elmo-pop3-read-point (point)) (elmo-pop3-lock) + (elmo-pop3-debug "SEND: %s\n" command) (process-send-string process command) (process-send-string process "\r\n"))) -(defun elmo-pop3-read-response (process &optional not-command) +(defun elmo-pop3-read-response (process &optional not-command keep-lock) (with-current-buffer (process-buffer process) (let ((case-fold-search nil) (response-string nil) @@ -136,7 +153,8 @@ (concat return-value "\n" response-string) response-string))) (setq elmo-pop3-read-point match-end))) - (elmo-pop3-unlock) + (unless keep-lock + (elmo-pop3-unlock)) return-value))) (defun elmo-pop3-process-filter (process output) @@ -144,6 +162,7 @@ (set-buffer (process-buffer process)) (goto-char (point-max)) (insert output) + (elmo-pop3-debug "RECEIVED: %s\n" output) (if elmo-pop3-total-size (message "Retrieving...(%d/%d bytes)." (buffer-size) elmo-pop3-total-size)))) @@ -227,6 +246,7 @@ (with-current-buffer (process-buffer (elmo-network-session-process-internal session)) (let* ((process (elmo-network-session-process-internal session)) + (elmo-pop3-debug-inhibit-logging t) (auth (elmo-network-session-auth-internal session)) (auth (mapcar '(lambda (mechanism) (upcase (symbol-name mechanism))) (if (listp auth) auth (list auth)))) @@ -305,7 +325,7 @@ (setq elmo-pop3-size-hash (elmo-make-hash 31)) ;; To get obarray of uidl and size (elmo-pop3-send-command process "list") - (if (null (elmo-pop3-read-response process)) + (if (null (elmo-pop3-read-response process nil 'keep-lock)) (error "POP LIST command failed")) (if (null (setq response (elmo-pop3-read-contents @@ -319,7 +339,7 @@ (setq elmo-pop3-number-uidl-hash (elmo-make-hash (* count 2))) ;; UIDL (elmo-pop3-send-command process "uidl") - (unless (elmo-pop3-read-response process) + (unless (elmo-pop3-read-response process nil 'keep-lock) (error "POP UIDL failed")) (unless (setq response (elmo-pop3-read-contents (current-buffer) process)) @@ -496,7 +516,11 @@ (defun elmo-pop3-locked-p (process) "Return t if pop3 PROCESS is locked." (with-current-buffer (process-buffer process) - elmo-pop3-lock)) + (if elmo-pop3-lock + (progn + (elmo-pop3-debug "POP3 is LOCKED!") + t) + nil))) (defun elmo-pop3-retrieve-headers (buffer tobuffer process articles) (save-excursion @@ -706,6 +730,7 @@ (accept-process-output process) (goto-char start)) (setq end (point)) + (elmo-pop3-unlock) (with-current-buffer outbuf (erase-buffer) (insert-buffer-substring (process-buffer process) start (- end 3)) @@ -739,7 +764,7 @@ (unwind-protect (progn (when (null (setq response (elmo-pop3-read-response - process t))) + process t 'keep-lock))) (error "Fetching message failed")) (setq response (elmo-pop3-read-body process outbuf))) (setq elmo-pop3-total-size nil))