* elmo-util.el (elmo-string-member-ignore-case): New function.
authorkaoru <kaoru>
Sun, 15 Jun 2003 14:30:22 +0000 (14:30 +0000)
committerkaoru <kaoru>
Sun, 15 Jun 2003 14:30:22 +0000 (14:30 +0000)
* elmo-imap4.el (elmo-imap4-response-get-selectable-mailbox-list): Use i
t.
(elmo-imap4-fetch-callback-1-subr): Likewise.

elmo/ChangeLog
elmo/elmo-imap4.el
elmo/elmo-util.el

index b8a54a4..92cafb2 100644 (file)
@@ -1,5 +1,9 @@
 2003-06-15  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
+       * elmo-util.el (elmo-string-member-ignore-case): New function.
+       * elmo-imap4.el (elmo-imap4-response-get-selectable-mailbox-list): Use it.
+       (elmo-imap4-fetch-callback-1-subr): Likewise.
+
        * acap.el, elmo-imap4.el, elmo-nntp.el, elmo-util.el, pldap.el:
        `message' and `error' take format string.
 
index 1dacabe..b056019 100644 (file)
@@ -607,7 +607,7 @@ BUFFER must be a single-byte buffer."
        (mapcar
         (lambda (entry)
           (if (and (eq 'list (car entry))
-                   (not (member "\\NoSelect" (nth 1 (nth 1 entry)))))
+                   (not (elmo-string-member-ignore-case "\\Noselect" (nth 1 (nth 1 entry)))))
               (car (nth 1 entry))))
         response)))
 
@@ -780,10 +780,10 @@ If CHOP-LENGTH is not specified, message set is not chopped."
         (app-data (car app-data))
         (seen (member (car entity) (nth 4 app-data)))
         mark)
-    (if (member "\\Flagged" flags)
+    (if (elmo-string-member-ignore-case "\\Flagged" flags)
        (elmo-msgdb-global-mark-set (car entity) (nth 3 app-data)))
     (if (setq mark (elmo-msgdb-global-mark-get (car entity)))
-       (unless (member "\\Seen" flags)
+       (unless (elmo-string-member-ignore-case "\\Seen" flags)
          (setq elmo-imap4-seen-messages
                (cons
                 (elmo-msgdb-overview-entity-get-number entity)
@@ -792,12 +792,12 @@ If CHOP-LENGTH is not specified, message set is not chopped."
                          (elmo-file-cache-get (car entity)))
                         (if (or seen
                                 (and use-flag
-                                     (member "\\Seen" flags)))
+                                     (elmo-string-member-ignore-case "\\Seen" flags)))
                             nil
                           (nth 1 app-data))
                       (if (or seen
                               (and use-flag
-                                   (member "\\Seen" flags)))
+                                   (elmo-string-member-ignore-case "\\Seen" flags)))
                           (if elmo-imap4-use-cache
                               (nth 2 app-data))
                         (nth 0 app-data))))))
index c34b7e7..59fb3f8 100644 (file)
@@ -1272,6 +1272,25 @@ But if optional argument AUTO is non-nil, DEFAULT is returned."
          (throw 'found t))
       (setq slist (cdr slist)))))
 
+(cond ((fboundp 'member-ignore-case)
+       (defalias 'elmo-string-member-ignore-case 'member-ignore-case))
+      ((fboundp 'compare-strings)
+       (defun elmo-string-member-ignore-case (elt list)
+        "Like `member', but ignores differences in case and text representation.
+ELT must be a string.  Upper-case and lower-case letters are treated as equal.
+Unibyte strings are converted to multibyte for comparison."
+        (while (and list (not (eq t (compare-strings elt 0 nil (car list) 0 nil t))))
+          (setq list (cdr list)))
+        list))
+      (t
+       (defun elmo-string-member-ignore-case (elt list)
+        "Like `member', but ignores differences in case and text representation.
+ELT must be a string.  Upper-case and lower-case letters are treated as equal."
+        (let ((str (downcase elt)))
+          (while (and list (not (string= str (downcase (car list)))))
+            (setq list (cdr list)))
+          list))))
+
 (defun elmo-string-match-member (str list &optional case-ignore)
   (let ((case-fold-search case-ignore))
     (catch 'member