* wl-util.el (wl-biff-check-folders): Set `no-cache' argument of
authorteranisi <teranisi>
Wed, 19 Dec 2001 15:18:51 +0000 (15:18 +0000)
committerteranisi <teranisi>
Wed, 19 Dec 2001 15:18:51 +0000 (15:18 +0000)
wl-folder-get-elmo-folder.
(wl-biff-check-folder): Set `biff' argument of
`wl-folder-check-one-entity'.
(wl-biff-check-folder-async): Setup `biff' slot of folder.

* wl-folder.el (wl-folder-get-elmo-folder): Added `no-cache' argument.
(wl-folder-check-one-entity): Added `biff' argument;
Setup `biff' slot of folder.

* elmo.el (luna-define-class): Added `biff' slot.

* elmo-pop3.el (elmo-pop3-debug): Split biff log.
(elmo-pop3-debug-inhibit-logging): Abolished.
(elmo-network-close-session): Eliminated needless let.
(elmo-pop3-get-session): Set prefix 'BIFF' if biff folder.
(elmo-pop3-send-command): Added `no-log' argument.
(elmo-pop3-process-filter): Use `with-current-buffer'.
(elmo-pop3-auth-user): Set `no-log' argument; Delete process
if login failure.
(elmo-pop3-auth-apop): Likewise.
(elmo-network-authenticate-session): Likewise.

* elmo-nntp.el (elmo-nntp-get-session): Set prefix 'BIFF'
if biff folder.

* elmo-net.el (elmo-network-session-password-key): Use class symbol
string to determine protocol.
(elmo-network-session-name-prefix): Abolished.
(elmo-network-session-cache-key): Follow the change above.
(elmo-network-open-session): Ditto.

* elmo-imap4.el (elmo-imap4-send-command): Modified error message.
(elmo-imap4-get-session): Set prefix 'BIFF' if biff folder.

elmo/ChangeLog
elmo/elmo-imap4.el
elmo/elmo-net.el
elmo/elmo-nntp.el
elmo/elmo-pop3.el
elmo/elmo.el
wl/ChangeLog
wl/wl-folder.el
wl/wl-util.el

index e1832c6..55482af 100644 (file)
@@ -1,5 +1,30 @@
 2001-12-19  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * elmo.el (luna-define-class): Added `biff' slot.
