* wl-summary.el (wl-summary-insert-summary): Renamed dummy argument.
authorteranisi <teranisi>
Mon, 5 Nov 2001 04:41:06 +0000 (04:41 +0000)
committerteranisi <teranisi>
Mon, 5 Nov 2001 04:41:06 +0000 (04:41 +0000)
* elmo-pop3.el (elmo-folder-initialize): Rewrite.

* elmo-imap4.el (elmo-folder-initialize): Ditto.

* elmo-nntp.el (elmo-folder-initialize): Ditto.

* elmo-multi.el (elmo-folder-initialize): Ditto.

* elmo-util.el (elmo-parse-token): New function.
(elmo-parse-prefixed-element): Ditto.

elmo/ChangeLog
elmo/elmo-imap4.el
elmo/elmo-multi.el
elmo/elmo-nntp.el
elmo/elmo-pop3.el
elmo/elmo-util.el
wl/ChangeLog
wl/wl-summary.el

index a7b9859..6d02a2e 100644 (file)
@@ -1,3 +1,16 @@
+2001-11-05  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-pop3.el (elmo-folder-initialize): Rewrite.
+
+       * elmo-imap4.el (elmo-folder-initialize): Ditto.
+
+       * elmo-nntp.el (elmo-folder-initialize): Ditto.
+
+       * elmo-multi.el (elmo-folder-initialize): Ditto.
+
+       * elmo-util.el (elmo-parse-token): New function.
+       (elmo-parse-prefixed-element): Ditto.
+
 2001-11-01  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo-imap4.el (elmo-imap4-send-command): If BYE response is detected,
index 0c2be18..25d421c 100644 (file)
@@ -1741,56 +1741,44 @@ Return nil if no complete line has arrived."
         (if elmo-imap4-stream-type-alist
             (append elmo-imap4-stream-type-alist
                     elmo-network-stream-type-alist)
-          elmo-network-stream-type-alist)))
+          elmo-network-stream-type-alist))
+       parse)
     (when (string-match "\\(.*\\)@\\(.*\\)" default-server)
       ;; case: imap4-default-server is specified like
       ;; "hoge%imap.server@gateway".
       (setq default-user (elmo-match-string 1 default-server))
       (setq default-server (elmo-match-string 2 default-server)))
     (setq name (luna-call-next-method))
-    (when (string-match
-          "^\\([^:@!]*\\)\\(:[^/!]+\\)?\\(/[^/:@!]+\\)?"
-          name)
-      (progn
-       (if (match-beginning 1)
-           (progn
-             (elmo-imap4-folder-set-mailbox-internal
-              folder
-              (elmo-imap4-encode-folder-string
-               (elmo-match-string 1 name)))
-             (if (eq (length (elmo-imap4-folder-mailbox-internal folder))
-                     0)
-                 ;; No information is specified other than folder type.
-                 (elmo-imap4-folder-set-mailbox-internal
-                  folder
-                  (elmo-imap4-encode-folder-string
-                   elmo-imap4-default-mailbox))))
-         (elmo-imap4-folder-set-mailbox-internal
-          folder
-          (elmo-imap4-encode-folder-string
-           elmo-imap4-default-mailbox)))
-       ;; Setup slots for elmo-net-folder.
-       (elmo-net-folder-set-user-internal
-        folder
-        (if (match-beginning 2)
-            (elmo-match-substring 2 name 1)
-          default-user))
-       (elmo-net-folder-set-auth-internal
-        folder
-        (if (match-beginning 3)
-            (intern (elmo-match-substring 3 name 1))
-          (or elmo-imap4-default-authenticate-type 'clear)))
-       (unless (elmo-net-folder-server-internal folder)
-         (elmo-net-folder-set-server-internal folder default-server))
-       (unless (elmo-net-folder-port-internal folder)
-         (elmo-net-folder-set-port-internal folder default-port))
-       (unless (elmo-net-folder-stream-type-internal folder)
-         (elmo-net-folder-set-stream-type-internal
-          folder
-          (elmo-get-network-stream-type
-           elmo-imap4-default-stream-type)))
-       folder))))
-
+    ;; mailbox
+    (setq parse (elmo-parse-token name ":"))
+    (elmo-imap4-folder-set-mailbox-internal folder
+                                           (elmo-imap4-encode-folder-string
+                                            (if (eq (length (car parse)) 0)
+                                                elmo-imap4-default-mailbox
+                                              (car parse))))
+    ;; user
+    (setq parse (elmo-parse-prefixed-element ?: (cdr parse) "/"))
+    (elmo-net-folder-set-user-internal folder
+                                      (if (eq (length (car parse)) 0)
+                                          default-user
+                                        (car parse)))
+    ;; auth
+    (setq parse (elmo-parse-prefixed-element ?/ (cdr parse)))
+    (elmo-net-folder-set-auth-internal
+     folder
+     (if (eq (length (car parse)) 0)
+        (or elmo-imap4-default-authenticate-type 'clear)
+       (intern (car parse))))
+    (unless (elmo-net-folder-server-internal folder)
+      (elmo-net-folder-set-server-internal folder default-server))
+    (unless (elmo-net-folder-port-internal folder)
+      (elmo-net-folder-set-port-internal folder default-port))
+    (unless (elmo-net-folder-stream-type-internal folder)
+      (elmo-net-folder-set-stream-type-internal
+       folder
+       (elmo-get-network-stream-type elmo-imap4-default-stream-type)))
+    folder))
+  
 ;;; ELMO IMAP4 folder
 (luna-define-method elmo-folder-expand-msgdb-path ((folder
                                                    elmo-imap4-folder))
index 23d5332..4a93b4d 100644 (file)
 (luna-define-method elmo-folder-initialize ((folder
                                             elmo-multi-folder)
                                            name)
-  (elmo-multi-folder-set-children-internal
-   folder
-   (mapcar 'elmo-make-folder (split-string name ",")))
+  (while (> (length (car (setq name (elmo-parse-token name ",")))) 0)
+    (elmo-multi-folder-set-children-internal
+     folder
+     (nconc (elmo-multi-folder-children-internal
+            folder)
+           (list (elmo-make-folder (car name)))))
+    (setq name (cdr name))
+    (when (and (> (length name) 0)
+              (eq (aref name 0) ?,))
+      (setq name (substring name 1))))
   (elmo-multi-folder-set-divide-number-internal
    folder
    elmo-multi-divide-number)
index f6e6035..39a7fa0 100644 (file)
             (setq elmo-network-stream-type-alist
                   (append elmo-nntp-stream-type-alist
                           elmo-network-stream-type-alist))
-          elmo-network-stream-type-alist)))
+          elmo-network-stream-type-alist))
+       parse)
     (setq name (luna-call-next-method))
