1 ;;; elmo-filter.el -- Filtered Folder Interface for ELMO.
3 ;; Copyright 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
5 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
6 ;; Keywords: mail, net news
7 ;; Time-stamp: <00/03/13 18:58:42 teranisi>
9 ;; This file is part of ELMO (Elisp Library for Message Orchestration).
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
34 (defun elmo-filter-msgdb-create (spec numlist new-mark already-mark
35 seen-mark important-mark seen-list)
36 (if (eq (nth 2 spec) 'partial)
37 (elmo-msgdb-create (nth 2 spec)
41 seen-mark important-mark seen-list)
42 (elmo-msgdb-create-as-numlist (nth 2 spec)
46 seen-mark important-mark seen-list)))
48 (defun elmo-filter-msgdb-create-as-numlist (spec numlist new-mark already-mark
49 seen-mark important-mark
51 (elmo-msgdb-create-as-numlist (nth 2 spec)
55 seen-mark important-mark seen-list))
57 (defun elmo-filter-list-folders (spec &optional hierarchy)
60 (defun elmo-filter-append-msg (spec string &optional msg no-see)
61 (elmo-call-func (nth 2 spec) "append" string))
63 (defun elmo-filter-read-msg (spec number outbuf)
64 (elmo-call-func (nth 2 spec) "read-msg" number outbuf))
66 (defun elmo-filter-delete-msgs (spec msgs)
67 (elmo-call-func (nth 2 spec) "delete-msgs" msgs))
69 (defun elmo-filter-list-folder (spec)
70 (let ((filter (nth 1 spec))
75 (cond ((string= (elmo-filter-key filter)
77 (setq msgs (elmo-list-folder folder))
78 (nthcdr (max (- (length msgs)
79 (string-to-int (elmo-filter-value filter)))
82 ((string= (elmo-filter-key filter)
84 (setq msgs (elmo-list-folder folder))
85 (let ((rest (nthcdr (string-to-int (elmo-filter-value filter) )
88 (delete x msgs)) rest))
91 (elmo-search folder filter)))))
93 (defun elmo-filter-list-folder-unread (spec mark-alist unread-marks)
94 (let ((filter (nth 1 spec))
99 (cond ((string= (elmo-filter-key filter)
101 (setq msgs (elmo-list-folder-unread folder mark-alist
103 (nthcdr (max (- (length msgs)
104 (string-to-int (elmo-filter-value filter)))
107 ((string= (elmo-filter-key filter)
109 (setq msgs (elmo-list-folder-unread folder
112 (let ((rest (nthcdr (string-to-int (elmo-filter-value filter) )
115 (delete x msgs)) rest))
119 (elmo-search folder filter)
120 (elmo-list-folder-unread folder mark-alist unread-marks))))))
122 (defun elmo-filter-list-folder-important (spec overview)
123 (let ((filter (nth 1 spec))
124 (folder (nth 2 spec))
128 (cond ((string= (elmo-filter-key filter)
130 (setq msgs (elmo-list-folder-important folder overview))
131 (nthcdr (max (- (length msgs)
132 (string-to-int (elmo-filter-value filter)))
135 ((string= (elmo-filter-key filter)
137 (setq msgs (elmo-list-folder-important folder overview))
138 (let ((rest (nthcdr (string-to-int (elmo-filter-value filter) )
141 (delete x msgs)) rest))
146 '(lambda (x) (elmo-msgdb-overview-entity-get-number x))
148 (elmo-list-folder-important folder overview))))))
150 (defun elmo-filter-max-of-folder (spec)
151 (elmo-max-of-folder (nth 2 spec)))
153 (defun elmo-filter-folder-exists-p (spec)
154 (elmo-folder-exists-p (nth 2 spec)))
156 (defun elmo-filter-folder-creatable-p (spec)
157 (elmo-call-func (nth 2 spec) "folder-creatable-p"))
159 (defun elmo-filter-create-folder (spec)
160 (elmo-create-folder (nth 2 spec)))
162 (defun elmo-filter-search (spec condition &optional numlist)
163 ;; search from messages in this folder
166 (elmo-call-func (nth 2 spec) "search" condition
167 (elmo-filter-list-folder spec))))
169 (defun elmo-filter-use-cache-p (spec number)
170 (elmo-call-func (nth 2 spec) "use-cache-p" number))
172 (defun elmo-filter-local-file-p (spec number)
173 (elmo-call-func (nth 2 spec) "local-file-p" number))
175 (defun elmo-filter-commit (spec)
176 (elmo-commit (nth 2 spec)))
178 (defun elmo-filter-plugged-p (spec)
179 (elmo-folder-plugged-p (nth 2 spec)))
181 (defun elmo-filter-set-plugged (spec plugged add)
182 (elmo-folder-set-plugged (nth 2 spec) plugged add))
184 (defun elmo-filter-get-msg-filename (spec number &optional loc-alist)
185 ;; This function may be called when elmo-filter-local-file-p()
187 (elmo-call-func (nth 2 spec) "get-msg-filename" number loc-alist))
189 (defun elmo-filter-sync-number-alist (spec number-alist)
190 (elmo-call-func (nth 2 spec) "sync-number-alist" number-alist))
192 (defun elmo-filter-server-diff (spec)
193 (elmo-call-func (nth 2 spec) "server-diff"))
195 (provide 'elmo-filter)
197 ;;; elmo-filter.el ends here