From: hmurata Date: Fri, 18 Nov 2005 14:38:17 +0000 (+0000) Subject: * modb-legacy.el (elmo-msgdb-append-entity): Execute the process X-Git-Tag: wl-2_15_3~38 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=cffe59cc95d3abb0cb1371218467eeb398f0fe10;p=elisp%2Fwanderlust.git * modb-legacy.el (elmo-msgdb-append-entity): Execute the process when number and message-id are non-nil. * modb-standard.el (elmo-msgdb-append-entity): Ditto. * elmo-pop3.el (elmo-pop3-auth-user): Refactoring nested conditional steatment. (elmo-pop3-auth-apop): Likewise. (elmo-network-authenticate-session): Likewise. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 81f586b..91f0b1d 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,15 @@ +2005-11-18 Hiroya Murata + + * modb-legacy.el (elmo-msgdb-append-entity): Execute the process + when number and message-id are non-nil. + + * modb-standard.el (elmo-msgdb-append-entity): Ditto. + + * elmo-pop3.el (elmo-pop3-auth-user): Refactoring nested + conditional steatment. + (elmo-pop3-auth-apop): Likewise. + (elmo-network-authenticate-session): Likewise. + 2005-11-17 Hiroya Murata * elmo-mime.el (elmo-mime-header-max-column): Set default value as diff --git a/elmo/elmo-pop3.el b/elmo/elmo-pop3.el index 06e0a04..96a18ec 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -284,7 +284,6 @@ CODE is one of the following: nil 'no-log) (setq response (elmo-pop3-read-response process t)) (unless (eq (car response) 'ok) - (delete-process process) (signal 'elmo-open-error '(elmo-pop-auth-user))) (elmo-pop3-send-command process (format @@ -293,53 +292,44 @@ CODE is one of the following: (elmo-network-session-password-key session))) nil 'no-log) (setq response (elmo-pop3-read-response process t)) - (unless (eq (car response) 'ok) - (delete-process process) - (unless (eq 'ok (car response)) - (if (or (eq (car response) 'in-use) - (eq (car response) 'login-delay)) - (error (cond ((eq (car response) 'in-use) - "Maildrop is currently in use") - ((eq (car response) 'login-delay) - "Not allowed to login \ -until the login delay period has expired"))) - (signal 'elmo-authenticate-error - '(elmo-pop-auth-user))))) + (case (car response) + (ok) + (in-use + (error "Maildrop is currently in use")) + (login-delay + (error "Not allowed to login until the login delay period has expired")) + (t + (signal 'elmo-authenticate-error '(elmo-pop-auth-user)))) (car response))) (defun elmo-pop3-auth-apop (session) - (if (string-match "^\+OK .*\\(<[^\>]+>\\)" - (elmo-network-session-greeting-internal session)) - ;; good, APOP ready server - (progn - (elmo-pop3-send-command - (elmo-network-session-process-internal session) - (format "apop %s %s" - (elmo-network-session-user-internal session) - (md5 - (concat (match-string - 1 - (elmo-network-session-greeting-internal session)) - (elmo-get-passwd - (elmo-network-session-password-key session))))) - nil 'no-log) - (let ((response (elmo-pop3-read-response - (elmo-network-session-process-internal session) - t))) - (unless (eq (car response) 'ok) - (delete-process (elmo-network-session-process-internal session)) - (unless (eq 'ok (car response)) - (if (or (eq (car response) 'in-use) - (eq (car response) 'login-delay)) - (error (cond ((eq (car response) 'in-use) - "Maildrop is currently in use") - ((eq (car response) 'login-delay) - "Not allowed to login \ -until the login delay period has expired"))) - (signal 'elmo-authenticate-error - '(elmo-pop-auth-apop))))) - (car response))) - (signal 'elmo-open-error '(elmo-pop3-auth-apop)))) + (unless (string-match "^\+OK .*\\(<[^\>]+>\\)" + (elmo-network-session-greeting-internal session)) + (signal 'elmo-open-error '(elmo-pop3-auth-apop))) + ;; good, APOP ready server + (elmo-pop3-send-command + (elmo-network-session-process-internal session) + (format "apop %s %s" + (elmo-network-session-user-internal session) + (md5 + (concat (match-string + 1 + (elmo-network-session-greeting-internal session)) + (elmo-get-passwd + (elmo-network-session-password-key session))))) + nil 'no-log) + (let ((response (elmo-pop3-read-response + (elmo-network-session-process-internal session) + t))) + (case (car response) + (ok) + (in-use + (error "Maildrop is currently in use")) + (login-delay + (error "Not allowed to login until the login delay period has expired")) + (t + (signal 'elmo-authenticate-error '(elmo-pop-auth-apop)))) + (car response))) (luna-define-method elmo-network-initialize-session-buffer :after ((session elmo-pop3-session) buffer) @@ -379,16 +369,15 @@ until the login delay period has expired"))) (elmo-network-session-process-internal session)) (let* ((process (elmo-network-session-process-internal session)) (auth (elmo-network-session-auth-internal session)) - (auth (mapcar '(lambda (mechanism) (upcase (symbol-name mechanism))) - (if (listp auth) auth (list auth)))) - sasl-mechanisms - client name step response mechanism - sasl-read-passphrase) + (auth (mapcar (lambda (mechanism) (upcase (symbol-name mechanism))) + (if (listp auth) auth (list auth))))) (or (and (string= "USER" (car auth)) (elmo-pop3-auth-user session)) (and (string= "APOP" (car auth)) (elmo-pop3-auth-apop session)) - (progn + (let (sasl-mechanisms + client name step response mechanism + sasl-read-passphrase) (require 'sasl) (setq sasl-mechanisms (mapcar 'car sasl-mechanism-alist)) (setq mechanism (sasl-find-mechanism auth)) @@ -406,10 +395,9 @@ until the login delay period has expired"))) (elmo-network-session-set-auth-internal session (intern (downcase name))) (setq sasl-read-passphrase - (function - (lambda (prompt) - (elmo-get-passwd - (elmo-network-session-password-key session))))) + (lambda (prompt) + (elmo-get-passwd + (elmo-network-session-password-key session)))) (setq step (sasl-next-step client nil)) (elmo-pop3-send-command process @@ -423,17 +411,17 @@ until the login delay period has expired"))) (catch 'done (while t (setq response (elmo-pop3-read-response process t)) - (unless (eq 'ok (car response)) - (if (or (eq (car response) 'in-use) - (eq (car response) 'login-delay)) - (error (cond ((eq (car response) 'in-use) - "Maildrop is currently in use") - ((eq (car response) 'login-delay) - "Not allowed to login \ -until the login delay period has expired"))) - (signal 'elmo-authenticate-error - (list (intern (concat "elmo-pop3-auth-" - (downcase name))))))) + (case (car response) + (ok) + (in-use + (error "Maildrop is currently in use")) + (login-delay + (error "Not allowed to login \ +until the login delay period has expired")) + (t + (signal 'elmo-authenticate-error + (list (intern (concat "elmo-pop3-auth-" + (downcase name))))))) (if (sasl-next-step client step) ;; Bogus server? (signal 'elmo-authenticate-error diff --git a/elmo/modb-legacy.el b/elmo/modb-legacy.el index 5165218..aea1c59 100644 --- a/elmo/modb-legacy.el +++ b/elmo/modb-legacy.el @@ -519,25 +519,26 @@ Return a list of message numbers which have duplicated message-ids." (let ((number (elmo-msgdb-overview-entity-get-number-internal entity)) (message-id (elmo-msgdb-overview-entity-get-id-internal entity)) mark cell) - (elmo-msgdb-set-overview - msgdb - (nconc (elmo-msgdb-get-overview msgdb) - (list entity))) - (elmo-msgdb-set-number-alist - msgdb - (nconc (elmo-msgdb-get-number-alist msgdb) - (list (cons number message-id)))) - (modb-generic-set-message-modified-internal msgdb t) - (when (setq mark (modb-legacy-flags-to-mark flags)) - (setq cell (list number mark)) - (elmo-msgdb-set-mark-alist + (when (and number message-id) + (elmo-msgdb-set-overview msgdb - (nconc (elmo-msgdb-get-mark-alist msgdb) (list cell))) - (modb-generic-set-flag-modified-internal msgdb t)) - (elmo-msgdb-make-index - msgdb - (list entity) - (and cell (list cell)))))) + (nconc (elmo-msgdb-get-overview msgdb) + (list entity))) + (elmo-msgdb-set-number-alist + msgdb + (nconc (elmo-msgdb-get-number-alist msgdb) + (list (cons number message-id)))) + (modb-generic-set-message-modified-internal msgdb t) + (when (setq mark (modb-legacy-flags-to-mark flags)) + (setq cell (list number mark)) + (elmo-msgdb-set-mark-alist + msgdb + (nconc (elmo-msgdb-get-mark-alist msgdb) (list cell))) + (modb-generic-set-flag-modified-internal msgdb t)) + (elmo-msgdb-make-index + msgdb + (list entity) + (and cell (list cell))))))) (luna-define-method elmo-msgdb-delete-messages ((msgdb modb-legacy) numbers) diff --git a/elmo/modb-standard.el b/elmo/modb-standard.el index 8f44be8..1ecfcd6 100644 --- a/elmo/modb-standard.el +++ b/elmo/modb-standard.el @@ -478,7 +478,7 @@ (msg-id (elmo-msgdb-message-entity-field (elmo-message-entity-handler entity) entity 'message-id)) duplicate) - (when msg-id + (when (and number msg-id) ;; number-list (modb-standard-set-number-list-internal msgdb