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)
86 (len (length numbers))
87 overview number-alist mark-alist entity message-id
89 (message "Creating msgdb...")
92 (elmo-msgdb-create-overview-entity-from-file
93 (car numbers) (elmo-message-file-name folder (car numbers))))
95 (elmo-folder-set-killed-list-internal
98 (elmo-folder-killed-list-internal folder)
99 (list (car numbers))))
100 (setq num (elmo-msgdb-overview-entity-get-number entity))
102 (elmo-msgdb-append-element
104 (setq message-id (elmo-msgdb-overview-entity-get-id entity))
106 (elmo-msgdb-number-add number-alist
109 (if (setq mark (or (elmo-msgdb-global-mark-get message-id)
110 (if (member message-id seen-list) nil
111 elmo-msgdb-new-mark)))
113 (elmo-msgdb-mark-append
116 (when (> len elmo-display-progress-threshold)
118 (elmo-display-progress
119 'elmo-sendlog-folder-msgdb-create "Creating msgdb..."
121 (setq numbers (cdr numbers)))
122 (message "Creating msgdb...done")
123 (list overview number-alist mark-alist)))
125 (luna-define-method elmo-message-fetch-with-cache-process
126 ((folder elmo-sendlog-folder) number strategy &optional section unseen)
127 ;; disbable cache process
128 (elmo-message-fetch-internal folder number strategy section unseen))
130 (luna-define-method elmo-map-message-fetch ((folder elmo-sendlog-folder)
132 &optional section unseen)
133 (let ((filename (elmo-file-cache-get-path location)))
134 (if (file-exists-p filename)
135 (insert-file-contents-as-binary filename)
136 (error "Now this message is not cached. Please s all"))))
138 (luna-define-method elmo-folder-exists-p ((folder elmo-sendlog-folder))
141 (luna-define-method elmo-folder-delete-messages ((folder elmo-sendlog-folder)
143 (let ((killed-list (elmo-folder-killed-list-internal folder)))
144 (dolist (number numbers)
146 (elmo-msgdb-set-as-killed killed-list number)))
147 (elmo-folder-set-killed-list-internal folder killed-list))
150 (luna-define-method elmo-message-file-p ((folder elmo-sendlog-folder) number)
154 (product-provide (provide 'elmo-sendlog) (require 'elmo-version))
156 ;;; elmo-sendlog.el ends here