From 435763fadbe337d9f6d8e66ef46209492e49e8b8 Mon Sep 17 00:00:00 2001 From: okazaki Date: Thu, 27 Mar 2003 08:17:41 +0000 Subject: [PATCH] * 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. --- elmo/elmo-imap4.el | 10 +++++----- elmo/elmo-util.el | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 535a0b1..70e5041 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -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)))))) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index b468759..9fab0b4 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -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 -- 1.7.10.4