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 (defalias 'elmo-pipe-msgdb-create 'elmo-pipe-msgdb-create-as-numlist)
36 (defun elmo-pipe-msgdb-create-as-numlist (spec numlist new-mark already-mark
37 seen-mark important-mark
39 (elmo-msgdb-create-as-numlist (elmo-pipe-spec-dst spec)
40 numlist new-mark already-mark
41 seen-mark important-mark seen-list))
43 (defun elmo-pipe-list-folders (spec &optional hierarchy)
46 (defun elmo-pipe-append-msg (spec string &optional msg no-see)
47 (elmo-append-msg (elmo-pipe-spec-dst spec) string))
49 (defun elmo-pipe-read-msg (spec number outbuf)
50 (elmo-call-func (elmo-pipe-spec-dst spec)
54 (defun elmo-pipe-delete-msgs (spec msgs)
55 (elmo-delete-msgs (elmo-pipe-spec-dst spec) msgs))
57 (defvar elmo-pipe-drained-hook nil "A hook called when the pipe is flushed.")
59 (defun elmo-pipe-drain (src dst)
60 "Move all messages of SRC to DST."
61 (let (elmo-nntp-use-cache
63 elmo-pop3-use-cache ; Inhibit caching while moving messages.
64 elmo-pop3-use-uidl) ; No need to use UIDL
65 (message "Checking %s..." src)
66 (let ((srclist (elmo-list-folder src))
67 (msgdb (elmo-msgdb-load src)))
68 (elmo-move-msgs src srclist dst msgdb)
69 ;; Don't save msgdb here.
70 ;; Because summary view of original folder is not updated yet.
71 ;; (elmo-msgdb-save src msgdb)
73 (run-hooks 'elmo-pipe-drained-hook)))
75 (defun elmo-pipe-list-folder (spec)
76 (elmo-pipe-drain (elmo-pipe-spec-src spec)
77 (elmo-pipe-spec-dst spec))
78 (let ((killed (and elmo-use-killed-list
79 (elmo-msgdb-killed-list-load
80 (elmo-msgdb-expand-path spec))))
82 (setq numbers (elmo-list-folder (elmo-pipe-spec-dst spec)))
83 (elmo-living-messages numbers killed)))
85 (defun elmo-pipe-list-folder-unread (spec number-alist mark-alist unread-marks)
86 (elmo-list-folder-unread (elmo-pipe-spec-dst spec)
87 number-alist mark-alist unread-marks))
89 (defun elmo-pipe-list-folder-important (spec number-alist)
90 (elmo-list-folder-important (elmo-pipe-spec-dst spec) number-alist))
92 (defun elmo-pipe-max-of-folder (spec)
93 (let* (elmo-pop3-use-uidl
94 (src-length (length (elmo-list-folder (elmo-pipe-spec-src spec))))
95 (dst-list (elmo-list-folder (elmo-pipe-spec-dst spec))))
96 (cons (+ src-length (elmo-max-of-list dst-list))
97 (+ src-length (length dst-list)))))
99 (defun elmo-pipe-folder-exists-p (spec)
100 (and (elmo-folder-exists-p (elmo-pipe-spec-src spec))
101 (elmo-folder-exists-p (elmo-pipe-spec-dst spec))))
103 (defun elmo-pipe-folder-creatable-p (spec)
104 (or (elmo-folder-creatable-p (elmo-pipe-spec-src spec))
105 (elmo-folder-creatable-p (elmo-pipe-spec-dst spec))))
107 (defun elmo-pipe-create-folder (spec)
108 (if (and (not (elmo-folder-exists-p (elmo-pipe-spec-src spec)))
109 (elmo-folder-creatable-p (elmo-pipe-spec-src spec)))
110 (elmo-create-folder (elmo-pipe-spec-src spec)))
111 (if (and (not (elmo-folder-exists-p (elmo-pipe-spec-dst spec)))
112 (elmo-folder-creatable-p (elmo-pipe-spec-dst spec)))
113 (elmo-create-folder (elmo-pipe-spec-dst spec))))
115 (defun elmo-pipe-search (spec condition &optional numlist)
116 (elmo-search (elmo-pipe-spec-dst spec) condition numlist))
118 (defun elmo-pipe-use-cache-p (spec number)
119 (elmo-use-cache-p (elmo-pipe-spec-dst spec) number))
121 (defun elmo-pipe-commit (spec)
122 (elmo-commit (elmo-pipe-spec-src spec))
123 (elmo-commit (elmo-pipe-spec-dst spec)))
125 (defun elmo-pipe-plugged-p (spec)
126 (and (elmo-folder-plugged-p (elmo-pipe-spec-src spec))
127 (elmo-folder-plugged-p (elmo-pipe-spec-dst spec))))
129 (defun elmo-pipe-set-plugged (spec plugged add)
130 (elmo-folder-set-plugged (elmo-pipe-spec-src spec) plugged add)
131 (elmo-folder-set-plugged (elmo-pipe-spec-dst spec) plugged add))
133 (defun elmo-pipe-local-file-p (spec number)
134 (elmo-local-file-p (elmo-pipe-spec-dst spec) number))
136 (defun elmo-pipe-get-msg-filename (spec number &optional loc-alist)
137 (elmo-get-msg-filename (elmo-pipe-spec-dst spec) number loc-alist))
139 (defun elmo-pipe-sync-number-alist (spec number-alist)
140 (elmo-call-func (elmo-pipe-spec-src spec)
141 "sync-number-alist" number-alist)) ; ??
143 (defun elmo-pipe-server-diff (spec)
146 (defalias 'elmo-pipe-folder-diff 'elmo-generic-folder-diff)
149 (product-provide (provide 'elmo-pipe) (require 'elmo-version))
151 ;;; elmo-pipe.el ends here