-    (when (string-match
-          "^\\([^:@!]*\\)\\(:[^/!]+\\)?\\(/[^/:@!]+\\)?"
-          name)
-      (elmo-nntp-folder-set-group-internal
+    (setq parse (elmo-parse-token name ":"))
+    (elmo-nntp-folder-set-group-internal folder
+                                        (elmo-nntp-encode-group-string
+                                         (car parse)))
+    (setq parse (elmo-parse-prefixed-element ?: (cdr parse)))
+    (elmo-net-folder-set-user-internal folder
+                                      (if (eq (length (car parse)) 0)
+                                          elmo-nntp-default-user
+                                        (car parse)))
+    (unless (elmo-net-folder-server-internal folder)
+      (elmo-net-folder-set-server-internal folder 
+                                          elmo-nntp-default-server))
+    (unless (elmo-net-folder-port-internal folder)
+      (elmo-net-folder-set-port-internal folder
+                                        elmo-nntp-default-port))
+    (unless (elmo-net-folder-stream-type-internal folder)
+      (elmo-net-folder-set-stream-type-internal
        folder
-       (if (match-beginning 1)
-          (elmo-nntp-encode-group-string
-           (elmo-match-string 1 name))))
-      ;; Setup slots for elmo-net-folder
-      (elmo-net-folder-set-user-internal folder
-                                        (if (match-beginning 2)
-                                            (elmo-match-substring 2 name 1)
-                                          elmo-nntp-default-user))
-      (unless (elmo-net-folder-server-internal folder)
-       (elmo-net-folder-set-server-internal folder 
-                                            elmo-nntp-default-server))
-      (unless (elmo-net-folder-port-internal folder)
-       (elmo-net-folder-set-port-internal folder
-                                          elmo-nntp-default-port))
-      (unless (elmo-net-folder-stream-type-internal folder)
-       (elmo-net-folder-set-stream-type-internal
-        folder
-        (elmo-get-network-stream-type
-         elmo-nntp-default-stream-type)))
-      folder)))
+       (elmo-get-network-stream-type
+       elmo-nntp-default-stream-type)))
+    folder))
 
 (luna-define-method elmo-folder-expand-msgdb-path ((folder elmo-nntp-folder))
   (convert-standard-filename
index b04fd29..e210fd5 100644 (file)
@@ -90,26 +90,27 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"")
         (if elmo-pop3-stream-type-alist
             (append elmo-pop3-stream-type-alist
                     elmo-network-stream-type-alist)
-          elmo-network-stream-type-alist)))
+          elmo-network-stream-type-alist))
+       parse)
     (setq name (luna-call-next-method))
