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)
(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."
\e$(B$3$N@55,I=8=$K%^%C%A$9$k%0%k!<%W$O!"$=$l$,6u$G$"$k$+$I$&$+$K4X$o\e(B
\e$(B$i$:!">o$K%0%k!<%W%P%C%U%!$KI=<($5$l$^$9!#\e(B
-@end table
+@item gnus-group-name-charset-method-alist
+@vindex gnus-group-name-charset-method-alist
+\e$(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!<\e(B
+\e$(B%WL>$rI=<($9$k$?$a$K;H$$$^$9!#\e(B
+
+\e$(BNc\e(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
+\e$(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\e(B
+\e$(B$G$O$J$$%0%k!<%WL>$rI=<($9$k$?$a$K;H$$$^$9!#\e(B
+
+\e$(BNc\e(B:
+@lisp
+(setq gnus-group-name-charset-group-alist
+ '(("\\.com\\.cn:" . cn-gb-2312)))
+@end lisp
+@end table
@node Scanning New Messages
@subsection \e$(B?7Ce%a%C%;!<%8$rC5$9\e(B
DOS \e$(B$N9TKv$N@$OC$r$7$^$9\e(B)\e$(B!"$=$7$F$=$l$+$i;D$j$N\e(B CR \e$(B$r\e(B LF \e$(B$KJQ49$7$^$9\e(B
(\e$(B$3$l$O\e(B MAC \e$(B$N9TKv$N@$OC$r$7$^$9\e(B) (@code{gnus-article-remove-cr})\e$(B!#\e(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 \e$(B$^$?$O\e(B HZP \e$(B$r=hM}$7$^$9!#\e(BHZ (\e$(B$^$?$O\e(B HZP) \e$(B$OCf9q8l$N5-;v$rEAAw$9$k$H$-\e(B
+\e$(B$K;H$o$l$k0lHLE*$JId9g$G$9!#$3$l$O\e(B @samp{~@{<:Ky2;S@{#,NpJ)l6HK!#~@}} \e$(B$N\e(B
+\e$(B$h$&$JE57?E*$JJ8;zNs$r:n$j$^$9!#\e(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 \e$(B!J35N,!K\e(B
@cindex x-face
@code{nil} \e$(B$G$J$1$l$P!"\e(B@kbd{a} \e$(B$r$7$?$H$-$K!"\e(B@code{to-list} \e$(B%0%k!<%W%Q%i\e(B
\e$(B%a!<%?$r$=$l$N$J$$%a!<%k%0%k!<%W$KIU$12C$($^$9!#\e(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
@item directory
\e$(B%G%#%l%/%H%j!<Cf$NJ#?t$N%U%!%$%k$+$i%a!<%k$r<hF@$7$^$9!#$3$l$OIaDL$O\e(B
procmail \e$(B$K?7$7$$%a!<%k$r$$$/$D$+$N%U%!%$%k$KJ,3d$5$;$F$$$k$H$-$K;HMQ$5\e(B
-\e$(B$l$^$9!#\e(B
+\e$(B$l$^$9!#\e(B@code{nnmail-scan-directory-mail-source-once} \e$(B$r\e(B @code{nil} \e$(B0J30\e(B
+\e$(B$K$9$k$H!"\e(Bgnus \e$(B$O?7$7$$%a!<%k%=!<%9$r0l2s$@$1D4$Y$k$h$&$K$J$j$^$9!#\e(B
\e$(B%-!<%o!<%I\e(B:
Groups matching this regexp will always be listed in the group buffer,
whether they are empty or not.
-@end table
+@item gnus-group-name-charset-method-alist
+@vindex gnus-group-name-charset-method-alist
+An alist of method and the charset for group names. It is used to show
+non-ASCII group names.
+
+For example:
+@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
+An alist of regexp of group name and the charset for group names.
+It is used to show non-ASCII group names.
+
+For example:
+@lisp
+(setq gnus-group-name-charset-group-alist
+ '(("\\.com\\.cn:" . cn-gb-2312)))
+@end lisp
+
+@end table
@node Scanning New Messages
@subsection Scanning New Messages
CRs into LF (this takes care of Mac line endings)
(@code{gnus-article-remove-cr}).
+@item W 6
+@kindex W 6 (Summary)
+@findex gnus-article-de-base64-unreadable
+Treat base64 (@code{gnus-article-de-base64-unreadable}).
+Base64 is one common @sc{mime} encoding employed when sending non-ASCII
+(i. e., 8-bit) articles. Note that the this is usually done
+automatically by Gnus if the message in question has a
+@code{Content-Transfer-Encoding} header that says that this encoding has
+been done.
+
+@item W Z
+@kindex W Z (Summary)
+@findex gnus-article-decode-HZ
+Treat HZ or HZP (@code{gnus-article-decode-HZ}). HZ (or HZP) is one
+common encoding employed when sending Chinese articles. It typically
+makes strings look like @samp{~@{<:Ky2;S@{#,NpJ)l6HK!#~@}}.
+
+@item W h
+@kindex W h (Summary)
+@findex gnus-article-wash-html
+Treat HTML (@code{gnus-article-wash-html}).
+Note that the this is usually done automatically by Gnus if the message
+in question has a @code{Content-Type} header that says that this type
+has been done.
+
@item W f
@kindex W f (Summary)
@cindex x-face
If non-@code{nil}, add a @code{to-list} group parameter to mail groups
that have none when you do a @kbd{a}.
+@item message-send-mail-partially-limit
+@vindex message-send-mail-partially-limit
+The limitation of messages sent as message/partial.
+The lower bound of message size in characters, beyond which the message
+should be sent in several parts. If it is nil, the size is unlimited.
+
@end table
@item directory
Get mail from several files in a directory. This is typically used when
-you have procmail split the incoming mail into several files.
+you have procmail split the incoming mail into several files. Setting
+@code{nnmail-scan-directory-mail-source-once} to non-nil force Gnus to
+scan the mail source only once.
Keywords: