1 ;;; mmelmo-2.el -- mm-backend (for FLIM 1.13.x) by ELMO.
3 ;; Copyright 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.
32 (require 'mmelmo-imap4)
36 (defvar mmelmo-force-reload nil)
37 (defvar mmelmo-sort-field-list nil)
40 (luna-define-class mime-elmo-entity (mime-buffer-entity)
41 (imap folder number msgdb size))
42 (luna-define-internal-accessors 'mime-elmo-entity))
44 (luna-define-method initialize-instance :after ((entity mime-elmo-entity)
46 "The initialization method for elmo.
47 mime-elmo-entity has its own member variable,
48 `imap', `folder', `msgdb' and `size'.
49 imap: boolean. if non-nil, entity becomes mime-elmo-imap4-entity class.
50 folder: string. folder name.
52 size: size of the entity."
53 (if (mime-elmo-entity-imap-internal entity)
54 ;; use imap part fetching.
55 ;; child mime-entity's class becomes `mime-elmo-imap4-entity'
56 ;; which implements `entity-buffer' method.
59 (mime-buffer-entity-set-buffer-internal entity nil)
61 (mmelmo-imap4-get-mime-entity
62 (mime-elmo-entity-folder-internal entity) ; folder
63 (mime-elmo-entity-number-internal entity) ; number
64 (mime-elmo-entity-msgdb-internal entity) ; msgdb
66 (mime-entity-set-content-type-internal
68 (mime-entity-content-type-internal new-entity))
69 (mime-entity-set-encoding-internal
71 (mime-entity-encoding-internal new-entity))
72 (mime-entity-set-children-internal
74 (mime-entity-children-internal new-entity))
75 (mime-elmo-entity-set-size-internal
77 (mime-elmo-entity-size-internal new-entity))
78 (mime-entity-set-representation-type-internal
79 entity 'mime-elmo-imap4-entity)
81 (set-buffer (mime-buffer-entity-buffer-internal entity))
82 (mmelmo-original-mode)
83 (when (mime-root-entity-p entity)
84 (let ((buffer-read-only nil)
85 header-end body-start)
87 (elmo-read-msg-with-buffer-cache
88 (mime-elmo-entity-folder-internal entity)
89 (mime-elmo-entity-number-internal entity)
91 (mime-elmo-entity-msgdb-internal entity)
93 (goto-char (point-min))
94 (if (re-search-forward
95 (concat "^" (regexp-quote mail-header-separator) "$\\|^$" )
97 (setq header-end (match-beginning 0)
98 body-start (if (= (match-end 0) (point-max))
101 (setq header-end (point-min)
102 body-start (point-min)))
103 (mime-buffer-entity-set-header-start-internal entity (point-min))
104 (mime-buffer-entity-set-header-end-internal entity header-end)
105 (mime-buffer-entity-set-body-start-internal entity body-start)
106 (mime-buffer-entity-set-body-end-internal entity (point-max))
108 (narrow-to-region (mime-buffer-entity-header-start-internal entity)
109 (mime-buffer-entity-header-end-internal entity))
110 (mime-entity-set-content-type-internal
112 (let ((str (std11-fetch-field "Content-Type")))
114 (mime-parse-Content-Type str)
118 (luna-define-method mime-insert-header ((entity mime-elmo-entity)
119 &optional invisible-fields
121 (mmelmo-insert-sorted-header-from-buffer
122 (mime-buffer-entity-buffer-internal entity)
123 (mime-buffer-entity-header-start-internal entity)
124 (mime-buffer-entity-header-end-internal entity)
125 invisible-fields visible-fields mmelmo-sort-field-list))
127 (luna-define-method mime-insert-text-content :around ((entity
129 (luna-call-next-method)
130 (run-hooks 'mmelmo-entity-content-inserted-hook))
132 ;(luna-define-method mime-entity-content ((entity mime-elmo-entity))
133 ; (mime-decode-string
134 ; (with-current-buffer (mime-buffer-entity-buffer-internal entity)
135 ; (buffer-substring (mime-buffer-entity-body-start-internal entity)
136 ; (mime-buffer-entity-body-end-internal entity)))
137 ; (mime-entity-encoding entity)))
141 ;;; mmelmo-2.el ends here