From 111c38cf8a9271c7e441ae0f335d2af86e9720ff Mon Sep 17 00:00:00 2001 From: yamaoka Date: Wed, 17 May 2000 04:04:02 +0000 Subject: [PATCH] Sync. --- lisp/ChangeLog | 6 ++ lisp/gnus-group.el | 4 +- lisp/mml.el | 221 ++++++++++++++++++++++++++++------------------------ texi/ChangeLog | 5 ++ texi/gnus-ja.texi | 57 +++++++++++++- texi/gnus.texi | 58 +++++++++++++- 6 files changed, 242 insertions(+), 109 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2aa2bcd..0e12a74 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2000-05-16 21:13:24 Shenghuo ZHU + + * mml.el (mml-generate-mime-preprocess-function): New variable. + (mml-generate-mime-postprocess-function): New variable. + (mml-generate-mime-1): Use them. + 2000-05-16 18:15:24 Shenghuo ZHU * gnus-group.el (gnus-group-apropos): Group name charset. diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el index 4d1dd6b..9041f24 100644 --- a/lisp/gnus-group.el +++ b/lisp/gnus-group.el @@ -396,7 +396,7 @@ ticked: The number of ticked articles." :type '(repeat (cons (sexp :tag "Form") file))) (defcustom gnus-group-name-charset-method-alist nil - "*Alist for method and the charset for group names. + "*Alist of method and the charset for group names. For example: (((nntp \"news.com.cn\") . cn-gb-2312)) @@ -405,7 +405,7 @@ For example: :type '(repeat (cons (sexp :tag "Method") (symbol :tag "Charset")))) (defcustom gnus-group-name-charset-group-alist nil - "*Alist for group regexp and the charset for group names. + "*Alist of group regexp and the charset for group names. For example: ((\"\\.com\\.cn:\" . cn-gb-2312)) diff --git a/lisp/mml.el b/lisp/mml.el index db11fa8..49c915d 100644 --- a/lisp/mml.el +++ b/lisp/mml.el @@ -72,6 +72,15 @@ unknown encoding; `use-ascii': always use ASCII for those characters with unknown encoding; `multipart': always send messages with more than one charsets.") +(defvar mml-generate-mime-preprocess-function nil + "A function called before generating a mime part. +The function is called with one parameter, which is the part to be +generated.") + +(defvar mml-generate-mime-postprocess-function nil + "A function called after generating a mime part. +The function is called with one parameter, which is the generated part.") + (defvar mml-generate-default-type "text/plain") (defvar mml-buffer-list nil) @@ -274,116 +283,122 @@ If MML is non-nil, return the buffer up till the correspondent mml tag." (buffer-string))))) (defun mml-generate-mime-1 (cont) - (cond - ((or (eq (car cont) 'part) (eq (car cont) 'mml)) - (let (coded encoding charset filename type) - (setq type (or (cdr (assq 'type cont)) "text/plain")) - (if (member (car (split-string type "/")) '("text" "message")) - (with-temp-buffer + (save-restriction + (narrow-to-region (point) (point)) + (if mml-generate-mime-preprocess-function + (funcall mml-generate-mime-preprocess-function cont)) + (cond + ((or (eq (car cont) 'part) (eq (car cont) 'mml)) + (let (coded encoding charset filename type) + (setq type (or (cdr (assq 'type cont)) "text/plain")) + (if (member (car (split-string type "/")) '("text" "message")) + (with-temp-buffer + (cond + ((cdr (assq 'buffer cont)) + (insert-buffer-substring (cdr (assq 'buffer cont)))) + ((and (setq filename (cdr (assq 'filename cont))) + (not (equal (cdr (assq 'nofile cont)) "yes"))) + (mm-insert-file-contents filename)) + ((eq 'mml (car cont)) + (insert (cdr (assq 'contents cont)))) + (t + (save-restriction + (narrow-to-region (point) (point)) + (insert (cdr (assq 'contents cont))) + ;; Remove quotes from quoted tags. + (goto-char (point-min)) + (while (re-search-forward + "<#!+/?\\(part\\|multipart\\|external\\|mml\\)" nil t) + (delete-region (+ (match-beginning 0) 2) + (+ (match-beginning 0) 3)))))) + (cond + ((eq (car cont) 'mml) + (let ((mml-boundary (funcall mml-boundary-function + (incf mml-multipart-number))) + (mml-generate-default-type "text/plain")) + (mml-to-mime)) + (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b"))) + ;; ignore 0x1b, it is part of iso-2022-jp + (setq encoding (mm-body-7-or-8)))) + ((string= (car (split-string type "/")) "message") + (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b"))) + ;; ignore 0x1b, it is part of iso-2022-jp + (setq encoding (mm-body-7-or-8)))) + (t + (setq charset (mm-encode-body)) + (setq encoding (mm-body-encoding + charset (cdr (assq 'encoding cont)))))) + (setq coded (buffer-string))) + (mm-with-unibyte-buffer (cond ((cdr (assq 'buffer cont)) (insert-buffer-substring (cdr (assq 'buffer cont)))) ((and (setq filename (cdr (assq 'filename cont))) (not (equal (cdr (assq 'nofile cont)) "yes"))) - (mm-insert-file-contents filename)) - ((eq 'mml (car cont)) - (insert (cdr (assq 'contents cont)))) + (let ((coding-system-for-read mm-binary-coding-system)) + (mm-insert-file-contents filename nil nil nil nil t))) (t - (save-restriction - (narrow-to-region (point) (point)) - (insert (cdr (assq 'contents cont))) - ;; Remove quotes from quoted tags. - (goto-char (point-min)) - (while (re-search-forward - "<#!+/?\\(part\\|multipart\\|external\\|mml\\)" nil t) - (delete-region (+ (match-beginning 0) 2) - (+ (match-beginning 0) 3)))))) - (cond - ((eq (car cont) 'mml) - (let ((mml-boundary (funcall mml-boundary-function - (incf mml-multipart-number))) - (mml-generate-default-type "text/plain")) - (mml-to-mime)) - (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b"))) - ;; ignore 0x1b, it is part of iso-2022-jp - (setq encoding (mm-body-7-or-8)))) - ((string= (car (split-string type "/")) "message") - (let ((mm-7bit-chars (concat mm-7bit-chars "\x1b"))) - ;; ignore 0x1b, it is part of iso-2022-jp - (setq encoding (mm-body-7-or-8)))) - (t - (setq charset (mm-encode-body)) - (setq encoding (mm-body-encoding - charset (cdr (assq 'encoding cont)))))) - (setq coded (buffer-string))) - (mm-with-unibyte-buffer - (cond - ((cdr (assq 'buffer cont)) - (insert-buffer-substring (cdr (assq 'buffer cont)))) - ((and (setq filename (cdr (assq 'filename cont))) - (not (equal (cdr (assq 'nofile cont)) "yes"))) - (let ((coding-system-for-read mm-binary-coding-system)) - (mm-insert-file-contents filename nil nil nil nil t))) - (t - (insert (cdr (assq 'contents cont))))) - (setq encoding (mm-encode-buffer type) - coded (buffer-string)))) - (mml-insert-mime-headers cont type charset encoding) - (insert "\n") - (insert coded))) - ((eq (car cont) 'external) - (insert "Content-Type: message/external-body") - (let ((parameters (mml-parameter-string - cont '(expiration size permission))) - (name (cdr (assq 'name cont)))) - (when name - (setq name (mml-parse-file-name name)) - (if (stringp name) + (insert (cdr (assq 'contents cont))))) + (setq encoding (mm-encode-buffer type) + coded (buffer-string)))) + (mml-insert-mime-headers cont type charset encoding) + (insert "\n") + (insert coded))) + ((eq (car cont) 'external) + (insert "Content-Type: message/external-body") + (let ((parameters (mml-parameter-string + cont '(expiration size permission))) + (name (cdr (assq 'name cont)))) + (when name + (setq name (mml-parse-file-name name)) + (if (stringp name) + (mml-insert-parameter + (mail-header-encode-parameter "name" name) + "access-type=local-file") (mml-insert-parameter - (mail-header-encode-parameter "name" name) - "access-type=local-file") - (mml-insert-parameter - (mail-header-encode-parameter - "name" (file-name-nondirectory (nth 2 name))) - (mail-header-encode-parameter "site" (nth 1 name)) - (mail-header-encode-parameter - "directory" (file-name-directory (nth 2 name)))) - (mml-insert-parameter - (concat "access-type=" - (if (member (nth 0 name) '("ftp@" "anonymous@")) - "anon-ftp" - "ftp"))))) - (when parameters - (mml-insert-parameter-string - cont '(expiration size permission)))) - (insert "\n\n") - (insert "Content-Type: " (cdr (assq 'type cont)) "\n") - (insert "Content-ID: " (message-make-message-id) "\n") - (insert "Content-Transfer-Encoding: " - (or (cdr (assq 'encoding cont)) "binary")) - (insert "\n\n") - (insert (or (cdr (assq 'contents cont)))) - (insert "\n")) - ((eq (car cont) 'multipart) - (let* ((type (or (cdr (assq 'type cont)) "mixed")) - (mml-generate-default-type (if (equal type "digest") - "message/rfc822" - "text/plain")) - (handler (assoc type mml-generate-multipart-alist))) - (if handler - (funcall (cdr handler) cont) - ;; No specific handler. Use default one. - (let ((mml-boundary (mml-compute-boundary cont))) - (insert (format "Content-Type: multipart/%s; boundary=\"%s\"\n" - type mml-boundary)) - ;; Skip `multipart' and `type' elements. - (setq cont (cddr cont)) - (while cont - (insert "\n--" mml-boundary "\n") - (mml-generate-mime-1 (pop cont))) - (insert "\n--" mml-boundary "--\n"))))) - (t - (error "Invalid element: %S" cont)))) + (mail-header-encode-parameter + "name" (file-name-nondirectory (nth 2 name))) + (mail-header-encode-parameter "site" (nth 1 name)) + (mail-header-encode-parameter + "directory" (file-name-directory (nth 2 name)))) + (mml-insert-parameter + (concat "access-type=" + (if (member (nth 0 name) '("ftp@" "anonymous@")) + "anon-ftp" + "ftp"))))) + (when parameters + (mml-insert-parameter-string + cont '(expiration size permission)))) + (insert "\n\n") + (insert "Content-Type: " (cdr (assq 'type cont)) "\n") + (insert "Content-ID: " (message-make-message-id) "\n") + (insert "Content-Transfer-Encoding: " + (or (cdr (assq 'encoding cont)) "binary")) + (insert "\n\n") + (insert (or (cdr (assq 'contents cont)))) + (insert "\n")) + ((eq (car cont) 'multipart) + (let* ((type (or (cdr (assq 'type cont)) "mixed")) + (mml-generate-default-type (if (equal type "digest") + "message/rfc822" + "text/plain")) + (handler (assoc type mml-generate-multipart-alist))) + (if handler + (funcall (cdr handler) cont) + ;; No specific handler. Use default one. + (let ((mml-boundary (mml-compute-boundary cont))) + (insert (format "Content-Type: multipart/%s; boundary=\"%s\"\n" + type mml-boundary)) + ;; Skip `multipart' and `type' elements. + (setq cont (cddr cont)) + (while cont + (insert "\n--" mml-boundary "\n") + (mml-generate-mime-1 (pop cont))) + (insert "\n--" mml-boundary "--\n"))))) + (t + (error "Invalid element: %S" cont))) + (if mml-generate-mime-postprocess-function + (funcall mml-generate-mime-postprocess-function cont)))) (defun mml-compute-boundary (cont) "Return a unique boundary that does not exist in CONT." diff --git a/texi/ChangeLog b/texi/ChangeLog index dd1ea11..a0f2b6c 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,8 @@ +2000-05-16 21:46:40 Shenghuo ZHU + + * gnus.texi (Misc Group Stuff): Addition. + (Article Washing): Ditto. + 2000-05-15 10:16:29 Shenghuo ZHU * gnus.texi (Mail Source Specifiers): Update maildir. diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index 93edfa5..aae5a77 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -3608,8 +3608,29 @@ Gnus $(B$3$N@55,I=8=$K%^%C%A$9$k%0%k!<%W$O!"$=$l$,6u$G$"$k$+$I$&$+$K4X$o(B $(B$i$:!">o$K%0%k!<%W%P%C%U%!$KI=<($5$l$^$9!#(B -@end table +@item gnus-group-name-charset-method-alist +@vindex gnus-group-name-charset-method-alist +$(B%0%k!<%WL>MQ$NA*BrJ}K!$HJ8;z=89g$NO"A[%j%9%H$G$9!#$3$l$O1Q;z$G$O$J$$%0%k!<(B +$(B%WL>$rI=<($9$k$?$a$K;H$$$^$9!#(B + +$(BNc(B: +@lisp +(setq gnus-group-name-charset-method-alist + '(((nntp "news.com.cn") . cn-gb-2312))) +@end lisp + +@item gnus-group-name-charset-group-alist +@vindex gnus-group-name-charset-group-alist +$(B%0%k!<%WL>MQ$N%0%k!<%WL>$N@55,I=8=$HJ8;z=89g$NO"A[%j%9%H$G$9!#$3$l$O1Q;z(B +$(B$G$O$J$$%0%k!<%WL>$rI=<($9$k$?$a$K;H$$$^$9!#(B + +$(BNc(B: +@lisp +(setq gnus-group-name-charset-group-alist + '(("\\.com\\.cn:" . cn-gb-2312))) +@end lisp +@end table @node Scanning New Messages @subsection $(B?7Ce%a%C%;!<%8$rC5$9(B @@ -7250,6 +7271,31 @@ CRLF $(B$NAH(B ($(B$9$J$o$A!"9T$N:G8e$N(B @samp{^M}) $(B$r(B LF $(B$KJQ49 DOS $(B$N9TKv$N@$OC$r$7$^$9(B)$(B!"$=$7$F$=$l$+$i;D$j$N(B CR $(B$r(B LF $(B$KJQ49$7$^$9(B ($(B$3$l$O(B MAC $(B$N9TKv$N@$OC$r$7$^$9(B) (@code{gnus-article-remove-cr})$(B!#(B +@c @item W 6 +@c @kindex W 6 (Summary) +@c @findex gnus-article-de-base64-unreadable +@c Treat base64 (@code{gnus-article-de-base64-unreadable}). +@c Base64 is one common @sc{mime} encoding employed when sending non-ASCII +@c (i. e., 8-bit) articles. Note that the this is usually done +@c automatically by Gnus if the message in question has a +@c @code{Content-Transfer-Encoding} header that says that this encoding has +@c been done. + +@item W Z +@kindex W Z (Summary) +@findex gnus-article-decode-HZ +HZ $(B$^$?$O(B HZP $(B$r=hM}$7$^$9!#(BHZ ($(B$^$?$O(B HZP) $(B$OCf9q8l$N5-;v$rEAAw$9$k$H$-(B +$(B$K;H$o$l$k0lHLE*$JId9g$G$9!#$3$l$O(B @samp{~@{<:Ky2;S@{#,NpJ)l6HK!#~@}} $(B$N(B +$(B$h$&$JE57?E*$JJ8;zNs$r:n$j$^$9!#(B + +@c @item W h +@c @kindex W h (Summary) +@c @findex gnus-article-wash-html +@c Treat HTML (@code{gnus-article-wash-html}). +@c Note that the this is usually done automatically by Gnus if the message +@c in question has a @code{Content-Type} header that says that this type +@c has been done. + @item W f @kindex W f $(B!J35N,!K(B @cindex x-face @@ -9043,6 +9089,12 @@ Superseding} $(B$r;2>H$7$F$/$@$5$$!#(B @code{nil} $(B$G$J$1$l$P!"(B@kbd{a} $(B$r$7$?$H$-$K!"(B@code{to-list} $(B%0%k!<%W%Q%i(B $(B%a!<%?$r$=$l$N$J$$%a!<%k%0%k!<%W$KIU$12C$($^$9!#(B +@c @item message-send-mail-partially-limit +@c @vindex message-send-mail-partially-limit +@c The limitation of messages sent as message/partial. +@c The lower bound of message size in characters, beyond which the message +@c should be sent in several parts. If it is nil, the size is unlimited. + @end table @@ -10549,7 +10601,8 @@ rm -f $TMP; $MOVEMAIL $MAIL $TMP >/dev/null && cat $TMP @item directory $(B%G%#%l%/%H%j!