1 ;;; elmo-sendlog.el --- Sendlog folder for ELMO.
3 ;; Copyright (C) 2001 Kenichi OKADA <okada@opaopa.org>
5 ;; Author: Kenichi OKADA <okada@opaopa.org>
6 ;; Keywords: mail, net news
8 ;; This file is part of ELMO (Elisp Library for Message Orchestration).
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
36 (defvar elmo-sendlog-filename "sendlog")
38 ;;; ELMO sendlog folder
40 (luna-define-class elmo-sendlog-folder (elmo-map-folder) (dir-name directory))
41 (luna-define-internal-accessors 'elmo-sendlog-folder))
43 (luna-define-method elmo-folder-initialize ((folder elmo-sendlog-folder)
47 (luna-define-method elmo-folder-expand-msgdb-path ((folder elmo-sendlog-folder))
48 (expand-file-name "sendlog"
49 (expand-file-name "internal"
50 elmo-msgdb-directory)))
52 (luna-define-method elmo-map-folder-list-message-locations
53 ((folder elmo-sendlog-folder))
54 (elmo-sendlog-folder-list-message-locations folder))
56 (defun elmo-sendlog-folder-list-message-locations (folder)
57 (let ((filename (expand-file-name elmo-sendlog-filename
58 elmo-msgdb-directory))
60 (if (not (file-readable-p filename))
64 (insert-file-contents filename))
65 (goto-char (point-min))
68 (re-search-forward "id=\\([^@]+@[^@]+\\)$" (point-at-eol) t)
69 (setq result (append result (list (match-string 1))))
70 (if (eq (1+ (point-at-eol)) (point-max))
72 (beginning-of-line 2))))))
75 (luna-define-method elmo-folder-message-file-p ((folder elmo-sendlog-folder))
78 (luna-define-method elmo-message-file-name ((folder elmo-sendlog-folder)
80 (elmo-file-cache-get-path
81 (elmo-map-message-location folder number)))
83 (luna-define-method elmo-folder-msgdb-create ((folder elmo-sendlog-folder)
85 already-mark seen-mark
89 (len (length numbers))
90 overview number-alist mark-alist entity message-id
92 (message "Creating msgdb...")
95 (elmo-msgdb-create-overview-entity-from-file
96 (car numbers) (elmo-message-file-name folder (car numbers))))
98 (elmo-folder-set-killed-list-internal
101 (elmo-folder-killed-list-internal folder)
102 (list (car numbers))))
103 (setq num (elmo-msgdb-overview-entity-get-number entity))
105 (elmo-msgdb-append-element
107 (setq message-id (elmo-msgdb-overview-entity-get-id entity))
109 (elmo-msgdb-number-add number-alist
112 (if (setq mark (or (elmo-msgdb-global-mark-get message-id)
113 (if (member message-id seen-list) nil new-mark)))
115 (elmo-msgdb-mark-append
118 (when (> len elmo-display-progress-threshold)
120 (elmo-display-progress
121 'elmo-sendlog-folder-msgdb-create "Creating msgdb..."
123 (setq numbers (cdr numbers)))
124 (message "Creating msgdb...done")
125 (list overview number-alist mark-alist)))
127 (luna-define-method elmo-message-fetch-with-cache-process
128 ((folder elmo-sendlog-folder) number strategy &optional section unseen)
129 ;; disbable cache process
130 (elmo-message-fetch-internal folder number strategy section unseen))
132 (luna-define-method elmo-map-message-fetch ((folder elmo-sendlog-folder)
134 &optional section unseen)
135 (let ((filename (elmo-file-cache-get-path location)))
136 (if (file-exists-p filename)
137 (insert-file-contents-as-binary filename)
138 (error "Now this message is not cached. Please s all"))))
140 (luna-define-method elmo-folder-exists-p ((folder elmo-sendlog-folder))
143 (luna-define-method elmo-folder-delete-messages ((folder elmo-sendlog-folder)
145 (let ((killed-list (elmo-folder-killed-list-internal folder)))
146 (dolist (number numbers)
148 (elmo-msgdb-set-as-killed killed-list number)))
149 (elmo-folder-set-killed-list-internal folder killed-list))
152 (luna-define-method elmo-message-file-p ((folder elmo-sendlog-folder) number)
155 ;;; To override elmo-map-folder methods.
156 (luna-define-method elmo-folder-list-unreads-internal
157 ((folder elmo-sendlog-folder) unread-marks &optional mark-alist)
160 (luna-define-method elmo-folder-unmark-important ((folder elmo-sendlog-folder)
164 (luna-define-method elmo-folder-mark-as-important ((folder elmo-sendlog-folder)
168 (luna-define-method elmo-folder-unmark-read ((folder elmo-sendlog-folder)
172 (luna-define-method elmo-folder-mark-as-read ((folder elmo-sendlog-folder)
177 (product-provide (provide 'elmo-sendlog) (require 'elmo-version))
179 ;;; elmo-sendlog.el ends here