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
7 ;; Time-stamp: <2000-03-21 17:39:07 teranisi>
9 ;; This file is part of ELMO (Elisp Library for Message Orchestration).
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
33 (require 'mmelmo-imap4)
37 (defvar mmelmo-force-reload nil)
38 (defvar mmelmo-sort-field-list nil)
41 (luna-define-class mime-elmo-entity (mime-buffer-entity)
42 (imap folder number msgdb size))
43 (luna-define-internal-accessors 'mime-elmo-entity))
45 (luna-define-method initialize-instance :after ((entity mime-elmo-entity)
47 "The initialization method for elmo.
48 mime-elmo-entity has its own member variable,
49 `imap', `folder', `msgdb' and `size'.
50 imap: boolean. if non-nil, entity becomes mime-elmo-imap4-entity class.
51 folder: string. folder name.
53 size: size of the entity."
54 (if (mime-elmo-entity-imap-internal entity)
55 ;; use imap part fetching.
56 ;; child mime-entity's class becomes `mime-elmo-imap4-entity'
57 ;; which implements `entity-buffer' method.
60 (mime-buffer-entity-set-buffer-internal entity nil)
62 (mmelmo-imap4-get-mime-entity
63 (mime-elmo-entity-folder-internal entity) ; folder
64 (mime-elmo-entity-number-internal entity) ; number
65 (mime-elmo-entity-msgdb-internal entity) ; msgdb
67 (mime-entity-set-content-type-internal
69 (mime-entity-content-type-internal new-entity))
70 (mime-entity-set-encoding-internal
72 (mime-entity-encoding-internal new-entity))
73 (mime-entity-set-children-internal
75 (mime-entity-children-internal new-entity))
76 (mime-elmo-entity-set-size-internal
78 (mime-elmo-entity-size-internal new-entity))
79 (mime-entity-set-representation-type-internal
80 entity 'mime-elmo-imap4-entity)
82 (set-buffer (mime-buffer-entity-buffer-internal entity))
83 (mmelmo-original-mode)
84 (when (mime-root-entity-p entity)
85 (let ((buffer-read-only nil)
86 header-end body-start)
88 (elmo-read-msg-with-buffer-cache
89 (mime-elmo-entity-folder-internal entity)
90 (mime-elmo-entity-number-internal entity)
92 (mime-elmo-entity-msgdb-internal entity)
94 (goto-char (point-min))
95 (if (re-search-forward
96 (concat "^" (regexp-quote mail-header-separator) "$\\|^$" )
98 (setq header-end (match-beginning 0)
99 body-start (if (= (match-end 0) (point-max))
102 (setq header-end (point-min)
103 body-start (point-min)))
104 (mime-buffer-entity-set-header-start-internal entity (point-min))
105 (mime-buffer-entity-set-header-end-internal entity header-end)
106 (mime-buffer-entity-set-body-start-internal entity body-start)
107 (mime-buffer-entity-set-body-end-internal entity (point-max))
109 (narrow-to-region (mime-buffer-entity-header-start-internal entity)
110 (mime-buffer-entity-header-end-internal entity))
111 (mime-entity-set-content-type-internal
113 (let ((str (std11-fetch-field "Content-Type")))
115 (mime-parse-Content-Type str)
119 (luna-define-method mime-insert-header ((entity mime-elmo-entity)
120 &optional invisible-fields
122 (mmelmo-insert-sorted-header-from-buffer
123 (mime-entity-buffer entity)
124 (mime-buffer-entity-header-start-internal entity)
125 (mime-buffer-entity-header-end-internal entity)
126 invisible-fields visible-fields mmelmo-sort-field-list))
128 (luna-define-method mime-insert-text-content :around ((entity
130 (luna-call-next-method)
131 (run-hooks 'mmelmo-entity-content-inserted-hook))
133 ;(luna-define-method mime-entity-content ((entity mime-elmo-entity))
134 ; (mime-decode-string
135 ; (with-current-buffer (mime-buffer-entity-buffer-internal entity)
136 ; (buffer-substring (mime-buffer-entity-body-start-internal entity)
137 ; (mime-buffer-entity-body-end-internal entity)))
138 ; (mime-entity-encoding entity)))
142 ;;; mmelmo-2.el ends here