* elmo-pop3.el (elmo-pop3-sort-overview-by-original-number): New function.
authorteranisi <teranisi>
Tue, 16 Jan 2001 08:07:41 +0000 (08:07 +0000)
committerteranisi <teranisi>
Tue, 16 Jan 2001 08:07:41 +0000 (08:07 +0000)
 (elmo-pop3-sort-msgdb-by-original-number): Ditto.
 (elmo-pop3-msgdb-create-as-numlist): Use it.

elmo/ChangeLog
elmo/elmo-pop3.el

index 53fc6e5..9311371 100644 (file)
@@ -1,5 +1,10 @@
 2001-01-16  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * elmo-pop3.el (elmo-pop3-sort-overview-by-original-number):
+       New function.
+       (elmo-pop3-sort-msgdb-by-original-number): Ditto.
+       (elmo-pop3-msgdb-create-as-numlist): Use it.
+
        * elmo-imap4.el (elmo-imap4-arrival-filter): Check process-buffer.
        (Based on the report by AMAKAWA Shuhei <sa264@cam.ac.uk>)
 
index cb4ac69..d2c18de 100644 (file)
 
 (defalias 'elmo-pop3-msgdb-create 'elmo-pop3-msgdb-create-as-numlist)
 
+(defun elmo-pop3-sort-overview-by-original-number (overview loc-alist)
+  (sort overview
+       (lambda (ent1 ent2)
+         (< (elmo-pop3-uidl-to-number
+             (cdr (assq (elmo-msgdb-overview-entity-get-number ent1)
+                        loc-alist)))
+            (elmo-pop3-uidl-to-number
+             (cdr (assq (elmo-msgdb-overview-entity-get-number ent2)
+                        loc-alist)))))))
+
+(defun elmo-pop3-sort-msgdb-by-original-number (msgdb)
+  (message "Sorting...")
+  (let ((overview (elmo-msgdb-get-overview msgdb)))
+    (setq overview (elmo-pop3-sort-overview-by-original-number
+                   overview
+                   (elmo-msgdb-get-location msgdb)))
+    (message "Sorting...done")
+    (list overview (nth 1 msgdb)(nth 2 msgdb)(nth 3 msgdb)(nth 4 msgdb))))
+
 (defun elmo-pop3-msgdb-create-as-numlist (spec numlist new-mark
                                               already-mark seen-mark
                                               important-mark seen-list
          (setq loc-alist (if msgdb (elmo-msgdb-get-location msgdb)
                            (elmo-msgdb-location-load
                             (elmo-msgdb-expand-path spec)))))
-      (elmo-msgdb-sort-by-date
-       (elmo-pop3-msgdb-create-by-header process numlist
-                                        new-mark already-mark
-                                        seen-mark seen-list
-                                        loc-alist)))))
+      (with-current-buffer (process-buffer process)
+       (elmo-pop3-sort-msgdb-by-original-number
+        (elmo-pop3-msgdb-create-by-header process numlist
+                                          new-mark already-mark
+                                          seen-mark seen-list
+                                          loc-alist))))))
 
 (defun elmo-pop3-uidl-to-number (uidl)
   (string-to-number (elmo-get-hash-val uidl