* elmo-pop3.el (elmo-pop3-exists-exactly): Set default value as nil.
authorteranisi <teranisi>
Tue, 22 Jul 2003 13:36:55 +0000 (13:36 +0000)
committerteranisi <teranisi>
Tue, 22 Jul 2003 13:36:55 +0000 (13:36 +0000)
(elmo-pop3-get-session): Make msgdb directory after session.
(elmo-folder-exists-p): Check exactly at the first time even when the
elmo-pop3-exists-exactly is nil.

* elmo-pipe.el (elmo-folder-open-internal): Don't drain here.
(elmo-folder-list-messages): Define instead of
elmo-folder-list-messages-internal.
(elmo-folder-check): Check destination folder.
(elmo-folder-synchronize): Drain the pipe.

* elmo-localdir.el (elmo-folder-append-messages): Don't cause an error
when msgdb is not loaded.

elmo/ChangeLog
elmo/elmo-localdir.el
elmo/elmo-pipe.el
elmo/elmo-pop3.el

index dc8148a..dc83a66 100644 (file)
@@ -1,5 +1,19 @@
 2003-07-22  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * elmo-pop3.el (elmo-pop3-exists-exactly): Set default value as nil.
+       (elmo-pop3-get-session): Make msgdb directory after session.
+       (elmo-folder-exists-p): Check exactly at the first time even when the
+       elmo-pop3-exists-exactly is nil.
+
+       * elmo-pipe.el (elmo-folder-open-internal): Don't drain here.
+       (elmo-folder-list-messages): Define instead of
+       elmo-folder-list-messages-internal.
+       (elmo-folder-check): Check destination folder.
+       (elmo-folder-synchronize): Drain the pipe.
+
+       * elmo-localdir.el (elmo-folder-append-messages): Don't cause an error
+       when msgdb is not loaded.
+
        * elmo-msgdb.el (elmo-msgdb-append-to-killed-list): Abolish.
 
        * elmo-imap4.el (elmo-folder-list-messages-plugged): Fixed.
index 780031b..4ed3d22 100644 (file)
            (table (elmo-flag-table-load (elmo-folder-msgdb-path folder)))
            (succeeds numbers)
            (next-num (1+ (car (elmo-folder-status folder))))