-    ;; Setup slots for elmo-net-folder
-    (when (string-match "^\\([^:/!]*\\)\\(/[^/:@!]+\\)?\\(:[^/:@!]+\\)?" name)
-      (elmo-net-folder-set-user-internal folder
-                                        (if (match-beginning 1)
-                                            (elmo-match-string 1 name)))
-      (if (eq (length (elmo-net-folder-user-internal folder)) 0)
-         (elmo-net-folder-set-user-internal folder
-                                            elmo-pop3-default-user))
-      (elmo-net-folder-set-auth-internal
-       folder
-       (if (match-beginning 2)
-          (intern (elmo-match-substring 2 name 1))
-        elmo-pop3-default-authenticate-type))
-      (elmo-pop3-folder-set-use-uidl-internal
-       folder
-       (if (match-beginning 3)
-          (string= (elmo-match-substring 3 name 1) "uidl")
-        elmo-pop3-default-use-uidl)))
+    ;; user
+    (setq parse (elmo-parse-token name "/:"))
+    (elmo-net-folder-set-user-internal folder
+                                      (if (eq (length (car parse)) 0)
+                                          elmo-pop3-default-user
+                                        (car parse)))
+    ;; auth
+    (setq parse (elmo-parse-prefixed-element ?/ (cdr parse) ":"))
+    (elmo-net-folder-set-auth-internal folder
+                                      (if (eq (length (car parse)) 0)
+                                          elmo-pop3-default-authenticate-type
+                                        (intern (downcase (car parse)))))
+    ;; uidl
+    (setq parse (elmo-parse-prefixed-element ?: (cdr parse)))
+    (elmo-pop3-folder-set-use-uidl-internal folder
+                                           (if (eq (length (car parse)) 0)
+                                               elmo-pop3-default-use-uidl
+                                             (string= (car parse) "uidl")))
     (unless (elmo-net-folder-server-internal folder)
       (elmo-net-folder-set-server-internal folder 
                                           elmo-pop3-default-server))
index ee46191..4a175fb 100644 (file)
@@ -1347,6 +1347,42 @@ But if optional argument AUTO is non-nil, DEFAULT is returned."
       (setq alist (cdr alist)))
     matches))
 
+;;; Folder parser utils.
+(defun elmo-parse-token (string &optional seps)
+  "Parse atom from STRING using SEPS as a string of separator char list."
+  (let ((len (length string))
+       (seps (and seps (string-to-char-list seps)))
+       (i 0)
+       (sep nil)
+       content c in)
+    (if (eq len 0)
+       (cons "" "")
+      (while (and (< i len) (or in (null sep)))
+       (setq c (aref string i))
+       (cond
+        ((and in (eq c ?\\))
+         (setq i (1+ i)
+               i (1+ i)
+               content (cons (aref string i) content)))
+        ((eq c ?\")
+         (setq in (not in)
+               i (1+ i)))
+        (in (setq content (cons c content)
+                  i (1+ i)))
+        ((memq c seps)
+         (setq sep c))
+        (t (setq content (cons c content)
+                 i (1+ i)))))
+      (if in (error "Parse error in quoted"))
+      (cons (if (null content) "" (char-list-to-string (nreverse content)))
+           (substring string i)))))
+
+(defun elmo-parse-prefixed-element (prefix string &optional seps)
+  (if (and (not (eq (length string) 0))
+          (eq (aref string 0) prefix))
+      (elmo-parse-token (substring string 1) seps)
+    (cons "" string)))
+
 ;;; Number set defined by OKAZAKI Tetsurou <okazaki@be.to>
 ;; 
 ;; number          ::= [0-9]+
index 1967fbc..e79d8b5 100644 (file)
@@ -1,3 +1,7 @@
+2001-11-05  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-insert-summary): Renamed dummy argument.
+
 2001-11-01  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * wl-summary.el (wl-summary-sync-update): Enclose network
index a96319d..0ec7284 100644 (file)
@@ -2702,7 +2702,7 @@ If ARG, without confirm."
     (error (ding)
           (message "Error in wl-summary-line-inserted-hook"))))
 
-(defun wl-summary-insert-summary (entity database mark-alist dummy &optional dummy)
+(defun wl-summary-insert-summary (entity database mark-alist dummy &optional dumm)
   (let ((overview-entity entity)
        summary-line msg)
     (setq msg (elmo-msgdb-overview-entity-get-number entity))