From: vitaly Date: Fri, 15 Jan 2010 14:11:06 +0000 (+0000) Subject: Implement partial UIDs update for IMAP X-Git-Tag: elmo-imap4-compliance-root~22 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6a61bccbe09f078910368fe738a0b3a1a3e28bf;p=elisp%2Fwanderlust.git Implement partial UIDs update for IMAP --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index e865f68..a5816c2 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -8,6 +8,10 @@ elmo-imap4-read-response elmo-imap4-read-untagged elmo-imap4-arrival-filter elmo-imap4-parse-response): Change logging format. + * elmo-imap4.el (elmo-folder-list-messages-plugged, + elmo-imap4-folder-list-range, elmo-folder-open): Don't ask server + for full uid range on folder entering, retrieve updates only for + newly appeared messages. 2010-01-05 TAKAHASHI Kaoru diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 73abf31..3b94ad7 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -1969,22 +1969,37 @@ Return nil if no complete line has arrived." (elmo-msgdb-killed-list-length killed)) (elmo-imap4-response-value status 'messages))))) +(defun elmo-imap4-folder-list-range (folder min max) + (elmo-imap4-list + folder + (concat + (let ((killed + (elmo-folder-killed-list-internal + folder))) + (if (and killed + (eq (length killed) 1) + (consp (car killed)) + (eq (car (car killed)) 1)) +;; What about elmo-imap4-use-uid? + (format "uid %d:%s" (cdr (car killed)) max) + (format "uid %s:%s" min max))) + " undeleted"))) + (luna-define-method elmo-folder-list-messages-plugged ((folder - elmo-imap4-folder) - &optional - enable-killed) - (elmo-imap4-list folder - (concat - (let ((killed - (elmo-folder-killed-list-internal - folder))) - (if (and killed - (eq (length killed) 1) - (consp (car killed)) - (eq (car (car killed)) 1)) - (format "uid %d:*" (cdr (car killed))) - "all")) - " undeleted"))) + elmo-imap4-folder) + &optional + enable-killed) + + (let* ((old (elmo-msgdb-list-messages (elmo-folder-msgdb folder))) + (new (elmo-imap4-folder-list-range folder + (1+ (or (elmo-folder-get-info-max folder) 0)) "*")) + (united-old-new (elmo-union old new))) + (if (= (length united-old-new) (or (elmo-folder-get-info-length folder) 0)) + united-old-new + (elmo-union new + (elmo-imap4-folder-list-range + folder + 1 (1+ (or (elmo-folder-get-info-max folder) 0))))))) (luna-define-method elmo-folder-list-flagged-plugged ((folder elmo-imap4-folder) flag) @@ -2544,6 +2559,9 @@ If optional argument REMOVE is non-nil, remove FLAG." (setq response (elmo-imap4-read-response session tag)))) (progn + (let ((exists (assq 'exists response))) ; update message count, + (when exists ; so merge update can go + (elmo-folder-set-info-hashtb folder nil (cadr exists)))) (elmo-imap4-session-set-current-mailbox-internal session mailbox) (elmo-imap4-session-set-read-only-internal