Synch up with main trunk.
[elisp/wanderlust.git] / elmo / elmo-pop3.el
index 9c7dc63..9c98ac3 100644 (file)
@@ -161,16 +161,26 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
     (delete-process (elmo-network-session-process-internal session))))
 
 (defun elmo-pop3-get-session (folder &optional if-exists)
+  "Get POP3 session for FOLDER.
+If IF-EXISTS is non-nil, don't get new session.
+If IF-EXISTS is `any-exists', get BIFF session or normal session if exists."
   (let ((elmo-pop3-use-uidl-internal (if elmo-inhibit-number-mapping
                                         nil
                                       (elmo-pop3-folder-use-uidl-internal
                                        folder))))
-    (elmo-network-get-session 'elmo-pop3-session
-                             (concat
-                              (if (elmo-folder-biff-internal folder)
-                                  "BIFF-")
-                              "POP3")
-                             folder if-exists)))
+    (if (eq if-exists 'any-exists)
+       (or (elmo-network-get-session 'elmo-pop3-session
+                                     "POP3"
+                                     folder if-exists)
+           (elmo-network-get-session 'elmo-pop3-session
+                                     "BIFF-POP3"
+                                     folder if-exists))
+      (elmo-network-get-session 'elmo-pop3-session
+                               (concat
+                                (if (elmo-folder-biff-internal folder)
+                                    "BIFF-")
+                                "POP3")
+                               folder if-exists))))
 
 (defun elmo-pop3-send-command (process command &optional no-erase no-log)
   (with-current-buffer (process-buffer process)
@@ -458,7 +468,7 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
              (setq session (elmo-pop3-get-session folder))
            (if session
                (elmo-network-close-session session)))))
-    t))
+    (file-directory-p (elmo-folder-msgdb-path folder))))
 
 (defun elmo-pop3-parse-uidl-response (string)
   (let ((buffer (current-buffer))
@@ -576,7 +586,7 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
       (elmo-pop3-list-by-uidl-subr folder)
     (elmo-pop3-list-by-list folder)))
 
-(luna-define-method elmo-folder-list-messages-internal
+(luna-define-method elmo-folder-list-messages-plugged
   ((folder elmo-pop3-folder) &optional nohide)
   (elmo-pop3-folder-list-messages folder))
 
@@ -666,9 +676,7 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
       (copy-to-buffer tobuffer (point-min) (point-max)))))
 
 (luna-define-method elmo-folder-msgdb-create ((folder elmo-pop3-folder)
-                                             numlist new-mark
-                                             already-mark seen-mark
-                                             important-mark seen-list)
+                                             numlist seen-list)
   (let ((process (elmo-network-session-process-internal
                  (elmo-pop3-get-session folder))))
     (with-current-buffer (process-buffer process)
@@ -677,8 +685,7 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
        (elmo-pop3-msgdb-create-by-header
        process
        numlist
-       new-mark already-mark
-       seen-mark seen-list
+       seen-list
        (if (elmo-pop3-folder-use-uidl-internal folder)
            (elmo-pop3-folder-location-alist-internal folder)))))))
 
@@ -716,8 +723,6 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
                     elmo-pop3-size-hash))
 
 (defun elmo-pop3-msgdb-create-by-header (process numlist
-                                                new-mark already-mark
-                                                seen-mark
                                                 seen-list
                                                 loc-alist)
   (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*")))
@@ -738,14 +743,13 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
           process
           (length numlist)
           numlist
-          new-mark already-mark seen-mark seen-list loc-alist)
+          seen-list loc-alist)
        (kill-buffer tmp-buffer)))))
 
 (defun elmo-pop3-msgdb-create-message (buffer
                                       process
                                       num
-                                      numlist new-mark already-mark
-                                      seen-mark
+                                      numlist
                                       seen-list
                                       loc-alist)
   (save-excursion
@@ -796,11 +800,11 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
                                       (elmo-file-cache-get message-id))
                                      (if seen
                                          nil
-                                       already-mark)
+                                       elmo-msgdb-unread-cached-mark)
                                    (if seen
                                        (if elmo-pop3-use-cache
-                                           seen-mark)
-                                     new-mark))))
+                                           elmo-msgdb-read-uncached-mark)
+                                     elmo-msgdb-new-mark))))
                  (setq mark-alist
                        (elmo-msgdb-mark-append
                         mark-alist
@@ -879,7 +883,7 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
          (elmo-display-progress
           'elmo-display-retrieval-progress
           "Retrieving..." 100)  ; remove progress bar.
-         (message "Retrieving...done."))
+         (message "Retrieving...done"))
        (set-buffer outbuf)
        (goto-char (point-min))
        (while (re-search-forward "^\\." nil t)