+
+       * elmo-pop3.el (elmo-pop3-debug): Split biff log.
+       (elmo-pop3-debug-inhibit-logging): Abolished.
+       (elmo-network-close-session): Eliminated needless let.
+       (elmo-pop3-get-session): Set prefix 'BIFF' if biff folder.
+       (elmo-pop3-send-command): Added `no-log' argument.
+       (elmo-pop3-process-filter): Use `with-current-buffer'.
+       (elmo-pop3-auth-user): Set `no-log' argument; Delete process
+       if login failure.
+       (elmo-pop3-auth-apop): Likewise.
+       (elmo-network-authenticate-session): Likewise.
+
+       * elmo-nntp.el (elmo-nntp-get-session): Set prefix 'BIFF'
+       if biff folder.
+
+       * elmo-net.el (elmo-network-session-password-key): Use class symbol
+       string to determine protocol.
+       (elmo-network-session-name-prefix): Abolished.
+       (elmo-network-session-cache-key): Follow the change above.
+       (elmo-network-open-session): Ditto.
+
+       * elmo-imap4.el (elmo-imap4-send-command): Modified error message.
+       (elmo-imap4-get-session): Set prefix 'BIFF' if biff folder.
+
        * elmo-version.el (elmo-version): Up to 2.9.1.
 
        * elmo-util.el (elmo-file-field-primitive-condition-match): Fixed
index 4d5bf6a..1f35051 100644 (file)
@@ -198,7 +198,6 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"")
            (insert "NO LOGGING\n")
          (insert (apply 'format message args) "\n")))))
 
-
 (defsubst elmo-imap4-decode-folder-string (string)
   (if elmo-imap4-use-modified-utf7
       (utf7-decode-string string 'imap)
@@ -284,7 +283,7 @@ Returns a TAG string which is assigned to the COMMAND."
        (elmo-imap4-process-bye session))
       (setq elmo-imap4-current-response nil)
       (if elmo-imap4-parsing
-         (error "IMAP process is running. Please wait (or plug again.)"))
+         (error "IMAP process is running. Please wait (or plug again)"))
       (setq elmo-imap4-parsing t)
       (elmo-imap4-debug "<-(%s)- %s" tag command)
       (while (setq token (car command-args))
@@ -640,7 +639,12 @@ BUFFER must be a single-byte buffer."
                    (elmo-imap4-folder-mailbox-internal folder)))))
 
 (defun elmo-imap4-get-session (folder &optional if-exists)
-  (elmo-network-get-session 'elmo-imap4-session "IMAP" folder if-exists))
+  (elmo-network-get-session 'elmo-imap4-session
+                           (concat
+                            (if (elmo-folder-biff-internal folder)
+                                "BIFF-")
+                            "IMAP")
+                           folder if-exists))
 
 (defun elmo-imap4-session-select-mailbox (session mailbox
                                                  &optional force no-error)
index afd2fa8..6f2d6c3 100644 (file)
 
 (defsubst elmo-network-session-password-key (session)
   (format "%s:%s/%s@%s:%d"
-         (elmo-network-session-name-internal session)
+         (upcase
+          (nth 1 (split-string (symbol-name
+                                (luna-class-name session)) "[4-]")))
          (elmo-network-session-user-internal session)
          (elmo-network-session-auth-internal session)
          (elmo-network-session-server-internal session)
          (elmo-network-session-port-internal session)))
 
 (defvar elmo-network-session-cache nil)
-(defvar elmo-network-session-name-prefix nil)
 
 (defsubst elmo-network-session-cache-key (name folder)
   "Returns session cache key for NAME and FOLDER."
   (format "%s:%s/%s@%s:%d%s"
-         (concat elmo-network-session-name-prefix name)
+         name
          (elmo-net-folder-user-internal folder)
          (elmo-net-folder-auth-internal folder)
          (elmo-net-folder-server-internal folder)
@@ -212,7 +213,7 @@ Returns a process object.  if making session failed, returns nil."
                           :process nil
                           :greeting nil))
        (buffer (format " *%s session for %s@%s:%d%s"
-                       (concat elmo-network-session-name-prefix name)
+                       name
                        user
                        server
                        port
index 8cd3d60..4bbf723 100644 (file)
@@ -245,7 +245,10 @@ Don't cache if nil.")
 (defun elmo-nntp-get-session (folder &optional if-exists)
   (elmo-network-get-session
    'elmo-nntp-session
-   "NNTP"
+   (concat
+    (if (elmo-folder-biff-internal folder)
+       "BIFF-")
+    "NNTP")
    folder
    if-exists))
 
index 2af46c9..94caee7 100644 (file)
@@ -66,15 +66,15 @@ set as non-nil.")
   "Non-nil forces POP3 folder as debug mode.
 Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
 
-(defvar elmo-pop3-debug-inhibit-logging nil)
-
 ;;; Debug
 (defsubst elmo-pop3-debug (message &rest args)
   (if elmo-pop3-debug
-      (with-current-buffer (get-buffer-create "*POP3 DEBUG*")
-       (goto-char (point-max))
-       (if elmo-pop3-debug-inhibit-logging
-           (insert "NO LOGGING\n")
+      (let ((biff (string-match "BIFF-" (buffer-name)))
+           pos)
+       (with-current-buffer (get-buffer-create (concat "*POP3 DEBUG*"
+                                                       (if biff "BIFF")))
+         (goto-char (point-max))
+         (setq pos (point))
          (insert (apply 'format message args) "\n")))))
 
 ;;; ELMO POP3 folder
@@ -149,15 +149,13 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
     (when (memq (process-status
                 (elmo-network-session-process-internal session))
                '(open run))
-      (let ((buffer (process-buffer
-                    (elmo-network-session-process-internal session))))
-       (elmo-pop3-send-command (elmo-network-session-process-internal session)
-                               "quit")
-       ;; process is dead.
-       (or (elmo-pop3-read-response
-            (elmo-network-session-process-internal session)
-            t)
-           (error "POP error: QUIT failed"))))
+      (elmo-pop3-send-command (elmo-network-session-process-internal session)
+                             "quit")
+      ;; process is dead.
+      (or (elmo-pop3-read-response
+          (elmo-network-session-process-internal session)
+          t)
+         (error "POP error: QUIT failed")))
     (kill-buffer (process-buffer
                  (elmo-network-session-process-internal session)))
     (delete-process (elmo-network-session-process-internal session))))
@@ -167,15 +165,20 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
                                         nil
                                       (elmo-pop3-folder-use-uidl-internal
                                        folder))))
-    (elmo-network-get-session 'elmo-pop3-session "POP3" folder if-exists)))
-
-(defun elmo-pop3-send-command (process command &optional no-erase)
+    (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)
     (unless no-erase
       (erase-buffer))
     (goto-char (point-min))
     (setq elmo-pop3-read-point (point))
-    (elmo-pop3-debug "SEND: %s\n" command)
+    (elmo-pop3-debug "SEND: %s\n" (if no-log "<NO LOGGING>" command))
     (process-send-string process command)
     (process-send-string process "\r\n")))
 
@@ -220,8 +223,7 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
       return-value)))
 
 (defun elmo-pop3-process-filter (process output)
-  (save-excursion
-    (set-buffer (process-buffer process))
+  (with-current-buffer (process-buffer process)
     (goto-char (point-max))
     (insert output)
     (elmo-pop3-debug "RECEIVED: %s\n" output)
@@ -240,18 +242,24 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
     ;; try USER/PASS
     (elmo-pop3-send-command
      process
-     (format "user %s" (elmo-network-session-user-internal session)))
+     (format "user %s" (elmo-network-session-user-internal session))
+     nil 'no-log)
     (or (elmo-pop3-read-response process t)
-       (signal 'elmo-authenticate-error
-               '(elmo-pop-auth-user)))
+       (progn
+         (delete-process process)
+         (signal 'elmo-authenticate-error
+                 '(elmo-pop-auth-user))))
     (elmo-pop3-send-command  process
                             (format
                              "pass %s"
                              (elmo-get-passwd
-                              (elmo-network-session-password-key session))))
+                              (elmo-network-session-password-key session)))
+                            nil 'no-log)
     (or (elmo-pop3-read-response process t)
-       (signal 'elmo-authenticate-error
-               '(elmo-pop-auth-user)))))
+       (progn
+         (delete-process process)
+         (signal 'elmo-authenticate-error
+                 '(elmo-pop-auth-user))))))
 
 (defun elmo-pop3-auth-apop (session)
   (if (string-match "^\+OK .*\\(<[^\>]+>\\)"
@@ -267,12 +275,15 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
                           1
                           (elmo-network-session-greeting-internal session))
                          (elmo-get-passwd
-                          (elmo-network-session-password-key session))))))
+                          (elmo-network-session-password-key session)))))
+        nil 'no-log)
        (or (elmo-pop3-read-response
             (elmo-network-session-process-internal session)
             t)
-           (signal 'elmo-authenticate-error
-                   '(elmo-pop3-auth-apop))))
+           (progn
+             (delete-process (elmo-network-session-process-internal session))
+             (signal 'elmo-authenticate-error
+                     '(elmo-pop3-auth-apop)))))
     (signal 'elmo-open-error '(elmo-pop3-auth-apop))))
 
 (luna-define-method elmo-network-initialize-session-buffer :after
@@ -314,7 +325,6 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
   (with-current-buffer (process-buffer
                        (elmo-network-session-process-internal session))
     (let* ((process (elmo-network-session-process-internal session))
-          (elmo-pop3-debug-inhibit-logging t)
           (auth (elmo-network-session-auth-internal session))
           (auth (mapcar '(lambda (mechanism) (upcase (symbol-name mechanism)))
                         (if (listp auth) auth (list auth))))
@@ -355,7 +365,8 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
                          (concat
                           " "
                           (elmo-base64-encode-string
-                           (sasl-step-data step) 'no-line-break))))) ;)
+                           (sasl-step-data step) 'no-line-break))))
+            nil 'no-log)
            (catch 'done
              (while t
                (unless (setq response (elmo-pop3-read-response process t))
@@ -383,7 +394,7 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
                 (if (sasl-step-data step)
                     (elmo-base64-encode-string (sasl-step-data step)
                                                'no-line-break)
-                  "")))))))))
+                  "") nil 'no-log))))))))
 
 (luna-define-method elmo-network-setup-session ((session
                                                 elmo-pop3-session))
index e4bf81f..95a3f26 100644 (file)
@@ -109,6 +109,7 @@ If a folder name begins with PREFIX, use BACKEND."
                                     message-modified ; message is modified.
                                     mark-modified    ; mark is modified.
                                     process-duplicates  ; read or hide
+                                    biff   ; folder for biff
                                     ))
   (luna-define-internal-accessors 'elmo-folder))
 
index 40c08bc..13c9169 100644 (file)
@@ -1,5 +1,15 @@
 2001-12-19  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * wl-util.el (wl-biff-check-folders): Set `no-cache' argument of
