(defun gnus-article-display-mime-message ()
"Article display method for MIME message."
;; called from `gnus-original-article-buffer'.
- (let ((default-mime-charset (save-excursion
- (set-buffer gnus-summary-buffer)
- default-mime-charset)))
+ (let ((charset (with-current-buffer gnus-summary-buffer
+ default-mime-charset)))
+ (make-local-variable 'default-mime-charset)
+ (setq default-mime-charset charset)
(mime-display-message mime-message-structure
- gnus-article-buffer nil gnus-article-mode-map))
+ gnus-article-buffer nil gnus-article-mode-map)
+ (make-local-variable 'default-mime-charset)
+ (setq default-mime-charset charset)
+ )
;; `mime-display-message' changes current buffer to `gnus-article-buffer'.
(make-local-variable 'mime-button-mother-dispatcher)
(setq mime-button-mother-dispatcher
(let ((charset (save-excursion
(set-buffer gnus-summary-buffer)
default-mime-charset)))
+ (make-local-variable 'default-mime-charset)
+ (setq default-mime-charset charset)
(gnus-article-display-traditional-message)
+ (make-local-variable 'default-mime-charset)
+ (setq default-mime-charset charset)
(let (buffer-read-only)
(eword-decode-header charset)
(goto-char (point-min))
(let ((method
(if gnus-show-mime
(progn
- (mime-parse-buffer)
- (if (or (not gnus-strict-mime)
+ (setq mime-message-structure gnus-current-headers)
+ (if (or (not gnus-strict-mime)
(mime-fetch-field "MIME-Version"))
gnus-article-display-method-for-mime
gnus-article-display-method-for-encoded-word))
;; [number subject from date id references chars lines xref]
(insert (format "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t\n"
(mail-header-number headers)
- (mail-header-subject headers)
- (mail-header-from headers)
+ (mime-fetch-field 'Subject headers)
+ (mime-fetch-field 'From headers)
(mail-header-date headers)
(mail-header-id headers)
(or (mail-header-references headers) "")
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Tatsuya Ichikawa <t-ichi@po.shiojiri.ne.jp>
;; Keywords: mail, news, MIME, offline
;; This file is part of GNU Emacs.
;;;!!!This has been fixed in recent versions of Emacs and XEmacs,
;;;!!!but for the time being, we'll just run this tiny function uncompiled.
+(progn
(defun gnus-draft-setup-for-editing (narticle group)
(gnus-setup-message 'forward
(let ((article narticle))
(forward-char -1)
(insert mail-header-separator)
(forward-line 1)
- (message-set-auto-save-file-name)))))
+ (message-set-auto-save-file-name))))))
;;
(defvar gnus-draft-send-draft-buffer " *send draft*")
+(progn
(defun gnus-draft-setup-for-sending (narticle group)
(let ((article narticle))
(if (not (get-buffer gnus-draft-send-draft-buffer))
(erase-buffer)
(if (not (gnus-request-restore-buffer article group))
(error "Couldn't restore the article")
- )))
+ ))))
;; For draft TEST
(defun gnus-draft-article-sendable-p (article)
The first %s will be replaced by the Newsgroups header;
the second with the current group name.")
-(defvar gnus-message-setup-hook nil
+(defvar gnus-message-setup-hook '(gnus-maybe-setup-default-charset)
"Hook run after setting up a message buffer.")
(defvar gnus-bug-create-help-buffer t
Thank you for your help in stamping out bugs.
"
-
gnus-product-name
(if (string= gnus-product-name "Semi-gnus")
""
\f
;; Dummy to avoid byte-compile warning.
-(defvar nnspool-rejected-article-hook)
-(defvar xemacs-codename)
+;;(defvar nnspool-rejected-article-hook)
+;;(defvar xemacs-codename)
+;;; Since the User-Agent is ``vanity'' headers.
(defun gnus-extended-version ()
"Stringified gnus version."
(interactive)
(insert (car val) ": " (cdr val) "\n"))
(gnus-pull (car val) gnus-message-style-insertions)))))
+
+;;; @ for MIME Edit mode
+;;;
+
+(defun gnus-maybe-setup-default-charset ()
+ (let ((charset
+ (and (boundp 'gnus-summary-buffer)
+ (buffer-live-p gnus-summary-buffer)
+ (save-excursion
+ (set-buffer gnus-summary-buffer)
+ default-mime-charset))))
+ (if charset
+ (progn
+ (make-local-variable 'default-mime-charset)
+ (setq default-mime-charset charset)
+ ))))
+
+
;;; Allow redefinition of functions.
(gnus-ems-redefine)
(defconst gnus-header-index
;; Name to index alist.
- '(("number" 0 gnus-score-integer)
- ("subject" 1 gnus-score-string)
- ("from" 2 gnus-score-string)
- ("date" 3 gnus-score-date)
- ("message-id" 4 gnus-score-string)
- ("references" 5 gnus-score-string)
- ("chars" 6 gnus-score-integer)
- ("lines" 7 gnus-score-integer)
- ("xref" 8 gnus-score-string)
+ '(("number" 1 gnus-score-integer)
+ ("subject" 8 gnus-score-string)
+ ("from" 9 gnus-score-string)
+ ("date" 10 gnus-score-date)
+ ("message-id" 11 gnus-score-string)
+ ("references" 12 gnus-score-string)
+ ("chars" 13 gnus-score-integer)
+ ("lines" 14 gnus-score-integer)
+ ("xref" 15 gnus-score-string)
("head" -1 gnus-score-body)
("body" -1 gnus-score-body)
("all" -1 gnus-score-body)
- ("followup" 2 gnus-score-followup)
- ("thread" 5 gnus-score-thread)))
+ ("followup" 9 gnus-score-followup)
+ ("thread" 12 gnus-score-thread)))
;;; Summary mode score maps.
:group 'gnus-summary-visual
:type 'hook)
-(defcustom gnus-structured-field-decoder
- #'eword-decode-and-unfold-structured-field
- "Function to decode non-ASCII characters in structured field for summary."
- :group 'gnus-various
- :type 'function)
-
-(defcustom gnus-unstructured-field-decoder
- (function
- (lambda (string)
- (eword-decode-unstructured-field-body
- (std11-unfold-string string) 'must-unfold)
- ))
- "Function to decode non-ASCII characters in unstructured field for summary."
- :group 'gnus-various
- :type 'function)
-
(defcustom gnus-parse-headers-hook
'(gnus-set-summary-default-charset)
"*A hook called before parsing the headers."
(?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
(?s gnus-tmp-subject-or-nil ?s)
(?n gnus-tmp-name ?s)
- (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
- ?s)
- (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
+ (?A (std11-address-string
+ (car (mime-read-field 'From gnus-tmp-header))) ?s)
+ (?a (or (std11-full-name-string
+ (car (mime-read-field 'From gnus-tmp-header)))
gnus-tmp-from) ?s)
(?F gnus-tmp-from ?s)
(?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
(let ((gnus-summary-line-format-spec spec)
(gnus-newsgroup-downloadable '((0 . t))))
(gnus-summary-insert-line
- [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
+ (make-full-mail-header 0 "" "" "" "" "" 0 0 "")
+ 0 nil 128 t nil "" nil 1)
(goto-char (point-min))
(setq pos (list (cons 'unread (and (search-forward "\200" nil t)
(- (point) 2)))))
(setq header
(make-full-mail-header
number ; number
- (funcall
- gnus-unstructured-field-decoder (gnus-nov-field)) ; subject
- (funcall
- gnus-structured-field-decoder (gnus-nov-field)) ; from
+ (gnus-nov-field) ; subject
+ (gnus-nov-field) ; from
(gnus-nov-field) ; date
(or (gnus-nov-field)
(nnheader-generate-fake-message-id)) ; id
(defsubst gnus-article-sort-by-author (h1 h2)
"Sort articles by root author."
(string-lessp
- (let ((extract (funcall
- gnus-extract-address-components
- (mail-header-from h1))))
- (or (car extract) (cadr extract) ""))
- (let ((extract (funcall
- gnus-extract-address-components
- (mail-header-from h2))))
- (or (car extract) (cadr extract) ""))))
+ (let ((addr (mime-read-field 'From h1)))
+ (or (std11-full-name-string addr)
+ (std11-address-string addr)
+ ""))
+ (let ((addr (mime-read-field 'From h2)))
+ (or (std11-full-name-string addr)
+ (std11-address-string addr)
+ ""))
+ ))
(defun gnus-thread-sort-by-author (h1 h2)
"Sort threads by root author."
(subst-char-in-region (point-min) (point-max) ?\t ? t)
(gnus-run-hooks 'gnus-parse-headers-hook)
(let ((case-fold-search t)
- in-reply-to header p lines chars)
+ in-reply-to header p lines chars ctype)
(goto-char (point-min))
;; Search to the beginning of the next header. Error messages
;; do not begin with 2 or 3.
;; doesn't always go hand in hand.
(setq
header
- (vector
+ (make-full-mail-header
;; Number.
(prog1
(read cur)
(progn
(goto-char p)
(if (search-forward "\nsubject: " nil t)
- (funcall
- gnus-unstructured-field-decoder (nnheader-header-value))
+ (nnheader-header-value)
"(none)"))
;; From.
(progn
(goto-char p)
(if (search-forward "\nfrom: " nil t)
- (funcall
- gnus-structured-field-decoder (nnheader-header-value))
+ (nnheader-header-value)
"(nobody)"))
;; Date.
(progn
(goto-char p)
(and (search-forward "\nxref: " nil t)
(nnheader-header-value)))))
+ (goto-char p)
+ (if (and (search-forward "\ncontent-type: " nil t)
+ (setq ctype (nnheader-header-value)))
+ (mime-entity-set-content-type-internal
+ header (mime-parse-Content-Type ctype)))
(when (equal id ref)
(setq ref nil))
(> (prefix-numeric-value arg) 0)))
(gnus-summary-select-article t 'force))
+(defun gnus-summary-set-default-charset (charset)
+ "Display the current article with MIME CHARSET."
+ (interactive
+ (list (completing-read "MIME-charset = "
+ (mapcar (function
+ (lambda (cs)
+ (list (symbol-name cs))
+ ))
+ (mime-charset-list)))))
+ (let ((default-mime-charset charset))
+ (gnus-summary-select-article t 'force)
+ ))
+
(defun gnus-summary-caesar-message (&optional arg)
"Caesar rotate the current article by 13.
The numerical prefix specifies how many places to rotate each letter
(defconst gnus-product-name "Nana-gnus"
"Product name of this version of gnus.")
-(defconst gnus-version-number "6.8.19.6"
+(defconst gnus-version-number "6.9.1"
"Version number for this version of gnus.")
(defconst gnus-version
- (format "%s %s (based on Gnus 5.6.44; for SEMI 1.8, FLIM 1.8/1.9)"
+ (format "%s %s (based on Gnus 5.6.44; for SEMI 1.9, FLIM 1.11)"
gnus-product-name gnus-version-number)
"Version string for this version of gnus.")
(defvar message-reply-buffer nil)
(defvar message-reply-headers nil)
-(defvar message-newsreader nil)
-(defvar message-mailer nil)
+(defvar message-user-agent nil) ; XXX: This symbol is overloaded! See below.
(defvar message-sent-message-via nil)
(defvar message-checksum nil)
(defvar message-send-actions nil
(defvar message-send-coding-system 'binary
"Coding system to encode outgoing mail.")
-(defvar message-file-coding-system 'None
- "Coding system for saving message.")
-
;;; Internal variables.
(defvar message-buffer-list nil)
(setq adaptive-fill-first-line-regexp
(concat "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|"
adaptive-fill-first-line-regexp))
- (cond ((coding-system-p message-file-coding-system)
- (set-buffer-file-coding-system message-file-coding-system))
- ((fboundp message-file-coding-system)
- (let ((codesys (funcall message-file-coding-system)))
- (if (coding-system-p codesys)
- (set-buffer-file-coding-system codesys)))))
(run-hooks 'text-mode-hook 'message-mode-hook))
\f
(if wide to-address nil)))
(setq message-reply-headers
- (vector 0 subject from date message-id references 0 0 ""))
+ (make-full-mail-header-from-decoded-header
+ 0 subject from date message-id references 0 0 ""))
(message-setup
`((Subject . ,subject)
cur)
(setq message-reply-headers
- (vector 0 subject from date message-id references 0 0 ""))))
+ (make-full-mail-header-from-decoded-header
+ 0 subject from date message-id references 0 0 ""))))
;;;###autoload
--- /dev/null
+;;; mmgnus.el --- MIME entity implementation for gnus-article
+
+;; Copyright (C) 1998 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Keywords: MIME, multimedia, mail, news
+
+;; This file is part of Chao-gnus.
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(require 'mmbuffer)
+
+(mm-define-backend gnus (generic))
+
+(mm-define-method entity-buffer ((entity gnus))
+ ;; (if (with-current-buffer gnus-summary-buffer
+ ;; (eq gnus-current-article (mail-header-number entity)))
+ ;; ...)
+ (unless (mime-entity-header-start-internal entity)
+ (set-buffer gnus-original-article-buffer)
+ (mime-entity-set-header-start-internal entity (point-min))
+ (mime-entity-set-body-end-internal entity (point-max))
+ (if (re-search-forward "^$" nil t)
+ (progn
+ (mime-entity-set-header-end-internal entity (match-end 0))
+ (mime-entity-set-body-start-internal
+ entity
+ (if (= (mime-entity-header-end-internal entity)
+ (mime-entity-body-end-internal entity))
+ (mime-entity-body-end-internal entity)
+ (1+ (mime-entity-header-end-internal entity))
+ ))
+ )
+ (mime-entity-set-header-end-internal entity (point-min))
+ (mime-entity-set-body-start-internal entity (point-min))
+ ))
+ gnus-original-article-buffer)
+
+
+;;; @ end
+;;;
+
+(provide 'mmgnus)
+
+;;; mmgnus.el ends here
-;;; nnheader.el --- header access macros for Gnus and its backends
+;;; nnheader.el --- header access macros for Semi-gnus and its backends
;; Copyright (C) 1987,88,89,90,93,94,95,96,97,98 Free Software Foundation, Inc.
;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
-;; Lars Magne Ingebrigtsen <larsi@gnus.org>
-;; Keywords: news
+;; Lars Magne Ingebrigtsen <larsi@gnus.org>
+;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Keywords: mail, news, MIME
;; This file is part of GNU Emacs.
(eval-when-compile (require 'cl))
(require 'mail-utils)
+(require 'mime)
(defvar nnheader-max-head-length 4096
"*Max length of the head of articles.")
(defmacro mail-header-number (header)
"Return article number in HEADER."
- `(aref ,header 0))
+ `(mime-entity-location-internal ,header))
(defmacro mail-header-set-number (header number)
"Set article number of HEADER to NUMBER."
- `(aset ,header 0 ,number))
+ `(mime-entity-set-location-internal ,header ,number))
-(defmacro mail-header-subject (header)
- "Return subject string in HEADER."
- `(aref ,header 1))
+(defalias 'mail-header-subject 'mime-entity-decoded-subject-internal)
+(defalias 'mail-header-set-subject 'mime-entity-set-decoded-subject-internal)
-(defmacro mail-header-set-subject (header subject)
- "Set article subject of HEADER to SUBJECT."
- `(aset ,header 1 ,subject))
+(defalias 'mail-header-from 'mime-entity-decoded-from-internal)
+(defalias 'mail-header-set-from 'mime-entity-set-decoded-from-internal)
-(defmacro mail-header-from (header)
- "Return author string in HEADER."
- `(aref ,header 2))
+(defalias 'mail-header-date 'mime-entity-date-internal)
+(defalias 'mail-header-set-date 'mime-entity-set-date-internal)
-(defmacro mail-header-set-from (header from)
- "Set article author of HEADER to FROM."
- `(aset ,header 2 ,from))
+(defalias 'mail-header-message-id 'mime-entity-message-id-internal)
+(defalias 'mail-header-id 'mime-entity-message-id-internal)
+(defalias 'mail-header-set-message-id 'mime-entity-set-message-id-internal)
+(defalias 'mail-header-set-id 'mime-entity-set-message-id-internal)
-(defmacro mail-header-date (header)
- "Return date in HEADER."
- `(aref ,header 3))
+(defalias 'mail-header-references 'mime-entity-references-internal)
+(defalias 'mail-header-set-references 'mime-entity-set-references-internal)
-(defmacro mail-header-set-date (header date)
- "Set article date of HEADER to DATE."
- `(aset ,header 3 ,date))
+(defalias 'mail-header-chars 'mime-entity-chars-internal)
+(defalias 'mail-header-set-chars 'mime-entity-set-chars-internal)
-(defalias 'mail-header-message-id 'mail-header-id)
-(defmacro mail-header-id (header)
- "Return Id in HEADER."
- `(aref ,header 4))
+(defalias 'mail-header-lines 'mime-entity-lines-internal)
+(defalias 'mail-header-set-lines 'mime-entity-set-lines-internal)
-(defalias 'mail-header-set-message-id 'mail-header-set-id)
-(defmacro mail-header-set-id (header id)
- "Set article Id of HEADER to ID."
- `(aset ,header 4 ,id))
+(defalias 'mail-header-xref 'mime-entity-xref-internal)
+(defalias 'mail-header-set-xref 'mime-entity-set-xref-internal)
-(defmacro mail-header-references (header)
- "Return references in HEADER."
- `(aref ,header 5))
-
-(defmacro mail-header-set-references (header ref)
- "Set article references of HEADER to REF."
- `(aset ,header 5 ,ref))
-
-(defmacro mail-header-chars (header)
- "Return number of chars of article in HEADER."
- `(aref ,header 6))
-
-(defmacro mail-header-set-chars (header chars)
- "Set number of chars in article of HEADER to CHARS."
- `(aset ,header 6 ,chars))
-
-(defmacro mail-header-lines (header)
- "Return lines in HEADER."
- `(aref ,header 7))
-
-(defmacro mail-header-set-lines (header lines)
- "Set article lines of HEADER to LINES."
- `(aset ,header 7 ,lines))
-
-(defmacro mail-header-xref (header)
- "Return xref string in HEADER."
- `(aref ,header 8))
-
-(defmacro mail-header-set-xref (header xref)
- "Set article xref of HEADER to xref."
- `(aset ,header 8 ,xref))
+(defsubst make-full-mail-header (&optional number subject from date id
+ references chars lines xref)
+ "Create a new mail header structure initialized with the parameters given."
+ (make-mime-entity-internal
+ 'gnus number
+ nil
+ nil nil nil
+ (if subject
+ (eword-decode-and-unfold-unstructured-field subject)
+ )
+ (if from
+ (eword-decode-and-unfold-structured-field from)
+ )
+ date id references
+ chars lines xref
+ (list (cons 'Subject subject)
+ (cons 'From from))
+ ))
+
+(defsubst make-full-mail-header-from-decoded-header
+ (&optional number subject from date id references chars lines xref)
+ "Create a new mail header structure initialized with the parameters given."
+ (make-mime-entity-internal
+ 'gnus number
+ nil
+ nil nil nil
+ subject
+ from
+ date id references
+ chars lines xref))
(defun make-mail-header (&optional init)
"Create a new mail header structure initialized with INIT."
- (make-vector 9 init))
-
-(defun make-full-mail-header (&optional number subject from date id
- references chars lines xref)
- "Create a new mail header structure initialized with the parameters given."
- (vector number subject from date id references chars lines xref))
+ (make-full-mail-header init init init init init
+ init init init init))
;; fake message-ids: generation and detection
;; about twice as fast, even though it looks messier. You
;; can't have everything, I guess. Speed and elegance
;; don't always go hand in hand.
- (vector
+ (make-full-mail-header
;; Number.
(if naked
(progn
(defun nnheader-parse-nov ()
(let ((eol (gnus-point-at-eol)))
- (vector
+ (make-full-mail-header
(nnheader-nov-read-integer) ; number
(nnheader-nov-field) ; subject
(nnheader-nov-field) ; from
(princ (mail-header-number header) (current-buffer))
(insert
"\t"
- (or (mail-header-subject header) "(none)") "\t"
- (or (mail-header-from header) "(nobody)") "\t"
+ (or (mime-fetch-field 'Subject header) "(none)") "\t"
+ (or (mime-fetch-field 'From header) "(nobody)") "\t"
(or (mail-header-date header) "") "\t"
(or (mail-header-id header)
(nnmail-message-id))