From 2979ab608a2052d13ae0c7cd6f7a3c5541e4cf1c Mon Sep 17 00:00:00 2001 From: kaoru Date: Sun, 15 Jun 2003 14:30:22 +0000 Subject: [PATCH] * elmo-util.el (elmo-string-member-ignore-case): New function. * elmo-imap4.el (elmo-imap4-response-get-selectable-mailbox-list): Use i t. (elmo-imap4-fetch-callback-1-subr): Likewise. --- elmo/ChangeLog | 4 ++++ elmo/elmo-imap4.el | 10 +++++----- elmo/elmo-util.el | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index b8a54a4..92cafb2 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,9 @@ 2003-06-15 TAKAHASHI Kaoru + * 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. diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 1dacabe..b056019 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 c34b7e7..59fb3f8 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