* elmo2.el (elmo-msgdb-search): Use elmo-condition-in-msgdb-p instead
authorteranisi <teranisi>
Fri, 13 Jul 2001 15:00:35 +0000 (15:00 +0000)
committerteranisi <teranisi>
Fri, 13 Jul 2001 15:00:35 +0000 (15:00 +0000)
of elmo-condition-find-key.

* elmo-util.el (elmo-condition-in-msgdb-p-internal): New function.
(elmo-condition-in-msgdb-p): Ditto.
(elmo-read-search-condition-internal): Don't set REQUIRE-MATCH argument.

elmo/ChangeLog
elmo/elmo-util.el
elmo/elmo2.el

index 6a8b2e9..95d7427 100644 (file)
@@ -1,3 +1,13 @@
+2001-07-13  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo2.el (elmo-msgdb-search): Use elmo-condition-in-msgdb-p instead
+       of elmo-condition-find-key.
+
+       * elmo-util.el (elmo-condition-in-msgdb-p-internal): New function.
+       (elmo-condition-in-msgdb-p): Ditto.
+       (elmo-read-search-condition-internal): Don't set REQUIRE-MATCH
+       argument.
+
 2001-07-05  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo-imap4.el (elmo-imap4-find-next-line): Fixed
index e509e3d..6ee19ef 100644 (file)
@@ -508,7 +508,7 @@ File content is encoded with MIME-CHARSET."
                                   "Since" "Before" "ToCc"
                                   "!From" "!Subject" "!To" "!Cc" "!Body"
                                   "!Since" "!Before" "!ToCc")
-                                elmo-msgdb-extra-fields)) nil t))
+                                elmo-msgdb-extra-fields))))
         value)
     (setq field (if (string= field "")
                    (setq field default)
@@ -1339,20 +1339,25 @@ Otherwise treat \\ in NEWTEXT string as special:
        (setq result (not result)))
     result))
 
-(defun elmo-condition-find-key-internal (condition key)
+(defun elmo-condition-in-msgdb-p-internal (condition fields)
   (cond
    ((vectorp condition)
-    (if (string= (elmo-filter-key condition) key)
+    (if (not (member (elmo-filter-key condition) fields))
        (throw 'found t)))
    ((or (eq (car condition) 'and)
        (eq (car condition) 'or))
-    (elmo-condition-find-key-internal (nth 1 condition) key)
-    (elmo-condition-find-key-internal (nth 2 condition) key))))
-
-(defun elmo-condition-find-key (condition key)
-  (catch 'found
-    (elmo-condition-find-key-internal condition key)))
-
+    (elmo-condition-in-msgdb-p-internal (nth 1 condition) fields)
+    (elmo-condition-in-msgdb-p-internal (nth 2 condition) fields))))
+
+(defun elmo-condition-in-msgdb-p (condition)
+  (not (catch 'found
+        (elmo-condition-in-msgdb-p-internal condition
+                                            (append
+                                             elmo-msgdb-extra-fields
+                                             '("last" "first" "from"
+                                               "subject" "to" "cc" "since"
+                                               "before"))))))
 (defun elmo-buffer-field-condition-match (condition number number-list)
   (cond
    ((vectorp condition)
index b018394..ae82a7e 100644 (file)
@@ -404,7 +404,7 @@ If optional UNREAD is non-nil, message is keeped as unread."
         (length (length overview))
         (i 0)
         result)
-    (if (elmo-condition-find-key condition "body")
+    (if (not (elmo-condition-in-msgdb-p condition))
        (elmo-search folder condition number-list)
       (while overview
        (if (elmo-msgdb-search-internal condition (car overview)