From a4c4b8bb8694c73b85e9ba1b813067c291f9de26 Mon Sep 17 00:00:00 2001 From: dmaus Date: Wed, 17 Mar 2010 19:43:58 +0000 Subject: [PATCH] * elmo-imap4.el (elmo-imap4-folder-list-flagged) (elmo-imap4-search-internal-primitive): Pass filter type to imap search when performing search for flagged messages. Fixes debian bug #573726. --- elmo/elmo-imap4.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index dfa1b2b..18a3027 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -852,11 +852,15 @@ Returns response value if selecting folder succeed. " (t (elmo-imap4-flag-to-imap-search-key flag)))) -(defun elmo-imap4-folder-list-flagged (folder flag) +(defun elmo-imap4-folder-list-flagged (folder flag &optional type) "List flagged message numbers in the FOLDER. -FLAG is one of the `unread', `read', `important', `answered', `any'." +FLAG is one of the `unread', `read', `important', `answered', +`any'. +When optional argument TYPE is symbol 'unmatch, negate search +condition." (let ((session (elmo-imap4-get-session folder)) - (criteria (elmo-imap4-flag-to-imap-criteria flag))) + (criteria (concat (if (eq type 'unmatch) "not " "") + (elmo-imap4-flag-to-imap-criteria flag)))) (if (elmo-imap4-session-flag-available-p session flag) (elmo-imap4-list folder criteria) ;; List flagged messages in the msgdb. @@ -2287,7 +2291,7 @@ If optional argument REMOVE is non-nil, remove FLAG." numbers)) ((string= "flag" search-key) (elmo-imap4-folder-list-flagged - folder (intern (elmo-filter-value filter)))) + folder (intern (elmo-filter-value filter)) (elmo-filter-type filter))) ((or (string= "since" search-key) (string= "before" search-key)) (setq search-key (concat "sent" search-key) -- 1.7.10.4