1 ;;; elmo-pipe.el -- PIPE Interface for ELMO.
3 ;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
5 ;; Author: Yuuichi Teranishi <teranisi@gohome.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.
34 (defsubst elmo-pipe-spec-src (spec)
37 (defsubst elmo-pipe-spec-dst (spec)
40 (defalias 'elmo-pipe-msgdb-create 'elmo-pipe-msgdb-create-as-numlist)
42 (defun elmo-pipe-msgdb-create-as-numlist (spec numlist new-mark already-mark
43 seen-mark important-mark
45 (elmo-msgdb-create-as-numlist (elmo-pipe-spec-dst spec)
46 numlist new-mark already-mark
47 seen-mark important-mark seen-list))
49 (defun elmo-pipe-list-folders (spec &optional hierarchy)
52 (defun elmo-pipe-append-msg (spec string &optional msg no-see)
53 (elmo-append-msg (elmo-pipe-spec-dst spec) string))
55 (defun elmo-pipe-read-msg (spec number outbuf)
56 (elmo-call-func (elmo-pipe-spec-dst spec)
60 (defun elmo-pipe-delete-msgs (spec msgs)
61 (elmo-delete-msgs (elmo-pipe-spec-dst spec) msgs))
63 (defvar elmo-pipe-drained-hook nil "A hook called when the pipe is flushed.")
65 (defun elmo-pipe-drain (src dst)
66 "Move all messages of SRC to DST."
67 (let (elmo-nntp-use-cache
69 elmo-pop3-use-cache ; Inhibit caching while moving messages.
70 elmo-pop3-use-uidl) ; No need to use UIDL
71 (message "Checking %s..." src)
72 (let ((srclist (elmo-list-folder src))
73 (msgdb (elmo-msgdb-load src)))
74 (elmo-move-msgs src srclist dst msgdb)
75 ;; Don't save msgdb here.
76 ;; Because summary view of original folder is not updated yet.
77 ;; (elmo-msgdb-save src msgdb)
79 (run-hooks 'elmo-pipe-drained-hook)))
81 (defun elmo-pipe-list-folder (spec)
82 (elmo-pipe-drain (elmo-pipe-spec-src spec)
83 (elmo-pipe-spec-dst spec))
84 (let ((killed (and elmo-use-killed-list
85 (elmo-msgdb-killed-list-load
86 (elmo-msgdb-expand-path spec))))
88 (setq numbers (elmo-list-folder (elmo-pipe-spec-dst spec)))
89 (elmo-living-messages numbers killed)))
91 (defun elmo-pipe-list-folder-unread (spec number-alist mark-alist unread-marks)
92 (elmo-list-folder-unread (elmo-pipe-spec-dst spec)
93 number-alist mark-alist unread-marks))
95 (defun elmo-pipe-list-folder-important (spec number-alist)
96 (elmo-list-folder-important (elmo-pipe-spec-dst spec) number-alist))
98 (defun elmo-pipe-max-of-folder (spec)
99 (let* (elmo-pop3-use-uidl
100 (src-length (length (elmo-list-folder (elmo-pipe-spec-src spec))))
101 (dst-list (elmo-list-folder (elmo-pipe-spec-dst spec))))
102 (cons (+ src-length (elmo-max-of-list dst-list))
103 (+ src-length (length dst-list)))))
105 (defun elmo-pipe-folder-exists-p (spec)
106 (and (elmo-folder-exists-p (elmo-pipe-spec-src spec))
107 (elmo-folder-exists-p (elmo-pipe-spec-dst spec))))
109 (defun elmo-pipe-folder-creatable-p (spec)
110 (or (elmo-folder-creatable-p (elmo-pipe-spec-src spec))
111 (elmo-folder-creatable-p (elmo-pipe-spec-dst spec))))
113 (defun elmo-pipe-create-folder (spec)
114 (if (and (not (elmo-folder-exists-p (elmo-pipe-spec-src spec)))
115 (elmo-folder-creatable-p (elmo-pipe-spec-src spec)))
116 (elmo-create-folder (elmo-pipe-spec-src spec)))
117 (if (and (not (elmo-folder-exists-p (elmo-pipe-spec-dst spec)))
118 (elmo-folder-creatable-p (elmo-pipe-spec-dst spec)))
119 (elmo-create-folder (elmo-pipe-spec-dst spec))))
121 (defun elmo-pipe-search (spec condition &optional numlist)
122 (elmo-search (elmo-pipe-spec-dst spec) condition numlist))
124 (defun elmo-pipe-use-cache-p (spec number)
125 (elmo-use-cache-p (elmo-pipe-spec-dst spec) number))
127 (defun elmo-pipe-commit (spec)
128 (elmo-commit (elmo-pipe-spec-src spec))
129 (elmo-commit (elmo-pipe-spec-dst spec)))
131 (defun elmo-pipe-plugged-p (spec)
132 (and (elmo-folder-plugged-p (elmo-pipe-spec-src spec))
133 (elmo-folder-plugged-p (elmo-pipe-spec-dst spec))))
135 (defun elmo-pipe-set-plugged (spec plugged add)
136 (elmo-folder-set-plugged (elmo-pipe-spec-src spec) plugged add)
137 (elmo-folder-set-plugged (elmo-pipe-spec-dst spec) plugged add))
139 (defun elmo-pipe-local-file-p (spec number)
140 (elmo-local-file-p (elmo-pipe-spec-dst spec) number))
142 (defun elmo-pipe-get-msg-filename (spec number &optional loc-alist)
143 (elmo-get-msg-filename (elmo-pipe-spec-dst spec) number loc-alist))
145 (defun elmo-pipe-sync-number-alist (spec number-alist)
146 (elmo-call-func (elmo-pipe-spec-src spec)
147 "sync-number-alist" number-alist)) ; ??
149 (defun elmo-pipe-server-diff (spec)
152 (defalias 'elmo-pipe-folder-diff 'elmo-generic-folder-diff)
155 (product-provide (provide 'elmo-pipe) (require 'elmo-version))
157 ;;; elmo-pipe.el ends here