Initial Commit
[packages] / xemacs-packages / vm / lisp / vm-user.el
1 ;;; vm-user.el --- Interface functions to VM internal data
2 ;;
3 ;; Copyright (C) 1997 Kyle E. Jones
4 ;; Copyright (C) 2003-2006 Robert Widhopf-Fenk
5 ;;
6 ;; This program is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 2 of the License, or
9 ;; (at your option) any later version.
10 ;;
11 ;; This program is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;; GNU General Public License for more details.
15 ;;
16 ;; You should have received a copy of the GNU General Public License along
17 ;; with this program; if not, write to the Free Software Foundation, Inc.,
18 ;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 ;;; Code:
21 (defun vm-user-composition-folder-buffer ()
22   "Return the folder buffer associated with the current buffer.
23 The current buffer must be a composition buffer created by VM for
24 a reply, resend or forward.
25
26 Nil is returned if the current buffer is not associated with any
27 VM folder.
28
29 Note that the buffer returned might be a virtual folder buffer,
30 which might have several underlying real folders associated with
31 it.  To get the list of real folder buffers associated with a
32 composition buffer, use vm-user-composition-real-folder-buffers
33 instead."
34   (if (eq major-mode 'mail-mode)
35       vm-mail-buffer
36     nil ))
37
38 (defun vm-user-composition-real-folder-buffers ()
39   "Returns a list of the real folder buffers associated with the current
40 buffer.  The current buffer must be a composition buffer created
41 by VM for a reply, resend or forward."
42   (if (eq major-mode 'mail-mode)
43       (let ((list nil) (newlist nil))
44         (cond ((eq vm-system-state 'replying)
45                (setq list vm-reply-list))
46               ((eq vm-system-state 'forwarding)
47                (setq list vm-forward-list))
48               ((eq vm-system-state 'redistributing)
49                (setq list vm-redistribute-list)))
50         (while list
51           (setq newlist (cons (vm-buffer-of (vm-real-message-of (car list)))
52                               newlist)
53                 list (cdr list)))
54         newlist )
55     nil ))
56
57 (provide 'vm-user)
58
59 ;;; vm-user.el ends here