+       wl-folder-get-elmo-folder.
+       (wl-biff-check-folder): Set `biff' argument of
+       `wl-folder-check-one-entity'.
+       (wl-biff-check-folder-async): Setup `biff' slot of folder.
+
+       * wl-folder.el (wl-folder-get-elmo-folder): Added `no-cache' argument.
+       (wl-folder-check-one-entity): Added `biff' argument;
+       Setup `biff' slot of folder.
+
        * Version number is increased to 2.9.1.
 
 2001-12-18  Yuuichi Teranishi  <teranisi@gohome.org>
index 9722be7..523f7b1 100644 (file)
                 (setq li (cdr li))))))))
 
 ;;; ELMO folder structure with cache.
-(defmacro wl-folder-get-elmo-folder (entity)
+(defmacro wl-folder-get-elmo-folder (entity &optional no-cache)
   "Get elmo folder structure from entity."
-  (` (or (wl-folder-elmo-folder-cache-get (, entity))
-        (let* ((name (elmo-string (, entity)))
-               (folder (elmo-make-folder name)))
-          (wl-folder-elmo-folder-cache-put name folder)
-          folder))))
+  (` (if (, no-cache)
+        (elmo-make-folder (elmo-string (, entity)))
+       (or (wl-folder-elmo-folder-cache-get (, entity))
+          (let* ((name (elmo-string (, entity)))
+                 (folder (elmo-make-folder name)))
+            (wl-folder-elmo-folder-cache-put name folder)
+            folder)))))
 
 (defmacro wl-folder-elmo-folder-cache-get (name &optional hashtb)
   "Returns a elmo folder structure associated with NAME from HASHTB.
@@ -798,12 +800,14 @@ Optional argument ARG is repeart count."
     (run-hooks 'wl-folder-check-entity-hook)
     ret-val))
 
-(defun wl-folder-check-one-entity (entity)
-  (let* ((folder (wl-folder-get-elmo-folder entity))
+(defun wl-folder-check-one-entity (entity &optional biff)
+  (let* ((folder (wl-folder-get-elmo-folder entity biff))
         (nums (condition-case err
-                  (if (wl-string-match-member entity wl-strict-diff-folders)
-                      (elmo-strict-folder-diff folder)
-                    (elmo-folder-diff folder))
+                  (progn
+                    (if biff (elmo-folder-set-biff-internal folder t))
+                    (if (wl-string-match-member entity wl-strict-diff-folders)
+                        (elmo-strict-folder-diff folder)
+                      (elmo-folder-diff folder)))
                 (error
                  ;; maybe not exist folder.
                  (if (and (not (memq 'elmo-open-error
index d591fd6..4302d29 100644 (file)
@@ -818,7 +818,7 @@ This function is imported from Emacs 20.7."
          folder)
       (if (eq (length flist) 1)
          (wl-biff-check-folder-async (wl-folder-get-elmo-folder
-                                      (car flist)) (interactive-p))
+                                      (car flist) 'biff) (interactive-p))
        (unwind-protect
            (while flist
              (setq folder (wl-folder-get-elmo-folder (car flist))
@@ -833,12 +833,8 @@ This function is imported from Emacs 20.7."
 (defun wl-biff-check-folder (folder)
   (if (eq (elmo-folder-type-internal folder) 'pop3)
       (unless (elmo-pop3-get-session folder 'if-exists)
-       ;; Currently no main pop3 process.
-       (let ((elmo-network-session-name-prefix "BIFF-"))
-         (wl-folder-check-one-entity
-          (elmo-folder-name-internal folder))))
-    (let ((elmo-network-session-name-prefix "BIFF-"))
-      (wl-folder-check-one-entity (elmo-folder-name-internal folder)))))
+       (wl-folder-check-one-entity (elmo-folder-name-internal folder)
+                                   'biff))))
 
 (defun wl-biff-check-folder-async-callback (diff data)
   (if (nth 1 data)
@@ -856,6 +852,7 @@ This function is imported from Emacs 20.7."
 
 (defun wl-biff-check-folder-async (folder notify-minibuf)
   (when (elmo-folder-plugged-p folder)
+    (elmo-folder-set-biff-internal folder t)
     (if (and (eq (elmo-folder-type-internal folder) 'imap4)
             (elmo-folder-use-flag-p folder))
        ;; Check asynchronously only when IMAP4 and use server diff.