-           mark flag)
+           mark flag id)
        (while numbers
          (setq mark (elmo-message-mark src-folder (car numbers))
                flag (cond
            (int-to-string
             (if same-number (car numbers) next-num))
            dir))
-         (elmo-flag-table-set table
-                              (elmo-message-field
-                               src-folder (car numbers)
-                               'message-id)
-                              flag)
+         ;; src folder's msgdb is loaded.
+         (when (setq id (elmo-message-field src-folder (car numbers)
+                                            'message-id))
+           (elmo-flag-table-set table id flag))
          (elmo-progress-notify 'elmo-folder-move-messages)
          (if (and (setq numbers (cdr numbers))
                   (not same-number))
index cc9a2d5..4c22abe 100644 (file)
    copied-list))
 
 (luna-define-method elmo-folder-open-internal ((folder elmo-pipe-folder))
-  (elmo-folder-open-internal (elmo-pipe-folder-dst-internal folder))
-  (let ((src-folder (elmo-pipe-folder-src-internal folder))
-       (dst-folder (elmo-pipe-folder-dst-internal folder)))
-    (when (and (elmo-folder-plugged-p src-folder)
-              (elmo-folder-plugged-p dst-folder))
-      (if (elmo-pipe-folder-copy-internal folder)
-         (elmo-pipe-folder-copied-list-save
-          folder
-          (elmo-pipe-drain src-folder
-                           dst-folder
-                           'copy
-                           (elmo-pipe-folder-copied-list-load folder)))
-       (elmo-pipe-drain src-folder dst-folder)))))
+  (elmo-folder-open-internal (elmo-pipe-folder-dst-internal folder)))
 
 (luna-define-method elmo-folder-close-internal ((folder elmo-pipe-folder))
   (elmo-folder-close-internal(elmo-pipe-folder-dst-internal folder)))
 
-(luna-define-method elmo-folder-list-messages-internal
-  ((folder elmo-pipe-folder) &optional nohide)
-  (elmo-folder-list-messages-internal (elmo-pipe-folder-dst-internal
-                                      folder) nohide))
+(luna-define-method elmo-folder-list-messages ((folder elmo-pipe-folder)
+                                              &optional visible-only in-msgdb)
+  ;; Use target folder's killed-list in the pipe folder.
+  (elmo-folder-list-messages (elmo-pipe-folder-dst-internal
+                             folder) visible-only in-msgdb))
 
 (luna-define-method elmo-folder-list-unreads ((folder elmo-pipe-folder))
   (elmo-folder-list-unreads (elmo-pipe-folder-dst-internal folder)))
   (elmo-message-use-cache-p (elmo-pipe-folder-dst-internal folder) number))
 
 (luna-define-method elmo-folder-check ((folder elmo-pipe-folder))
-  (elmo-folder-close-internal folder)
-  (elmo-folder-open-internal folder))
+  (elmo-folder-check (elmo-pipe-folder-dst-internal folder)))
 
 (luna-define-method elmo-folder-plugged-p ((folder elmo-pipe-folder))
   (and (elmo-folder-plugged-p (elmo-pipe-folder-src-internal folder))
 (luna-define-method elmo-folder-synchronize ((folder elmo-pipe-folder)
                                             &optional ignore-msgdb
                                             no-check)
+  (let ((src-folder (elmo-pipe-folder-src-internal folder))
+       (dst-folder (elmo-pipe-folder-dst-internal folder)))
+    (when (and (elmo-folder-plugged-p src-folder)
+              (elmo-folder-plugged-p dst-folder))
+      (if (elmo-pipe-folder-copy-internal folder)
+         (elmo-pipe-folder-copied-list-save
+          folder
+          (elmo-pipe-drain src-folder
+                           dst-folder
+                           'copy
+                           (elmo-pipe-folder-copied-list-load folder)))
+       (elmo-pipe-drain src-folder dst-folder))))
   (elmo-folder-synchronize
    (elmo-pipe-folder-dst-internal folder) ignore-msgdb no-check))
 
index 0d9c9d7..201c670 100644 (file)
 If server doesn't accept asynchronous commands, this variable should be
 set as non-nil.")
 
-(defvar elmo-pop3-exists-exactly t)
+(defcustom elmo-pop3-exists-exactly nil
+  "If non-nil, POP3 folder existence is checked everytime before the session."
+  :type 'boolean
+  :group 'elmo)
+
 (defvar sasl-mechanism-alist)
 
 (defvar elmo-pop3-total-size nil)
@@ -168,19 +172,23 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists."
                                         nil
                                       (elmo-pop3-folder-use-uidl-internal
                                        folder))))
-    (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))))
+    (prog1
+       (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))
+      ;; For saving existency.
+      (unless (file-exists-p (elmo-folder-msgdb-path folder))
+       (elmo-make-directory (elmo-folder-msgdb-path folder))))))
 
 (defun elmo-pop3-send-command (process command &optional no-erase no-log)
   (with-current-buffer (process-buffer process)
@@ -469,7 +477,11 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists."
              (setq session (elmo-pop3-get-session folder))
            (if session
                (elmo-network-close-session session)))))
-    (file-directory-p (elmo-folder-msgdb-path folder))))
+    (or (file-directory-p (elmo-folder-msgdb-path folder))
+       ;; First time.
+       (when (elmo-folder-plugged-p folder)
+         (let ((elmo-pop3-exists-exactly t))
+           (elmo-folder-exists-p folder))))))
 
 (defun elmo-pop3-parse-uidl-response (string)
   (let ((buffer (current-buffer))