From: keiichi Date: Tue, 18 Jul 2000 07:14:15 +0000 (+0000) Subject: (TopLevel): Require `mmgeneric' always. X-Git-Tag: nana-gnus-7_1_0_23~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ca4ffaa0d498b945886118c974dd59fc78fd2f4;p=elisp%2Fgnus.git- (TopLevel): Require `mmgeneric' always. (mmgnus-entiry::mime-entity-fetch-field): Define method. (mmgnus-entiry::mime-entity-body): Do not error. (mmgnus-entiry::mime-insert-text-content): Define method. (mmgnus-entiry::mime-insert-entity-body): Ditto. (mime-gnus-entity::mime-entity-fetch-field): Ditto. (mime-gnus-entity::mime-entity-body): Ditto. (mime-gnus-entity::mime-entity-content): Ditto. (mime-gnus-entity::mime-insert-entity-content): Ditto. (mime-gnus-entity::mime-insert-text-content): Ditto. (mime-gnus-entity::mime-write-entity-content): Ditto. (mime-gnus-entity::mime-insert-entity): Ditto. (mime-gnus-entity::mime-write-entity): Ditto. (mime-gnus-entity::mime-insert-entity-body): Ditto. (mime-gnus-entity::mime-write-entity-body): Ditto. --- diff --git a/lisp/mmgnus.el b/lisp/mmgnus.el index 534d704..e858dc9 100644 --- a/lisp/mmgnus.el +++ b/lisp/mmgnus.el @@ -25,9 +25,7 @@ ;;; Code: -(condition-case nil - (require 'mmgeneric) - (error nil)) +(require 'mmgeneric) (require 'mime) (require 'eword-decode) @@ -104,14 +102,36 @@ (mmgnus-entity-header-internal entity) invisible-fields visible-fields)) +(luna-define-method mime-entity-fetch-field :around + ((entity mmgnus-entity) field-name) + (or (luna-call-next-method) + (let* ((header (mmgnus-entity-header-internal entity)) + (case-fold-search t) + (ret (and header + (string-match + (concat "^" field-name + ":[ \t]+\\(.*\\(\n[ \t]+.*\\)*\\)\n") + header) + (match-string 1 header)))) + (when ret + (or (symbolp field-name) + (setq field-name + (intern (capitalize (capitalize field-name))))) + (mime-entity-set-original-header-internal + entity + (put-alist field-name ret + (mime-entity-original-header-internal entity))) + ret)))) + (luna-define-method mime-entity-body ((entity mmgnus-entity)) (cond ((bufferp (mmgnus-entity-body-internal entity)) (with-current-buffer (mmgnus-entity-body-internal entity) (buffer-string))) (t - (error "Invalid body object. %s" - (mmgnus-entity-body-internal entity))))) + (message "Invalid body object. %s" + (mmgnus-entity-body-internal entity)) + ""))) (luna-define-method mime-entity-content ((entity mmgnus-entity)) (mime-decode-string (mime-entity-body entity) @@ -120,6 +140,15 @@ (luna-define-method mime-insert-entity-content ((entity mmgnus-entity)) (insert (mime-entity-content entity))) +(luna-define-method mime-insert-text-content ((entity mmgnus-entity)) + (insert + (decode-mime-charset-string (mime-entity-content entity) + (or (mime-content-type-parameter + (mime-entity-content-type entity) + "charset") + default-mime-charset) + 'CRLF))) + (luna-define-method mime-write-entity-content ((entity mmgnus-entity) filename) (with-temp-buffer (insert (mime-entity-body entity)) @@ -137,6 +166,9 @@ (mime-insert-entity entity) (write-region-as-raw-text-CRLF (point-min) (point-max) filename))) +(luna-define-method mime-insert-entity-body ((entity mmgnus-entity)) + (insert (mime-entity-body entity))) + (luna-define-method mime-write-entity-body ((entity mmgnus-entity) filename) (with-temp-buffer (insert (mime-entity-body entity)) @@ -164,6 +196,42 @@ (luna-define-method mime-entity-content :around ((entity mime-gnus-entity)) (luna-call-next-method)) +(luna-define-method mime-entity-fetch-field :around ((entity mime-gnus-entity) + field-name) + (luna-call-next-method)) + +(luna-define-method mime-entity-body :around ((entity mime-gnus-entity)) + (luna-call-next-method)) + +(luna-define-method mime-entity-content :around ((entity mime-gnus-entity)) + (luna-call-next-method)) + +(luna-define-method mime-insert-entity-content :around + ((entity mime-gnus-entity)) + (luna-call-next-method)) + +(luna-define-method mime-insert-text-content :around + ((entity mime-gnus-entity)) + (luna-call-next-method)) + +(luna-define-method mime-write-entity-content :around + ((entity mime-gnus-entity) filename) + (luna-call-next-method)) + +(luna-define-method mime-insert-entity :around ((entity mime-gnus-entity)) + (luna-call-next-method)) + +(luna-define-method mime-write-entity :around ((entity mime-gnus-entity) + filename) + (luna-call-next-method)) + +(luna-define-method mime-insert-entity-body :around ((entity mime-gnus-entity)) + (luna-call-next-method)) + +(luna-define-method mime-write-entity-body :around ((entity mime-gnus-entity) + filename) + (luna-call-next-method)) + ;;; @ end ;;;