+1999-06-02 Tanaka Akira <akr@jaist.ac.jp>
+
+ * Sync up to flim-1_12_7 from flim-1_12_5.
+
+ * mime-def.el (mime-library-product): Bump up to FLAM-DOODLE
+ 1.12.6.
+
1999-05-26 Tanaka Akira <akr@jaist.ac.jp>
* TESTPAT: Does not treat =?= as encoded-word.
* eword-decode.el: Copied from AKEMI branch of SEMI.
\f
+1999-05-31 MORIOKA Tomohiko <tomo@m17n.org>
+
+ * FLIM: Version 1.12.7 (Y\e-Dþzaki)\e-A released.
+
+1999-05-31 MORIOKA Tomohiko <tomo@m17n.org>
+
+ * mime-en.sgml (Network representation of header): Translate.
+
+1999-05-27 Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+
+ * mel-b-el.el (pack-sequence): Eliminate local variable `i'.
+ (base64-encode-1): Avoid concat.
+ (base64-encode-string): Fixed last change; extra padding.
+
+1999-05-26 MORIOKA Tomohiko <tomo@m17n.org>
+
+ * smtpmail.el (smtpmail-default-smtp-server): Define obsolete
+ variable alias for XEmacs.
+ (smtpmail-smtp-server): Likewise.
+ (smtpmail-smtp-service): Likewise.
+ (smtpmail-local-domain): Likewise.
+ (smtpmail-debug-info): Likewise.
+ (smtpmail-send-it): Check function `expand-mail-aliases' is
+ defined.
+
+1999-05-26 MORIOKA Tomohiko <tomo@m17n.org>
+
+ * smtp.el (smtp-debug-info): Now a user option.
+
+1999-05-25 Yoshiki Hayashi <g740685@komaba.ecc.u-tokyo.ac.jp>
+
+ * README.ja: Modify URL and required version of APEL.
+
+1999-05-24 Tanaka Akira <akr@jaist.ac.jp>
+
+ * mel-b-ccl.el (base64-encode-string): New alias.
+ (base64-encode-region): Ditto.
+ (base64-decode-string): Ditto.
+ (base64-decode-region): Ditto.
+
+1999-05-24 Tanaka Akira <akr@jaist.ac.jp>
+
+ * mel-b-ccl.el, mel-q-ccl.el: Sync up with doodle-1.12.5.
+
+1999-05-24 MORIOKA Tomohiko <tomo@m17n.org>
+
+ * eword-encode.el (ew-space-process): Renamed from
+ `tm-eword::space-process'.
+
+1999-05-24 MORIOKA Tomohiko <tomo@m17n.org>
+
+ * eword-encode.el (tm-eword::space-process): Don't concatenate
+ `special's.
+ (ew-encode-rword-1): Renamed from `tm-eword::encode-string-1'; add
+ new optional argument `must-output'; return nil if it can't encode
+ literally.
+ (eword-encode-rword-list): Fold SPACE or TAB in the encoded string
+ if `ew-encode-rword-1' can't encode literally and it is possible
+ to encode the rest literally with the folding.
+ (eword-encode-phrase-to-rword-list): Add `special' flag to
+ brackets of comments.
+
+1999-05-22 Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+
+ * smtpmail.el: Require 'poe and 'pcustom.
+
+1999-05-22 Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+
+ * mel.el: Update header.
+ Require 'path-util and don't require 'poem.
+ (mel-use-module): Eliminate local variable `encoding'.
+ (mime-insert-encoded-file for mel-b-builtin):
+ Use built-in `interactive' spec.
+ (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'".
+ (mime-encode-region): Capitalize prompt string.
+ (mime-decode-region): Ditto.
+ (mime-insert-encoded-file): Ditto.
+ (mime-write-decoded-region): Ditto.
+
+ * mel-b-ccl.el: Update header.
+ (base64-ccl-encode-region): Use read-only `interactive' spec.
+ (base64-ccl-decode-region): Ditto.
+ (base64-ccl-insert-encoded-file): Use built-in `interactive' spec.
+ (base64-ccl-write-decoded-region): Ditto.
+ (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'".
+
+ * mel-b-dl.el: Update header.
+ Don't require 'poe; it is required implicitly via 'mime-def.
+ (base64-dl-handle): Chech whether `base64-dl-module' is string.
+ Defalias `base64-encode-string' and `base64-decode-string' just
+ after `dynamic-call'ing "emacs_base64_init".
+ (base64-encode-region): Use read-only `interactive' spec.
+ Use `base64-encode-string'.
+ Changed order of evaluation to "encode, delete, then insert".
+ (base64-decode-region): Renamed from `decode-base64-region'.
+ Use read-only `interactive' spec.
+ Use `base64-decode-string'.
+ Changed order of evaluation to "decode, delete, then insert".
+ (mime-encode-string): Use `base64-encode-string'.
+ (mime-decode-string): Use `base64-decode-string'.
+ (mime-decode-region): Use `base64-decode-region'.
+ (encoded-text-encode-string): Use `base64-encode-string'.
+ (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'".
+ (mime-insert-encoded-file): Use built-in `interactive' spec.
+ (mime-write-decoded-region in comment): Ditto.
+
+ * mel-b-el.el: Update header.
+ Don't require 'poe; it is required implicitly via 'mime-def.
+ (pack-sequence): Moved to top of the function definitions.
+ (base64-encode-string): Calculate padding first.
+ (base64-internal-encode-region): Changed order of evaluation to
+ "encode, delete, then insert".
+ (base64-internal-decode-string): Changed order of evaluation to
+ "decode, delete, then insert".
+ (base64-encode-region): Use read-only `interactive' spec.
+ (base64-decode-region): Ditto.
+ (base64-decode-string): Not interactive.
+ (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'".
+ (base64-insert-encoded-file): Use built-in `interactive' spec.
+ (base64-write-decoded-region): Ditto.
+
+ * mel-g.el: Update header.
+ Require 'mime-def instead of 'poem and 'mel.
+ (mime-insert-encoded-file): Use built-in `interactive' spec.
+ (mime-write-decoded-region): Ditto.
+
+ * mel-q-ccl.el: Update header.
+ (quoted-printable-ccl-encode-region):
+ Use read-only `interactive' spec.
+ (quoted-printable-ccl-decode-region): Ditto.
+ (quoted-printable-ccl-insert-encoded-file):
+ Use built-in `interactive' spec.
+ (quoted-printable-ccl-write-decoded-region): Ditto.
+ (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'".
+
+ * mel-q.el: Update header.
+ Require 'path-util instead of 'emu.
+ (quoted-printable-internal-encode-region): Rewrite without regexp.
+ (quoted-printable-internal-decode-region): Ditto.
+ (quoted-printable-encode-region): Use read-only `interactive' spec.
+ (quoted-printable-decode-region): Ditto.
+ (mime-insert-encoded-file): Use built-in `interactive' spec.
+ (mime-write-decoded-region): Ditto.
+ (encoded-text-decode-string): Anchor regexp with "\\`" and "\\'".
+
+ * mel-u.el: Update header.
+ Require 'path-util instead of 'emu.
+ (mime-insert-encoded-file): Use built-in `interactive' spec.
+ (mime-write-decoded-region): Ditto.
+
+1999-05-22 Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+
+ * mime-def.el: Require 'poe, 'poem, and 'pcustom.
+ (mime): Declare `default-mime-charset' as an initial member.
+
+ * mime-parse.el: Don't require 'cl at compile-time.
+
+ * mailcap.el (mailcap-look-at-qchar): Use `char-after'.
+
+ * std11.el: Require 'poe, 'poem, and 'pcustom.
+
+ * smtp.el: Update header.
+ Require 'poe, 'poem, and 'pcustom.
+ Require 'cl at compile-time.
+
+1999-05-21 MORIOKA Tomohiko <tomo@m17n.org>
+
+ * README.en (Installation): Modify URL and required version of
+ APEL.
+
+ * eword-encode.el (ew-find-charset-rule): Renamed from
+ `tm-eword::find-charset-rule'; use
+ `find-mime-charset-by-charsets'.
+
+\f
+1999-05-11 MORIOKA Tomohiko <tomo@m17n.org>
+
+ * FLIM: Version 1.12.6 (Family-K\e-Dòenmae)\e-A released.
+
+1999-04-27 Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+
+ * mel-b-ccl.el (TopLevel): Suppress warning.
+ mel-q-ccl.el (TopLevel): Ditto.
+ mime.el (TopLevel): Ditto.
+
+1999-04-26 Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+
+ * eword-decode.el (eword-encoded-word-regexp): Accept "b" and "q"
+ for "encoding".
+
+ * mime-def.el (std11-qtext-regexp): Don't use `string'.
+ (mime-tspecial-char-list): Eval at compile time.
+
+1999-04-22 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * mime.el: Delete autoload setting for `eword-encode-field'.
+
+1999-04-22 MORIOKA Tomohiko <tomo@etl.go.jp>
+
+ * eword-encode.el: Require `poem' instead of `emu'.
+ Don't use `cl' for `caar'.
+
+1999-04-09 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * smtp.el (smtp-via-smtp): Funcall `smtp-server' if it is a
+ function.
+ (smtp-server): Make it can also be a function called from
+ `smtp-via-smtp' with arguments SENDER and RECIPIENTS.
+
+1999-04-05 Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+
+ * FLIM-CFG: Make easier to install in VERSION_SPECIFIC_LISPDIR.
+
+1999-03-29 Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+
+ * mime.el (mime-read-field): Correct argument of
+ `mime-decode-field-body'; 'native -> 'plain.
+
+1999-03-27 Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+
+ * eword-encode.el (TopLevel): Require 'cl when compiling.
+ (eword-encode-rword-list): Suppress insertion of extra spaces.
+ (eword-encode-msg-id-to-rword-list): Treat surrounding angle
+ brackets atomically.
+ ([tm-ja:4244] by Kazuhiro Ohta <ohta@ele.cst.nihon-u.ac.jp>)
+
+1999-03-11 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * eword-encode.el (eword-charset-encoding-alist): Add `tis-620'.
+
+1999-03-01 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mel.el (mime-decode-string): Return STRING if return value of
+ `(mel-find-function 'mime-decode-string encoding)' is nil.
+
+1999-02-10 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-def.el (mel-define-service): Change size of obarray to 7.
+
+1999-02-01 Yoshiki Hayashi <g740685@komaba.ecc.u-tokyo.ac.jp>
+
+ * mime-ja.sgml: Tranlate all untranslated parts.
+
+\f
1999-01-27 MORIOKA Tomohiko <morioka@jaist.ac.jp>
* FLIM: Version 1.12.5 (Hirahata) released.
1998-11-12 Tanaka Akira <akr@jaist.ac.jp>
- * mel-q-ccl.el (mel-ccl-encode-quoted-printable-generic): workaround
+ * mel-q-ccl.el (mel-ccl-encode-quoted-printable-generic): workaround
for mule-2.3@19.34.
1998-11-12 Tanaka Akira <akr@jaist.ac.jp>
* Move variable `mel-encoding-module-alist' from mel.el to
mime-def.el.
-
+
* mel.el (mel-find-function): Use function
`mel-find-function-from-obarray'.
Use `mel-define-backend' to define "7bit", "8bit" and "binary";
(mime-insert-encoded-file): Use `mel-define-method'; abolish
`base64-insert-encoded-file'.
(mime-write-decoded-region): Use `mel-define-method'; abolish
- `base64-write-decoded-region'.
+ `base64-write-decoded-region'.
- Move `base64-encoded-length' to mel.el.
* mel-dl.el (base64-encode-region): Define directly (abolish
* eword-decode.el (eword-decode-ignored-field-list): Add
`received'.
-
+
* mel.el (mime-temp-directory): Use TMPDIR, TMP, or TEMP
environment variables.
eword-encode.el: Copied from MEL, SEMI (mime-def.el
eword-decode.el eword-encode.el) and APEL (std11-parse.el
std11.el).
->
25 \e$B>GCc\e(B \e$B$3$2$A$c\e(B 10R3.0/2.0 FLAM-DOODLE 1.12.3
26 \e$B7*Hi\e(B \e$B$/$j$+$O\e(B 10R3.0/4.0 FLAM-DOODLE 1.12.4
27 \e$BFP\e(B \e$B$H$S\e(B 10R4.0/7.0 FLAM-DOODLE 1.12.5
- 28 \e$B3w\e(B \e$B$+$P\e(B 10R4.0/5.0
+ 28 \e$B3w\e(B \e$B$+$P\e(B 10R4.0/5.0 FLAM-DOODLE 1.12.6
29 \e$B2+H'@w\e(B \e$B$3$&$m$;$s\e(B 2.5Y5.0/4.0
30 \e$BCz;RCc\e(B \e$B$A$g$&$8$A$c\e(B 5.0YR4.0/4.0
31 \e$B<F\e(B \e$B$U$7\e(B 10YR4.0/4.0
(add-to-list 'load-path (expand-file-name "apel" LISPDIR))
))
-(defvar VERSION_SPECIFIC_LISPDIR nil)
-
-(if VERSION_SPECIFIC_LISPDIR
+(if (boundp 'VERSION_SPECIFIC_LISPDIR)
(add-to-list 'load-path VERSION_SPECIFIC_LISPDIR))
(require 'install)
(defvar LISPDIR (install-detect-elisp-directory PREFIX))
;; (setq install-default-elisp-directory "~/lib/emacs/lisp")
+(defvar VERSION_SPECIFIC_LISPDIR
+ (install-detect-elisp-directory PREFIX nil 'version-specific))
+
+;; (setq FLIM_DIR (expand-file-name FLIM_PREFIX VERSION_SPECIFIC_LISPDIR))
(setq FLIM_DIR (expand-file-name FLIM_PREFIX LISPDIR))
(defvar PACKAGEDIR
PACKAGE = flim
API = 1.12
-RELEASE = 5
+RELEASE = 7
TAR = tar
RM = /bin/rm -f
FILES = README.?? Makefile FLIM-MK FLIM-CFG FLIM-ELS *.el ChangeLog
VERSION = $(API).$(RELEASE)
-ARC_DIR = /pub/GNU/elisp/flim/$(PACKAGE)-$(API)
-SEMI_ARC_DIR = /pub/GNU/elisp/semi/semi-1.13-for-flim-$(API)
+ARC_DIR = /pub/mule/flim/$(PACKAGE)-$(API)
+SEMI_ARC_DIR = /pub/mule/semi/semi-1.13-for-flim-$(API)
elc: ew-parse.el
$(EMACS) $(FLAGS) -l FLIM-MK -f compile-flim $(PREFIX) $(LISPDIR) \
Installation
============
-(0) before installing it, please install APEL (9.12 or later) package.
+(0) before installing it, please install APEL (9.19 or later) package.
APEL package is available at:
- ftp://ftp.jaist.ac.jp/pub/GNU/elisp/apel/
+ ftp://ftp.etl.go.jp/pub/mule/apel/
(1-a) run in expanded place
\e$BF3F~\e(B (install)
==============
-(0) \e$BF3F~\e(B (install) \e$B$9$kA0$K!"\e(BAPEL (9.12 \e$B0J9_\e(B) \e$B$rF3F~$7$F$/$@$5$$!#\e(BAPEL
+(0) \e$BF3F~\e(B (install) \e$B$9$kA0$K!"\e(BAPEL (9.19 \e$B0J9_\e(B) \e$B$rF3F~$7$F$/$@$5$$!#\e(BAPEL
\e$B$O0J2<$N$H$3$m$G<hF@$G$-$^$9\e(B:
- ftp://ftp.jaist.ac.jp/pub/GNU/elisp/apel/
+ ftp://ftp.etl.go.jp/pub/mule/apel/
(1-a) \e$BE83+$7$?>l=j$X$NF3F~\e(B
;; Kinki Nippon Railway \e$(B6a5&F|K\E4F;\e(B http://www.kintetsu.co.jp/
;; Ky\e-Dòto\e-A Line \e$(B3`86@~\e(B
;;-------------------------------------------------------------------------
- (Saidaiji) (\e$(B@>Bg;{\e(B) ; \e$(B!{J?>k5\@W!"@>Bg;{\e(B
-1.12.0 Amagatsuji \e$(BFt%vDT\e(B ; \e$(B!{?b?NE79DNM\e(B
-1.12.1 Nishinoky\e-Dò\e-A \e$(B@>$N5~\e(B ; \e$(B!{Eb>7Ds;{!"Lt;U;{\e(B
+ (Saidaiji) (\e$(B@>Bg;{\e(B)
+1.12.0 Amagatsuji \e$(BFt%vDT\e(B
+1.12.1 Nishinoky\e-Dò\e-A \e$(B@>$N5~\e(B
1.12.2 Kuj\e-Dò\e-A \e$(B6e>r\e(B
-1.12.3 Kintetsu-K\e-Dòriyama\e-A \e$(B6aE474;3\e(B ; \e$(B!{74;3>k@W!"\e(B
- ; \e$(B%"%Z%k!"%]!<!"CcHx$N2H\e(B
+1.12.3 Kintetsu-K\e-Dòriyama\e-A \e$(B6aE474;3\e(B
1.12.4 Tsutsui \e$(BE{0f\e(B
1.12.5 Hirahata \e$(BJ?C<\e(B ; = \e$(B6aE4\e(B \e$(BE7M}@~\e(B
+1.12.6 Family-K\e-Dòenmae\e-A \e$(B%U%!%_%j!<8x1`A0\e(B
+1.12.7 Y\e-Dþzaki\e-A \e$(B7k:j\e(B
+------ Iwami \e$(B@P8+\e(B
+------ Tawaramoto \e$(BED86K\\e(B ; <=> \e$(B6aE4\e(B \e$(B@>ED86K\\e(B
+------ Kasanui \e$(B3^K%\e(B
+------ Ninokuchi \e$(B?7%N8}\e(B
+------ Yagi \e$(BH,LZ\e(B ; = \e$(B6aE4\e(B \e$(BBg:e@~\e(B
+------ Yagi-Nishiguchi \e$(BH,LZ@>8}\e(B
+------ Unebigory\e-Dòmae\e-A \e$(B@&K58fNMA0\e(B
+------ Kashiharajingu-mae \e$(B3`86?@5\A0\e(B ; = \e$(B6aE4\e(B \e$(BFnBg:e@~!"5HLn@~\e(B
[Chao Version names]
;;; Code:
-(require 'std11)
-(require 'mel)
(require 'mime-def)
+(require 'mel)
+(require 'std11)
(require 'ew-dec)
(require 'ew-line)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl)) ; list*, pop
(defgroup eword-decode nil
"Encoded-word decoding"
mime-charset-regexp
"\\)"
(regexp-quote "?")
- "\\(B\\|Q\\)"
+ "\\([BbQq]\\)"
(regexp-quote "?")
"\\("
eword-encoded-text-regexp
;;; Code:
-(require 'emu)
+(require 'mime-def)
(require 'mel)
(require 'std11)
-(require 'mime-def)
(require 'eword-decode)
(cn-gb . "B")
(cn-gb-2312 . "B")
(euc-kr . "B")
+ (tis-620 . "B")
(iso-2022-jp-2 . "B")
(iso-2022-int-1 . "B")
(utf-8 . "B")
(defmacro ew-rword-type (rword)
(` (car (cdr (cdr (cdr (, rword)))))))
-(defun tm-eword::find-charset-rule (charsets)
+(defun ew-find-charset-rule (charsets)
(if charsets
- (let* ((charset (charsets-to-mime-charset charsets))
- (encoding (cdr (assq charset eword-charset-encoding-alist)))
- )
+ (let* ((charset (find-mime-charset-by-charsets charsets))
+ (encoding (cdr (or (assq charset eword-charset-encoding-alist)
+ '(nil . "Q")))))
(list charset encoding)
)))
(defun tm-eword::words-to-ruled-words (wl &optional mode)
(mapcar (function
(lambda (word)
- (let ((ret (tm-eword::find-charset-rule (car word))))
+ (let ((ret (ew-find-charset-rule (car word))))
(make-ew-rword (cdr word) (car ret)(nth 1 ret) mode)
)))
wl))
-(defun tm-eword::space-process (seq)
+(defun ew-space-process (seq)
(let (prev a ac b c cc)
(while seq
(setq b (car seq))
(setq seq (cdr seq))
(setq c (car seq))
(setq cc (ew-rword-charset c))
- (if (null (ew-rword-charset b))
+ (if (and (null (ew-rword-charset b))
+ (not (eq (ew-rword-type b) 'special)))
(progn
(setq a (car prev))
(setq ac (ew-rword-charset a))
))
(defun eword-encode-split-string (str &optional mode)
- (tm-eword::space-process
+ (ew-space-process
(tm-eword::words-to-ruled-words
(eword-encode-charset-words-to-words
(eword-encode-divide-into-charset-words str))
;;; @ encode-string
;;;
-(defun tm-eword::encode-string-1 (column rwl)
- (let* ((rword (car rwl))
- (ret (tm-eword::encoded-word-length rword))
- string len)
- (if (null ret)
- (cond ((and (setq string (car rword))
- (or (<= (setq len (+ (length string) column)) 76)
- (<= column 1))
+(defun ew-encode-rword-1 (column rwl &optional must-output)
+ (catch 'can-not-output
+ (let* ((rword (car rwl))
+ (ret (tm-eword::encoded-word-length rword))
+ string len)
+ (if (null ret)
+ (cond ((and (setq string (car rword))
+ (or (<= (setq len (+ (length string) column)) 76)
+ (<= column 1))
+ )
+ (setq rwl (cdr rwl))
+ )
+ ((memq (aref string 0) '(? ?\t))
+ (setq string (concat "\n" string)
+ len (length string)
+ rwl (cdr rwl))
+ )
+ (must-output
+ (setq string "\n "
+ len 1)
+ )
+ (t
+ (throw 'can-not-output nil)
+ ))
+ (cond ((and (setq len (car ret))
+ (<= (+ column len) 76)
)
+ (setq string
+ (eword-encode-text
+ (ew-rword-charset rword)
+ (ew-rword-encoding rword)
+ (cdr ret)
+ (ew-rword-type rword)
+ ))
+ (setq len (+ (length string) column))
(setq rwl (cdr rwl))
)
(t
- (setq string "\n ")
- (setq len 1)
- ))
- (cond ((and (setq len (car ret))
- (<= (+ column len) 76)
- )
- (setq string
- (eword-encode-text
- (ew-rword-charset rword)
- (ew-rword-encoding rword)
- (cdr ret)
- (ew-rword-type rword)
- ))
- (setq len (+ (length string) column))
- (setq rwl (cdr rwl))
- )
- (t
- (setq string (car rword))
- (let* ((p 0) np
- (str "") nstr)
- (while (and (< p len)
- (progn
- (setq np (char-next-index (sref string p) p))
- (setq nstr (substring string 0 np))
- (setq ret (tm-eword::encoded-word-length
- (cons nstr (cdr rword))
- ))
- (setq nstr (cdr ret))
- (setq len (+ (car ret) column))
- (<= len 76)
- ))
- (setq str nstr
- p np))
- (if (string-equal str "")
- (setq string "\n "
- len 1)
- (setq rwl (cons (cons (substring string p) (cdr rword))
- (cdr rwl)))
- (setq string
- (eword-encode-text
- (ew-rword-charset rword)
- (ew-rword-encoding rword)
- str
- (ew-rword-type rword)))
- (setq len (+ (length string) column))
- )
- )))
- )
- (list string len rwl)
- ))
+ (setq string (car rword))
+ (let* ((p 0) np
+ (str "") nstr)
+ (while (and (< p len)
+ (progn
+ (setq np (char-next-index (sref string p) p))
+ (setq nstr (substring string 0 np))
+ (setq ret (tm-eword::encoded-word-length
+ (cons nstr (cdr rword))
+ ))
+ (setq nstr (cdr ret))
+ (setq len (+ (car ret) column))
+ (<= len 76)
+ ))
+ (setq str nstr
+ p np))
+ (if (string-equal str "")
+ (if must-output
+ (setq string "\n "
+ len 1)
+ (throw 'can-not-output nil))
+ (setq rwl (cons (cons (substring string p) (cdr rword))
+ (cdr rwl)))
+ (setq string
+ (eword-encode-text
+ (ew-rword-charset rword)
+ (ew-rword-encoding rword)
+ str
+ (ew-rword-type rword)))
+ (setq len (+ (length string) column))
+ )
+ )))
+ )
+ (list string len rwl)
+ )))
(defun eword-encode-rword-list (column rwl)
- (let (ret dest ps special str ew-f pew-f)
+ (let (ret dest str ew-f pew-f folded-points)
(while rwl
(setq ew-f (nth 2 (car rwl)))
(if (and pew-f ew-f)
pew-f nil)
(setq pew-f ew-f)
)
- (setq ret (tm-eword::encode-string-1 column rwl))
+ (if (null (setq ret (ew-encode-rword-1 column rwl)))
+ (let ((i (1- (length dest)))
+ c s r-dest r-column)
+ (catch 'success
+ (while (catch 'found
+ (while (>= i 0)
+ (cond ((memq (setq c (aref dest i)) '(? ?\t))
+ (if (memq i folded-points)
+ (throw 'found nil)
+ (setq folded-points (cons i folded-points))
+ (throw 'found i))
+ )
+ ((eq c ?\n)
+ (throw 'found nil)
+ ))
+ (setq i (1- i))))
+ (setq s (substring dest i)
+ r-column (length s)
+ r-dest (concat (substring dest 0 i) "\n" s))
+ (when (setq ret (ew-encode-rword-1 r-column rwl))
+ (setq dest r-dest
+ column r-column)
+ (throw 'success t)
+ ))
+ (setq ret (ew-encode-rword-1 column rwl 'must-output))
+ )))
(setq str (car ret))
- (if (eq (elt str 0) ?\n)
- (if (eq special ?\()
- (progn
- (setq dest (concat dest "\n ("))
- (setq ret (tm-eword::encode-string-1 2 rwl))
- (setq str (car ret))
- ))
- (cond ((eq special ? )
- (if (string= str "(")
- (setq ps t)
- (setq dest (concat dest " "))
- (setq ps nil)
- ))
- ((eq special ?\()
- (if ps
- (progn
- (setq dest (concat dest " ("))
- (setq ps nil)
- )
- (setq dest (concat dest "("))
- )
- )))
- (cond ((string= str " ")
- (setq special ? )
- )
- ((string= str "(")
- (setq special ?\()
- )
- (t
- (setq special nil)
- (setq dest (concat dest str))
- ))
+ (setq dest (concat dest str))
(setq column (nth 1 ret)
rwl (nth 2 ret))
)
(setq dest
(append dest
(list
- (let ((ret (tm-eword::find-charset-rule
+ (let ((ret (ew-find-charset-rule
(find-non-ascii-charset-string str))))
(make-ew-rword
str (car ret)(nth 1 ret) 'phrase)
((eq type 'comment)
(setq dest
(append dest
- '(("(" nil nil))
+ '(("(" nil nil special))
(tm-eword::words-to-ruled-words
(eword-encode-charset-words-to-words
(eword-encode-divide-into-charset-words
(cdr token)))
'comment)
- '((")" nil nil))
+ '((")" nil nil special))
))
)
(t
))
(setq phrase (cdr phrase))
)
- (tm-eword::space-process dest)
+ (ew-space-process dest)
))
(defun eword-encode-addr-seq-to-rword-list (seq)
dest))
(defsubst eword-encode-msg-id-to-rword-list (msg-id)
- (cons '(" " nil nil)
- (cons '("<" nil nil)
- (nconc (eword-encode-addr-seq-to-rword-list (cdr msg-id))
- '((">" nil nil))))))
+ (list
+ (list
+ (concat "<"
+ (caar (eword-encode-addr-seq-to-rword-list (cdr msg-id)))
+ ">")
+ nil nil)))
(defsubst eword-encode-in-reply-to-to-rword-list (in-reply-to)
(let (dest)
It is available from
- ftp://ftp.jaist.ac.jp/pub/GNU/elisp/flim/flim-API
+ ftp://ftp.etl.go.jp/pub/mule/flim/flim-API
--[[message/external-body;
access-type=anon-ftp;
- site="ftp.jaist.ac.jp";
- directory="/pub/GNU/elisp/flim/flim-API";
+ site="ftp.etl.go.jp";
+ directory="/pub/mule/flim/flim-API";
name="flim-VERSION.tar.gz";
mode=image]]
Content-Type: application/octet-stream;
(forward-char)))))
(defsubst mailcap-look-at-qchar ()
- (let ((chr (char-after (point))))
- (when (eq chr ?\\)
- (forward-char 2)
- (char-before (point))
- )))
+ (when (eq (char-after (point)) ?\\)
+ (prog2
+ (forward-char)
+ (char-after (point))
+ (forward-char))))
(defsubst mailcap-look-at-mtext ()
(let ((beg (point)))
(while (or (mailcap-look-at-qchar)
(mailcap-look-at-schar)))
- (buffer-substring beg (point))
- ))
+ (buffer-substring beg (point))))
;;; @ field
-;;; mel-b-ccl.el: CCL based encoder/decoder of Base64
+;;; mel-b-ccl.el --- Base64 encoder/decoder using CCL.
;; Copyright (C) 1998 Tanaka Akira
;; 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
+;; along with this program; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
(logand v (lsh 255 8))
(lsh (logand v 255) 16)))
+)
+
+(eval-when-compile
+
(defconst mel-ccl-decode-b-0-table
(vconcat
(mapcar
(if no-line-break
(decode-coding-string string 'mel-ccl-b-rev)
(decode-coding-string string 'mel-ccl-base64-lf-rev)))
+ (defalias-maybe 'base64-encode-string 'base64-ccl-encode-string)
(defun base64-ccl-encode-region (start end &optional no-line-break)
"Encode region from START to END with base64 encoding."
- (interactive "r")
+ (interactive "*r")
(if no-line-break
(decode-coding-region start end 'mel-ccl-b-rev)
(decode-coding-region start end 'mel-ccl-base64-lf-rev)))
+ (defalias-maybe 'base64-encode-region 'base64-ccl-encode-region)
(defun base64-ccl-insert-encoded-file (filename)
"Encode contents of file FILENAME to base64, and insert the result."
- (interactive (list (read-file-name "Insert encoded file: ")))
+ (interactive "*fInsert encoded file: ")
(insert-file-contents-as-coding-system 'mel-ccl-base64-lf-rev filename))
(mel-define-method-function (mime-encode-string string (nil "base64"))
(defun base64-ccl-decode-string (string)
"Decode base64 encoded STRING"
(encode-coding-string string 'mel-ccl-b-rev))
+(defalias-maybe 'base64-decode-string 'base64-ccl-decode-string)
(defun base64-ccl-decode-region (start end)
"Decode base64 encoded the region from START to END."
- (interactive "r")
+ (interactive "*r")
(encode-coding-region start end 'mel-ccl-b-rev))
+(defalias-maybe 'base64-decode-region 'base64-ccl-decode-region)
(defun base64-ccl-write-decoded-region (start end filename)
"Decode the region from START to END and write out to FILENAME."
- (interactive
- (list (region-beginning) (region-end)
- (read-file-name "Write decoded region to file: ")))
+ (interactive "*r\nFWrite decoded region to file: ")
(write-region-as-coding-system 'mel-ccl-b-rev start end filename))
(mel-define-method-function (mime-decode-string string (nil "base64"))
'base64-ccl-write-decoded-region)
(mel-define-method encoded-text-decode-string (string (nil "B"))
- (if (and (string-match B-encoded-text-regexp string)
- (string= string (match-string 0 string)))
+ (if (string-match (eval-when-compile
+ (concat "\\`" B-encoded-text-regexp "\\'"))
+ string)
(base64-ccl-decode-string string)
(error "Invalid encoded-text %s" string)))
(provide 'mel-b-ccl)
-;;; mel-b-ccl.el ends here
+;;; mel-b-ccl.el ends here.
-;;; mel-b-dl.el: Base64 encoder/decoder using DL module
+;;; mel-b-dl.el --- Base64 encoder/decoder using DL module.
;; Copyright (C) 1998 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Keywords: MIME, Base64
-;; This file is part of MEL (MIME Encoding Library).
+;; This file is part of FLIM (Faithful Library about Internet Message).
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; 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
+;; along with this program; 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 'poe)
(require 'mime-def)
(eval-and-compile
(defvar base64-dl-handle
- (and (file-exists-p base64-dl-module)
+ (and (stringp base64-dl-module)
+ (file-exists-p base64-dl-module)
(dynamic-link base64-dl-module)))
(dynamic-call "emacs_base64_init" base64-dl-handle)
)
+;; base64-dl-module provides `encode-base64-string' and `decode-base64-string'.
+(defalias 'base64-encode-string 'encode-base64-string)
+(defalias 'base64-decode-string 'decode-base64-string)
+
(defun base64-encode-region (start end)
"Encode current region by base64.
START and END are buffer positions."
- (interactive "r")
- (let ((str (buffer-substring start end)))
- (delete-region start end)
- (insert (encode-base64-string str))
- )
- (or (bolp)
- (insert "\n"))
- )
-
-(defun decode-base64-region (start end)
+ (interactive "*r")
+ (insert
+ (prog1
+ (base64-encode-string
+ (buffer-substring start end))
+ (delete-region start end)))
+ (or (bolp) (insert ?\n)))
+
+(defun base64-decode-region (start end)
"Decode current region by base64.
START and END are buffer positions."
- (interactive "r")
- (let ((str (buffer-substring start end)))
- (delete-region start end)
- (condition-case err
- (insert (decode-base64-string str))
- (error (message (nth 1 err)))
- )))
-
-(defalias 'base64-encode-string 'encode-base64-string)
-(defalias 'base64-decode-string 'decode-base64-string)
+ (interactive "*r")
+ (insert
+ (prog1
+ (base64-decode-string
+ (buffer-substring start end))
+ (delete-region start end))))
(mel-define-method-function (mime-encode-string string (nil "base64"))
- 'encode-base64-string)
+ 'base64-encode-string)
(mel-define-method-function (mime-decode-string string (nil "base64"))
- 'decode-base64-string)
+ 'base64-decode-string)
(mel-define-method-function (mime-encode-region start end (nil "base64"))
'base64-encode-region)
(mel-define-method-function (mime-decode-region start end (nil "base64"))
- 'decode-base64-region)
+ 'base64-decode-region)
(mel-define-method-function (encoded-text-encode-string string (nil "B"))
- 'encode-base64-string)
+ 'base64-encode-string)
(mel-define-method encoded-text-decode-string (string (nil "B"))
- (if (and (string-match B-encoded-text-regexp string)
- (string= string (match-string 0 string)))
- (decode-base64-string string)
+ (if (string-match (eval-when-compile
+ (concat "\\`" B-encoded-text-regexp "\\'"))
+ string)
+ (base64-decode-string string)
(error "Invalid encoded-text %s" string)))
It calls external base64 encoder specified by
`base64-external-encoder'. So you must install the program (maybe
mmencode included in metamail or XEmacs package)."
- (interactive (list (read-file-name "Insert encoded file: ")))
- (insert (encode-base64-string
+ (interactive "*fInsert encoded file: ")
+ (insert (base64-encode-string
(with-temp-buffer
(set-buffer-multibyte nil)
(insert-file-contents-as-binary filename)
(buffer-string))))
- (or (bolp)
- (insert "\n"))
- )
+ (or (bolp) (insert ?\n)))
;; (mel-define-method mime-write-decoded-region (start end filename
;; (nil "base64"))
;; "Decode and write current region encoded by base64 into FILENAME.
;; START and END are buffer positions."
-;; (interactive
-;; (list (region-beginning) (region-end)
-;; (read-file-name "Write decoded region to file: ")))
+;; (interactive "*r\nFWrite decoded region to file: ")
;; (let ((str (buffer-substring start end)))
;; (with-temp-buffer
-;; (insert (decode-base64-string str))
-;; (write-region-as-binary (point-min) (point-max) filename)
-;; )))
+;; (insert (base64-decode-string str))
+;; (write-region-as-binary (point-min)(point-max) filename))))
;;; @ end
-;;; mel-b-el.el: Base64 encoder/decoder for GNU Emacs
+;;; mel-b-el.el --- Base64 encoder/decoder.
;; Copyright (C) 1992,1995,1996,1997,1998 Free Software Foundation, Inc.
;; Author: ENAMI Tsugutomo <enami@sys.ptg.sony.co.jp>
-;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Created: 1995/6/24
;; Keywords: MIME, Base64
-;; This file is part of MEL (MIME Encoding Library).
+;; This file is part of FLIM (Faithful Library about Internet Message).
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; 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
+;; along with this program; 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 'poe)
(require 'mime-def)
(integer :tag "Size")))
+;;; @ utility function
+;;;
+
+(defun pack-sequence (seq size)
+ "Split sequence SEQ into SIZE elements packs, and return list of packs.
+\[mel-b-el; tl-seq function]"
+ (let ((len (length seq))
+ (p 0)
+ dest unit)
+ (while (< p len)
+ (setq unit (cons (elt seq p) unit))
+ (setq p (1+ p))
+ (when (zerop (mod p size))
+ (setq dest (cons (nreverse unit) dest))
+ (setq unit nil)))
+ (if unit
+ (nreverse (cons (nreverse unit) dest))
+ (nreverse dest))))
+
+
;;; @ internal base64 encoder
;;; based on base64 decoder by Enami Tsugutomo
`(aref base64-characters ,n))
(defun base64-encode-1 (pack)
- (let ((a (car pack))
- (b (nth 1 pack))
- (c (nth 2 pack)))
- (concat
- (char-to-string (base64-num-to-char (ash a -2)))
- (if b
- (concat
- (char-to-string
- (base64-num-to-char (logior (ash (logand a 3) 4) (ash b -4))))
- (if c
- (concat
- (char-to-string
- (base64-num-to-char (logior (ash (logand b 15) 2) (ash c -6))))
- (char-to-string (base64-num-to-char (logand c 63)))
- )
- (concat (char-to-string
- (base64-num-to-char (ash (logand b 15) 2))) "=")
- ))
- (concat (char-to-string
- (base64-num-to-char (ash (logand a 3) 4))) "==")
- ))))
+ (let ((buf (make-string 4 ?=)))
+ (aset buf 0 (base64-num-to-char (ash (car pack) -2)))
+ (if (nth 1 pack)
+ (progn
+ (aset buf 1 (base64-num-to-char
+ (logior (ash (logand (car pack) 3) 4)
+ (ash (nth 1 pack) -4))))
+ (if (nth 2 pack)
+ (progn
+ (aset buf 2 (base64-num-to-char
+ (logior (ash (logand (nth 1 pack) 15) 2)
+ (ash (nth 2 pack) -6))))
+ (aset buf 3 (base64-num-to-char
+ (logand (nth 2 pack) 63))))
+ (aset buf 2 (base64-num-to-char
+ (ash (logand (nth 1 pack) 15) 2)))))
+ (aset buf 1 (base64-num-to-char
+ (ash (logand (car pack) 3) 4))))
+ buf))
(defun-maybe base64-encode-string (string)
"Encode STRING to base64, and return the result."
- (let ((len (length string))
- (b 0)(e 57)
- dest)
+ (let* ((len (length string))
+ (b 0)(e 57)
+ (dest ""))
(while (< e len)
(setq dest
(concat dest
"")
"\n"))
(setq b e
- e (+ e 57)
- )
- )
- (let* ((es (mapconcat
- (function base64-encode-1)
- (pack-sequence (substring string b) 3)
- ""))
- (m (mod (length es) 4))
- )
- (concat dest es (cond ((= m 3) "=")
- ((= m 2) "==")
- ))
- )))
+ e (+ e 57)))
+ (concat dest
+ (mapconcat
+ (function base64-encode-1)
+ (pack-sequence (substring string b) 3)
+ ""))))
(defun base64-internal-encode-region (beg end)
(save-excursion
(save-restriction
(narrow-to-region beg end)
- (let ((str (buffer-substring beg end)))
- (delete-region beg end)
- (insert (base64-encode-string str))
- )
- (or (bolp)
- (insert "\n")
- )
- )))
+ (insert
+ (prog1
+ (base64-encode-string
+ (buffer-substring beg end))
+ (delete-region beg end)))
+ (or (bolp) (insert ?\n)))))
;;; @ internal base64 decoder
(defsubst base64-internal-decode (string buffer)
(let* ((len (length string))
- (i 0)
- (j 0)
+ (i 0)(j 0)
v1 v2 v3)
(catch 'tag
(while (< i len)
(if v4
(aset buffer (prog1 j (setq j (1+ j)))
(logior (lsh (logand v3 3) 6) v4))
- (throw 'tag nil)
- ))
- (throw 'tag nil)
- ))))
- (substring buffer 0 j)
- ))
+ (throw 'tag nil)))
+ (throw 'tag nil)))))
+ (substring buffer 0 j)))
(defun base64-internal-decode-string (string)
(base64-internal-decode string (make-string (length string) 0)))
(defun base64-internal-decode-region (beg end)
(save-excursion
(let ((str (string-as-unibyte (buffer-substring beg end))))
- (delete-region beg end)
- (goto-char beg)
- (insert (base64-internal-decode str str)))))
+ (insert
+ (prog1
+ (base64-internal-decode str str)
+ (delete-region beg end))))))
;; (defun base64-internal-decode-region2 (beg end)
;; (save-excursion
(as-binary-process
(apply (function call-process-region)
beg end (car base64-external-encoder)
- t t nil (cdr base64-external-encoder)))
+ t t nil
+ (cdr base64-external-encoder)))
;; for OS/2
;; regularize line break code
(goto-char (point-min))
(while (re-search-forward "\r$" nil t)
- (replace-match ""))
- )))
+ (replace-match "")))))
(defun base64-external-decode-region (beg end)
(save-excursion
(as-binary-process
(apply (function call-process-region)
beg end (car base64-external-decoder)
- t t nil (cdr base64-external-decoder)))
- ))
+ t t nil
+ (cdr base64-external-decoder)))))
(defun base64-external-decode-string (string)
(with-temp-buffer
(insert string)
(as-binary-process
(apply (function call-process-region)
- (point-min) (point-max)
- (car base64-external-decoder)
- t t nil (cdr base64-external-decoder)))
+ (point-min)(point-max) (car base64-external-decoder)
+ t t nil
+ (cdr base64-external-decoder)))
(buffer-string)))
external base64 encoder specified by `base64-external-encoder'. In
this case, you must install the program (maybe mmencode included in
metamail or XEmacs package)."
- (interactive "r")
+ (interactive "*r")
(if (and base64-internal-encoding-limit
(> (- end start) base64-internal-encoding-limit))
(base64-external-encode-region start end)
external base64 decoder specified by `base64-external-decoder'. In
this case, you must install the program (maybe mmencode included in
metamail or XEmacs package)."
- (interactive "r")
+ (interactive "*r")
(if (and base64-internal-decoding-limit
(> (- end start) base64-internal-decoding-limit))
(base64-external-decode-region start end)
external base64 decoder specified by `base64-external-decoder'. In
this case, you must install the program (maybe mmencode included in
metamail or XEmacs package)."
- (interactive "r")
(if (and base64-internal-decoding-limit
(> (length string) base64-internal-decoding-limit))
(base64-external-decode-string string)
'base64-encode-string)
(mel-define-method encoded-text-decode-string (string (nil "B"))
- (if (and (string-match B-encoded-text-regexp string)
- (string= string (match-string 0 string)))
+ (if (string-match (eval-when-compile
+ (concat "\\`" B-encoded-text-regexp "\\'"))
+ string)
(base64-decode-string string)
(error "Invalid encoded-text %s" string)))
It calls external base64 encoder specified by
`base64-external-encoder'. So you must install the program (maybe
mmencode included in metamail or XEmacs package)."
- (interactive (list (read-file-name "Insert encoded file: ")))
+ (interactive "*fInsert encoded file: ")
(if (and base64-internal-encoding-limit
(> (nth 7 (file-attributes filename))
base64-internal-encoding-limit))
- (apply (function call-process) (car base64-external-encoder)
- filename t nil (cdr base64-external-encoder))
+ (apply (function call-process)
+ (car base64-external-encoder)
+ filename t nil
+ (cdr base64-external-encoder))
(insert
(base64-encode-string
(with-temp-buffer
(set-buffer-multibyte nil)
(insert-file-contents-as-binary filename)
(buffer-string))))
- (or (bolp)
- (insert "\n"))
- ))
+ (or (bolp) (insert ?\n))))
(mel-define-method-function (mime-insert-encoded-file filename (nil "base64"))
'base64-insert-encoded-file)
(defun base64-write-decoded-region (start end filename)
"Decode and write current region encoded by base64 into FILENAME.
START and END are buffer positions."
- (interactive
- (list (region-beginning) (region-end)
- (read-file-name "Write decoded region to file: ")))
+ (interactive "*r\nFWrite decoded region to file: ")
(if (and base64-internal-decoding-limit
(> (- end start) base64-internal-decoding-limit))
(as-binary-process
(let ((str (buffer-substring start end)))
(with-temp-buffer
(insert (base64-internal-decode-string str))
- (write-region-as-binary (point-min) (point-max) filename)
- ))))
+ (write-region-as-binary (point-min) (point-max) filename)))))
(mel-define-method-function
(mime-write-decoded-region start end filename (nil "base64"))
'base64-write-decoded-region)
-;;; @ etc
-;;;
-
-(defun pack-sequence (seq size)
- "Split sequence SEQ into SIZE elements packs,
-and return list of packs. [mel-b-el; tl-seq function]"
- (let ((len (length seq)) (p 0) obj
- unit (i 0)
- dest)
- (while (< p len)
- (setq obj (elt seq p))
- (setq unit (cons obj unit))
- (setq i (1+ i))
- (if (= i size)
- (progn
- (setq dest (cons (reverse unit) dest))
- (setq unit nil)
- (setq i 0)
- ))
- (setq p (1+ p))
- )
- (if unit
- (setq dest (cons (reverse unit) dest))
- )
- (reverse dest)
- ))
-
-
;;; @ end
;;;
-;;; mel-g.el: Gzip64 encoder/decoder for GNU Emacs
+;;; mel-g.el --- Gzip64 encoder/decoder.
;; Copyright (C) 1995,1996,1997,1998 MORIOKA Tomohiko
-;; Copyright (C) 1996,1997 Shuhei KOBAYASHI
+;; Copyright (C) 1996,1997,1999 Shuhei KOBAYASHI
-;; Author: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
-;; modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Maintainer: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
+;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
+;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Created: 1995/10/25
;; Keywords: Gzip64, base64, gzip, MIME
-;; This file is part of MEL (MIME Encoding Library).
+;; This file is part of FLIM (Faithful Library about Internet Message).
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; 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
+;; along with this program; 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 'poem)
+(require 'mime-def)
(require 'path-util)
-(require 'mel)
;;; @ variables
(defvar gzip64-external-encoder
(let ((file (exec-installed-p "mmencode")))
(and file
- (` ("sh" "-c" (, (concat "gzip -c | " file))))
- ))
+ (` ("sh" "-c" (, (concat "gzip -c | " file))))))
"*list of gzip64 encoder program name and its arguments.")
(defvar gzip64-external-decoder
(let ((file (exec-installed-p "mmencode")))
(and file
- (` ("sh" "-c" (, (concat file " -u | gzip -dc"))))
- ))
+ (` ("sh" "-c" (, (concat file " -u | gzip -dc"))))))
"*list of gzip64 decoder program name and its arguments.")
(defun gzip64-external-encode-region (beg end)
(interactive "*r")
(save-excursion
- (as-binary-process (apply (function call-process-region)
- beg end (car gzip64-external-encoder)
- t t nil (cdr gzip64-external-encoder))
- )
+ (as-binary-process
+ (apply (function call-process-region)
+ beg end (car gzip64-external-encoder)
+ t t nil
+ (cdr gzip64-external-encoder)))
;; for OS/2
;; regularize line break code
(goto-char (point-min))
(while (re-search-forward "\r$" nil t)
- (replace-match "")
- )
- ))
+ (replace-match ""))))
(defun gzip64-external-decode-region (beg end)
(interactive "*r")
(save-excursion
- (as-binary-process (apply (function call-process-region)
- beg end (car gzip64-external-decoder)
- t t nil (cdr gzip64-external-decoder))
- )
- ))
+ (as-binary-process
+ (apply (function call-process-region)
+ beg end (car gzip64-external-decoder)
+ t t nil
+ (cdr gzip64-external-decoder)))))
(mel-define-method-function (mime-encode-region start end (nil "x-gzip64"))
'gzip64-external-encode-region)
;;;
(mel-define-method mime-insert-encoded-file (filename (nil "x-gzip64"))
- (interactive (list (read-file-name "Insert encoded file: ")))
- (apply (function call-process) (car gzip64-external-encoder)
+ (interactive "*fInsert encoded file: ")
+ (apply (function call-process)
+ (car gzip64-external-encoder)
filename t nil
- (cdr gzip64-external-encoder))
- )
+ (cdr gzip64-external-encoder)))
(mel-define-method mime-write-decoded-region (start end filename
(nil "x-gzip64"))
"Decode and write current region encoded by gzip64 into FILENAME.
START and END are buffer positions."
- (interactive
- (list (region-beginning) (region-end)
- (read-file-name "Write decoded region to file: ")))
+ (interactive "*r\nFWrite decoded region to file: ")
(as-binary-process
(apply (function call-process-region)
start end (car gzip64-external-decoder)
nil nil nil
(let ((args (cdr gzip64-external-decoder)))
(append (butlast args)
- (list (concat (car (last args)) ">" filename))))
- )))
+ (list (concat (car (last args)) ">" filename)))))))
;;; @ end
-;;; mel-ccl.el: CCL based encoder/decoder of Quoted-Printable
-;;; and Q-encoding
+;;; mel-q-ccl.el --- Quoted-Printable encoder/decoder using CCL.
;; Copyright (C) 1998 Tanaka Akira
;; 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
+;; along with this program; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
(eval-when-compile
+(defvar eof-block-branches)
+(defvar eof-block-reg)
(defun mel-ccl-set-eof-block (branch)
(let ((p (assoc branch eof-block-branches)))
(unless p
eof-block-branches (cons p eof-block-branches)))
`(,eof-block-reg = ,(cdr p))))
+)
+
+(eval-when-compile
(defun mel-ccl-try-to-read-crlf (input-crlf reg
succ
,succ
,crlf-fail))))
+)
+
+(eval-when-compile
+
;; Generated CCL program works not properly on 20.2 because CCL_EOF_BLOCK
;; is not executed.
(defun mel-ccl-encode-quoted-printable-generic (input-crlf output-crlf)
(defun quoted-printable-ccl-encode-region (start end)
"Encode the region from START to END with quoted-printable encoding."
- (interactive "r")
+ (interactive "*r")
(decode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev))
(defun quoted-printable-ccl-insert-encoded-file (filename)
"Encode contents of the file named as FILENAME, and insert it."
- (interactive (list (read-file-name "Insert encoded file: ")))
+ (interactive "*fInsert encoded file: ")
(insert-file-contents-as-coding-system
'mel-ccl-quoted-printable-lf-lf-rev filename))
(defun quoted-printable-ccl-decode-region (start end)
"Decode the region from START to END with quoted-printable
encoding."
- (interactive "r")
+ (interactive "*r")
(encode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev))
-(defun quoted-printable-ccl-write-decoded-region
- (start end filename)
+(defun quoted-printable-ccl-write-decoded-region (start end filename)
"Decode quoted-printable encoded current region and write out to FILENAME."
- (interactive
- (list (region-beginning) (region-end)
- (read-file-name "Write decoded region to file: ")))
+ (interactive "*r\nFWrite decoded region to file: ")
(write-region-as-coding-system 'mel-ccl-quoted-printable-lf-lf-rev
start end filename))
(unless (featurep 'xemacs)
(defun q-encoding-ccl-encoded-length (string &optional mode)
(let ((status [nil nil nil nil nil nil nil nil nil]))
- (fillarray status nil)
+ (fillarray status nil) ; XXX: Is this necessary?
(ccl-execute-on-string
(cond
((eq mode 'text) 'mel-ccl-count-uq)
'q-encoding-ccl-encode-string)
(mel-define-method encoded-text-decode-string (string (nil "Q"))
- (if (and (string-match Q-encoded-text-regexp string)
- (string= string (match-string 0 string)))
+ (if (string-match (eval-when-compile
+ (concat "\\`" Q-encoded-text-regexp "\\'"))
+ string)
(q-encoding-ccl-decode-string string)
(error "Invalid encoded-text %s" string)))
(provide 'mel-q-ccl)
-;;; mel-q-ccl.el ends here
+;;; mel-q-ccl.el ends here.
-;;; mel-q.el: Quoted-Printable and Q-encoding encoder/decoder for GNU Emacs
+;;; mel-q.el --- Quoted-Printable encoder/decoder.
-;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
+;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Created: 1995/6/25
;; Keywords: MIME, Quoted-Printable, Q-encoding
-;; This file is part of MEL (MIME Encoding Library).
+;; This file is part of FLIM (Faithful Library about Internet Message).
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; 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
+;; along with this program; 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 'emu)
(require 'mime-def)
+(require 'path-util)
;;; @ Quoted-Printable encoder
(concat
"="
(char-to-string (aref quoted-printable-hex-chars (ash character -4)))
- (char-to-string (aref quoted-printable-hex-chars (logand character 15)))
- ))
+ (char-to-string (aref quoted-printable-hex-chars (logand character 15)))))
(defun quoted-printable-internal-encode-region (start end)
(save-excursion
(save-restriction
- (narrow-to-region start end)
- (goto-char start)
- (let ((col 0))
- (while (< (point)(point-max))
- (cond ((>= col 75)
- (insert "=\n")
- (setq col 0)
- )
- ((looking-at-as-unibyte "^From ")
- (replace-match "=46rom ")
- (backward-char 1)
- (setq col (+ col 6))
- )
- ((looking-at-as-unibyte "[ \t]\n")
- (forward-char 1)
- (insert "=\n")
- (forward-char 1)
- (setq col 0)
- )
- (t
- (let ((chr (char-after (point))))
- (cond ((= chr ?\n)
- (forward-char 1)
- (setq col 0)
- )
- ((or (= chr ?\t)
- (and (<= 32 chr)(/= chr ?=)(< chr 127))
- )
- (forward-char 1)
- (setq col (1+ col))
- )
- ((>= col 73)
- (insert "=\n")
- (setq col 0)
- )
- (t
- (delete-char 1)
- (insert (quoted-printable-quote-char chr))
- (setq col (+ col 3))
- ))
- )))
- )))))
+ (narrow-to-region (goto-char start) end)
+ (let ((col 0)
+ chr)
+ (while (not (eobp))
+ (cond
+ ((>= col 75) ; soft line break.
+ (insert "=\n")
+ (setq col 0))
+ ((eolp) ; end of line.
+ (forward-char)
+ (setq col 0))
+ (t
+ (setq chr (char-after (point)))
+ (cond
+ ((and (memq chr '(? ?\t)) ; encode WSP char before CRLF.
+ (eq (char-after (1+ (point))) ?\n))
+ (forward-char)
+ (insert "=\n")
+ (forward-char)
+ (setq col 0))
+ ((and (bolp) ; "^From " is not safe.
+ (eq chr ?F)
+ (eq (char-after (1+ (point))) ?r)
+ (eq (char-after (+ 2 (point))) ?o)
+ (eq (char-after (+ 3 (point))) ?m)
+ (eq (char-after (+ 4 (point))) ? ))
+ (delete-region (point)(1+ (point)))
+ (insert "=46") ; moved to ?r.
+ (forward-char 4) ; skip "rom ".
+ (setq col 7))
+ ((or (= chr ?\t) ; skip safe char.
+ (and (<= 32 chr)(/= chr ?=)(< chr 127)))
+ (forward-char)
+ (setq col (1+ col)))
+ ((>= col 73) ; soft line break.
+ (insert "=\n")
+ (setq col 0))
+ (t ; encode unsafe char.
+ (delete-region (point)(1+ (point)))
+ ;; (insert (quoted-printable-quote-char chr))
+ (insert
+ ?=
+ (aref quoted-printable-hex-chars (ash chr -4))
+ (aref quoted-printable-hex-chars (logand chr 15)))
+ (setq col (+ col 3)))))))))))
(defvar quoted-printable-external-encoder '("mmencode" "-q")
(as-binary-process
(apply (function call-process-region)
start end (car quoted-printable-external-encoder)
- t t nil (cdr quoted-printable-external-encoder))
- )
+ t t nil
+ (cdr quoted-printable-external-encoder)))
;; for OS/2
;; regularize line break code
(goto-char (point-min))
(while (re-search-forward "\r$" nil t)
- (replace-match "")
- )
- )))
+ (replace-match "")))))
(defvar quoted-printable-internal-encoding-limit
(require 'path-util)
(if (exec-installed-p "mmencode")
1000
- (message "Don't found external encoder for Quoted-Printable!")
+ ;; XXX: Fix this message, or simply remove it.
+ ;; (message "Don't found external encoder for Quoted-Printable!")
nil))
"*limit size to use internal quoted-printable encoder.
If size of input to encode is larger than this limit,
otherwise it calls external quoted-printable encoder specified by
`quoted-printable-external-encoder'. In this case, you must install
the program (maybe mmencode included in metamail or XEmacs package)."
- (interactive "r")
+ (interactive "*r")
(if (and quoted-printable-internal-encoding-limit
(> (- end start) quoted-printable-internal-encoding-limit))
(quoted-printable-external-encode-region start end)
- (quoted-printable-internal-encode-region start end)
- ))
-
+ (quoted-printable-internal-encode-region start end)))
(defun quoted-printable-encode-string (string)
"Encode STRING to quoted-printable, and return the result."
(with-temp-buffer
(insert string)
(quoted-printable-encode-region (point-min)(point-max))
- (buffer-string)
- ))
+ (buffer-string)))
(mel-define-method-function
(mime-encode-region start end (nil "quoted-printable"))
'quoted-printable-encode-region)
-(mel-define-method mime-insert-encoded-file (filename
- (nil "quoted-printable"))
+(mel-define-method mime-insert-encoded-file (filename (nil "quoted-printable"))
"Encode contents of file FILENAME to quoted-printable, and insert the result.
It calls external quoted-printable encoder specified by
`quoted-printable-external-encoder'. So you must install the program
\(maybe mmencode included in metamail or XEmacs package)."
- (interactive (list (read-file-name "Insert encoded file: ")))
- (apply (function call-process) (car quoted-printable-external-encoder)
- filename t nil (cdr quoted-printable-external-encoder))
- )
+ (interactive "*fInsert encoded file: ")
+ (apply (function call-process)
+ (car quoted-printable-external-encoder)
+ filename t nil
+ (cdr quoted-printable-external-encoder)))
;;; @ Quoted-Printable decoder
(narrow-to-region start end)
(goto-char (point-min))
(while (search-forward "=" nil t)
- (let ((beg (match-beginning 0)))
- (cond ((looking-at "\n")
- (delete-region beg (match-end 0))
- )
- ((looking-at
- `,(concat "[" quoted-printable-hex-chars
- "][" quoted-printable-hex-chars "]"))
- (let* ((end (match-end 0))
- (hex (buffer-substring (match-beginning 0) end)))
- (delete-region beg end)
- (insert
- (logior
- (ash (quoted-printable-hex-char-to-num (aref hex 0)) 4)
- (quoted-printable-hex-char-to-num (aref hex 1))))
- ))
- (t
- ;; invalid
- ))
- )))))
+ (cond
+ ((eolp)
+ ;; unfold soft line break.
+ (delete-region (1- (point))(1+ (point))))
+ ((and (memq (char-after (point))
+ (eval-when-compile
+ ;; XXX: should provide char-list instead.
+ (string-to-char-list quoted-printable-hex-chars)))
+ (memq (char-after (1+ (point)))
+ (eval-when-compile
+ ;; XXX: should provide char-list instead.
+ (string-to-char-list quoted-printable-hex-chars))))
+ ;; encoded char.
+ (insert
+ (prog1
+ (logior
+ (ash (quoted-printable-hex-char-to-num (char-after (point))) 4)
+ (quoted-printable-hex-char-to-num (char-after (1+ (point)))))
+ (delete-region (1- (point))(+ 2 (point))))))
+ (t
+ ;; invalid encoding.
+ ))))))
(defvar quoted-printable-external-decoder '("mmencode" "-q" "-u")
"*list of quoted-printable decoder program name and its arguments.")
(as-binary-process
(apply (function call-process-region)
start end (car quoted-printable-external-decoder)
- t t nil (cdr quoted-printable-external-decoder))
- )))
+ t t nil
+ (cdr quoted-printable-external-decoder)))))
(defvar quoted-printable-internal-decoding-limit nil
otherwise it calls external quoted-printable decoder specified by
`quoted-printable-external-decoder'. In this case, you must install
the program (maybe mmencode included in metamail or XEmacs package)."
- (interactive "r")
+ (interactive "*r")
(if (and quoted-printable-internal-decoding-limit
(> (- end start) quoted-printable-internal-decoding-limit))
(quoted-printable-external-decode-region start end)
- (quoted-printable-internal-decode-region start end)
- ))
+ (quoted-printable-internal-decode-region start end)))
(defun quoted-printable-decode-string (string)
"Decode STRING which is encoded in quoted-printable, and return the result."
(nil "quoted-printable"))
"Decode and write current region encoded by quoted-printable into FILENAME.
START and END are buffer positions."
- (interactive
- (list (region-beginning) (region-end)
- (read-file-name "Write decoded region to file: ")))
+ (interactive "*r\nFWrite decoded region to file: ")
(as-binary-process
(apply (function call-process-region)
start end (car quoted-printable-external-decoder)
nil nil nil
(append (cdr quoted-printable-external-decoder)
quoted-printable-external-decoder-option-to-specify-file
- (list filename))
- )))
+ (list filename)))))
\f
;;; @ Q-encoding encode/decode string
MODE allows `text', `comment', `phrase' or nil. Default value is
`phrase'."
(let ((specials (cdr (or (assq mode q-encoding-special-chars-alist)
- (assq 'phrase q-encoding-special-chars-alist)
- ))))
+ (assq 'phrase q-encoding-special-chars-alist)))))
(mapconcat (function
(lambda (chr)
(cond ((eq chr ? ) "_")
((or (< chr 32) (< 126 chr)
- (memq chr specials)
- )
- (quoted-printable-quote-char chr)
- )
+ (memq chr specials))
+ (quoted-printable-quote-char chr))
(t
- (char-to-string chr)
- ))
- ))
- string "")
- ))
+ (char-to-string chr)))))
+ string "")))
(defun q-encoding-decode-string (string)
"Decode STRING which is encoded in Q-encoding and return the result."
(h (setq l (quoted-printable-hex-char-to-num chr))
(prog1
(char-to-string (logior (ash h 4) l))
- (setq h nil)
- )
- )
- (t (char-to-string chr))
- )))
+ (setq h nil)))
+ (t (char-to-string chr)))))
string "")))
(mel-define-method-function (encoded-text-encode-string string (nil "Q"))
'q-encoding-encode-string)
(mel-define-method encoded-text-decode-string (string (nil "Q"))
- (if (and (string-match Q-encoded-text-regexp string)
- (string= string (match-string 0 string)))
+ (if (string-match (eval-when-compile
+ (concat "\\`" Q-encoded-text-regexp "\\'"))
+ string)
(q-encoding-decode-string string)
(error "Invalid encoded-text %s" string)))
(provide 'mel-q)
-;;; mel-q.el ends here
+;;; mel-q.el ends here.
-;;; mel-u.el: uuencode encoder/decoder for GNU Emacs
+;;; mel-u.el --- uuencode encoder/decoder.
-;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
+;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Created: 1995/10/25
;; 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
+;; along with this program; 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 'emu)
(require 'mime-def)
+(require 'path-util)
(mel-define-backend "x-uue")
variable `uuencode-external-encoder'."
(interactive "*r")
(save-excursion
- (as-binary-process (apply (function call-process-region)
- start end (car uuencode-external-encoder)
- t t nil (cdr uuencode-external-encoder))
- )
+ (as-binary-process
+ (apply (function call-process-region)
+ start end (car uuencode-external-encoder)
+ t t nil
+ (cdr uuencode-external-encoder)))
;; for OS/2
;; regularize line break code
(goto-char (point-min))
(while (re-search-forward "\r$" nil t)
- (replace-match "")
- )
- ))
+ (replace-match ""))))
(defun uuencode-external-decode-region (start end)
"Decode current region by unofficial uuencode format.
(if (re-search-forward "^begin [0-9]+ " nil t)
(if (looking-at ".+$")
(buffer-substring (match-beginning 0)
- (match-end 0))
- )))))
+ (match-end 0)))))))
(default-directory temporary-file-directory))
(if filename
(as-binary-process
(apply (function call-process-region)
start end (car uuencode-external-decoder)
- t nil nil (cdr uuencode-external-decoder))
+ t nil nil
+ (cdr uuencode-external-decoder))
(as-binary-input-file (insert-file-contents filename))
;; The previous line causes the buffer to be made read-only, I
;; do not pretend to understand the control flow leading to this
;; Use `inhibit-read-only' to avoid to force
;; buffer-read-only nil. - tomo.
(let ((inhibit-read-only t))
- (delete-file filename)
- )
- ))
- )))
+ (delete-file filename)))))))
(mel-define-method-function (mime-encode-region start end (nil "x-uue"))
'uuencode-external-encode-region)
"Insert file encoded by unofficial uuencode format.
This function uses external uuencode encoder which is specified by
variable `uuencode-external-encoder'."
- (interactive (list (read-file-name "Insert encoded file: ")))
- (call-process (car uuencode-external-encoder) filename t nil
- (file-name-nondirectory filename))
- )
+ (interactive "*fInsert encoded file: ")
+ (call-process (car uuencode-external-encoder)
+ filename t nil
+ (file-name-nondirectory filename)))
(mel-define-method mime-write-decoded-region (start end filename
(nil "x-uue"))
"Decode and write current region encoded by uuencode into FILENAME.
START and END are buffer positions."
- (interactive
- (list (region-beginning) (region-end)
- (read-file-name "Write decoded region to file: ")))
+ (interactive "*r\nFWrite decoded region to file: ")
(save-excursion
(let ((file (save-excursion
(save-restriction
(if (re-search-forward "^begin [0-9]+ " nil t)
(if (looking-at ".+$")
(buffer-substring (match-beginning 0)
- (match-end 0))
- )))))
+ (match-end 0)))))))
(default-directory temporary-file-directory))
(if file
(as-binary-process
(apply (function call-process-region)
start end (car uuencode-external-decoder)
- nil nil nil (cdr uuencode-external-decoder))
- (rename-file file filename 'overwrites)
- )))))
+ nil nil nil
+ (cdr uuencode-external-decoder))
+ (rename-file file filename 'overwrites))))))
;;; @ end
(mel-define-backend "x-uuencode" ("x-uue"))
-;;; mel-u.el ends here
+;;; mel-u.el ends here.
-;;; mel.el : a MIME encoding/decoding library
+;;; mel.el --- A MIME encoding/decoding library.
-;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
+;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Created: 1995/6/25
;; 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
+;; along with this program; 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 'mime-def)
-(require 'poem)
+(require 'path-util)
(defcustom mime-encoding-list
'("7bit" "8bit" "binary" "base64" "quoted-printable")
(defun mime-encoding-alist (&optional service)
"Return table of Content-Transfer-Encoding for completion."
- (mapcar #'list (mime-encoding-list service))
- )
+ (mapcar #'list (mime-encoding-list service)))
(defsubst mel-use-module (name encodings)
- (let (encoding)
- (while (setq encoding (car encodings))
- (set-alist 'mel-encoding-module-alist
- encoding
- (cons name (cdr (assoc encoding mel-encoding-module-alist))))
- (setq encodings (cdr encodings))
- )))
+ (while encodings
+ (set-alist 'mel-encoding-module-alist
+ (car encodings)
+ (cons name (cdr (assoc (car encodings)
+ mel-encoding-module-alist))))
+ (setq encodings (cdr encodings))))
(defsubst mel-find-function (service encoding)
(mel-find-function-from-obarray
It calls external base64 encoder specified by
`base64-external-encoder'. So you must install the program (maybe
mmencode included in metamail or XEmacs package)."
- (interactive (list (read-file-name "Insert encoded file: ")))
+ (interactive "*fInsert encoded file: ")
(insert (base64-encode-string
(with-temp-buffer
(set-buffer-multibyte nil)
(insert-file-contents-as-binary filename)
(buffer-string))))
- (or (bolp)
- (insert "\n"))
- )
+ (or (bolp) (insert ?\n)))
(mel-define-method-function (encoded-text-encode-string string (nil "B"))
'base64-encode-string)
(mel-define-method encoded-text-decode-string (string (nil "B"))
- (if (and (string-match B-encoded-text-regexp string)
- (string= string (match-string 0 string)))
+ (if (string-match (eval-when-compile
+ (concat "\\`" B-encoded-text-regexp "\\'"))
+ string)
(base64-decode-string string)
(error "Invalid encoded-text %s" string)))
)
(and (featurep 'mule)
(progn
(require 'path-util)
- (module-installed-p 'mel-b-ccl)
- )))
+ (module-installed-p 'mel-b-ccl))))
(defvar mel-q-ccl-module
(and (featurep 'mule)
(progn
(require 'path-util)
- (module-installed-p 'mel-q-ccl)
- )))
+ (module-installed-p 'mel-q-ccl))))
-(if mel-b-ccl-module
- (mel-use-module 'mel-b-ccl '("base64" "B"))
- )
+(when mel-b-ccl-module
+ (mel-use-module 'mel-b-ccl '("base64" "B")))
-(if mel-q-ccl-module
- (mel-use-module 'mel-q-ccl '("quoted-printable" "Q"))
- )
+(when mel-q-ccl-module
+ (mel-use-module 'mel-q-ccl '("quoted-printable" "Q")))
-(if base64-dl-module
- (mel-use-module 'mel-b-dl '("base64" "B"))
- )
+(when base64-dl-module
+ (mel-use-module 'mel-b-dl '("base64" "B")))
;;; @ region
"Encode region START to END of current buffer using ENCODING.
ENCODING must be string."
(interactive
- (list (region-beginning) (region-end)
- (completing-read "encoding: "
+ (list (region-beginning)(region-end)
+ (completing-read "Encoding: "
(mime-encoding-alist)
nil t "base64")))
- (funcall (mel-find-function 'mime-encode-region encoding) start end)
- )
+ (funcall (mel-find-function 'mime-encode-region encoding) start end))
;;;###autoload
"Decode region START to END of current buffer using ENCODING.
ENCODING must be string."
(interactive
- (list (region-beginning) (region-end)
- (completing-read "encoding: "
+ (list (region-beginning)(region-end)
+ (completing-read "Encoding: "
(mime-encoding-alist 'mime-decode-region)
nil t "base64")))
(funcall (mel-find-function 'mime-decode-region encoding)
ENCODING must be string. If ENCODING is found in
`mime-string-decoding-method-alist' as its key, this function decodes
the STRING by its value."
- (let ((fun (mel-find-function 'mime-decode-string encoding)))
- (if fun
- (funcall (mel-find-function 'mime-decode-string encoding)
- string)
+ (let ((f (mel-find-function 'mime-decode-string encoding)))
+ (if f
+ (funcall f string)
string)))
+
(mel-define-service encoded-text-encode-string (string encoding)
- "Encode STRING as encoded-text using ENCODING.
-ENCODING must be string.")
+ "Encode STRING as encoded-text using ENCODING. ENCODING must be string.")
(mel-define-service encoded-text-decode-string (string encoding)
- "Decode STRING as encoded-text using ENCODING.
-ENCODING must be string.")
+ "Decode STRING as encoded-text using ENCODING. ENCODING must be string.")
(defun base64-encoded-length (string)
(* (/ (+ (length string) 2) 3) 4))
(defsubst Q-encoding-printable-char-p (chr mode)
(and (not (memq chr '(?= ?? ?_)))
- (<= ?\ chr)(<= chr ?~)
+ (<= ?\ chr)(<= chr ?~)
(cond ((eq mode 'text) t)
((eq mode 'comment)
- (not (memq chr '(?\( ?\) ?\\)))
- )
+ (not (memq chr '(?\( ?\) ?\\))))
(t
- (string-match "[A-Za-z0-9!*+/=_---]" (char-to-string chr))
- ))))
+ (string-match "[A-Za-z0-9!*+/=_---]" (char-to-string chr))))))
(defun Q-encoded-text-length (string &optional mode)
(let ((l 0)(i 0)(len (length string)) chr)
(setq chr (elt string i))
(if (Q-encoding-printable-char-p chr mode)
(setq l (+ l 1))
- (setq l (+ l 3))
- )
- (setq i (+ i 1)) )
+ (setq l (+ l 3)))
+ (setq i (+ i 1)))
l))
"Insert file FILENAME encoded by ENCODING format."
(interactive
(list (read-file-name "Insert encoded file: ")
- (completing-read "encoding: "
+ (completing-read "Encoding: "
(mime-encoding-alist)
nil t "base64")))
(funcall (mel-find-function 'mime-insert-encoded-file encoding)
"Decode and write current region encoded by ENCODING into FILENAME.
START and END are buffer positions."
(interactive
- (list (region-beginning) (region-end)
+ (list (region-beginning)(region-end)
(read-file-name "Write decoded region to file: ")
- (completing-read "encoding: "
+ (completing-read "Encoding: "
(mime-encoding-alist 'mime-write-decoded-region)
nil t "base64")))
(funcall (mel-find-function 'mime-write-decoded-region encoding)
;;; Code:
+(require 'poe)
+(require 'poem)
+(require 'pcustom)
(require 'mcharset)
+(require 'alist)
+
+(eval-when-compile (require 'cl)) ; list*
(eval-and-compile
- (defconst mime-library-product ["FLAM-DOODLE" (1 12 5) "\e$BFP\e(B 10R4.0/7.0"]
+ (defconst mime-library-product ["FLAM-DOODLE" (1 12 6) "\e$B3w\e(B 10R4.0/5.0"]
"Product name, version number and code name of MIME-library package.")
)
;;; @ variables
;;;
-(require 'custom)
-
-(eval-when-compile (require 'cl))
-
-(defgroup mime nil
+(defgroup mime '((default-mime-charset custom-variable))
"Emacs MIME Interfaces"
:group 'news
:group 'mail)
-(custom-handle-keyword 'default-mime-charset :group 'mime
- 'custom-variable)
-
(defcustom mime-uuencode-encoding-name-list '("x-uue" "x-uuencode")
"*List of encoding names for uuencode format."
:group 'mime
(defconst std11-non-qtext-char-list '(?\" ?\\ ?\r ?\n))
(defconst std11-qtext-regexp
(eval-when-compile
- (concat "[^" (apply #'string std11-non-qtext-char-list) "]"))))
+ (concat "[^" std11-non-qtext-char-list "]"))))
(defconst std11-quoted-string-regexp
(eval-when-compile
(concat "\""
;;; @ about MIME
;;;
-(defconst mime-tspecial-char-list
- '(?\] ?\[ ?\( ?\) ?< ?> ?@ ?, ?\; ?: ?\\ ?\" ?/ ?? ?=))
+(eval-and-compile
+ (defconst mime-tspecial-char-list
+ '(?\] ?\[ ?\( ?\) ?< ?> ?@ ?, ?\; ?: ?\\ ?\" ?/ ?? ?=)))
(defconst mime-token-regexp
(eval-when-compile
(concat "[^" mime-tspecial-char-list "\000-\040]+")))
;;; @ for mm-backend
;;;
-(require 'alist)
-
(defvar mime-entity-implementation-alist nil)
(defmacro mm-define-backend (type &optional parents)
service."
`(progn
(add-to-list 'mel-service-list ',name)
- (defvar ,(intern (format "%s-obarray" name)) (make-vector 1 nil))
+ (defvar ,(intern (format "%s-obarray" name)) (make-vector 7 0))
,@(if args
`((defun ,name ,args
,@rest
<h1> Network representation of header
<node> encoded-word
<p>
-encoded-word \e$B$O\e(B header \e$B$GHs\e(B <dref>ASCII</dref> \e$BJ8;z$rI=8=$9$k$?$a$N7A\e(B
-\e$B<0$G!"\e(B<concept>RFC 2047</concept> \e$B$GDj5A$5$l$F$$$^$9!#\e(B
+<concept>RFC 2047</concept> defines the
+<concept>encoded-word</concept> which is a format to represent
+non-<dref>ASCII</dref> characters in a header.
<p>
<rfc number="2047" type="Standards Track" author="K. Moore"
title="MIME (Multipurpose Internet Mail Extensions) Part
Three: Message Header Extensions for Non-ASCII Text"
date="November 1996" obsolete="1521,1522,1590">
<p>
-\e$B$^$?!"9T57$N0-$$$3$H$@$H8@$($^$9$,!"\e(Bencoded-word \e$B$rMQ$$$:$KHs\e(B
-<dref>ASCII</dref> \e$BJ8;z$r\e(B header \e$B$KF~$l$?5-;v$bB8:_$7$^$9!#\e(B
+The encoded-word is the only valid format to represent
+non-<dref>ASCII</dref> characters in a header, but there are also
+invalid styles. Such kinds of evil messages represent
+non-<dref>ASCII</dref> characters in headers without encoded-words (it
+is called "raw" non-<dref>ASCII</dref> characters).
<p>
-FLIM \e$B$O$3$l$i$rId9f2=!&I|9f2=$9$k5!G=$rDs6!$7$^$9!#\e(B
+FLIM provides encoding/decoding features of both encoded-word and
+invalid "raw" non-<dref>ASCII</dref> characters.
<h2> Header encoding/decoding
@chapter Network representation of header
@cindex RFC 2047
@cindex Standards Track
+@cindex encoded-word
@cindex RFC 2047
-encoded-word \e$B$O\e(B header \e$B$GHs\e(B ASCII (@ref{ASCII}) \e$BJ8;z$rI=8=$9$k$?$a$N7A<0\e(B
-\e$B$G!"\e(B@strong{RFC 2047} \e$B$GDj5A$5$l$F$$$^$9!#\e(B@refill
+@strong{RFC 2047} defines the @strong{encoded-word} which is a format to
+represent non-ASCII (@ref{ASCII}) characters in a header.@refill
@noindent
Track (obsolete RFC 1521,1522,1590).
@end quotation
-\e$B$^$?!"9T57$N0-$$$3$H$@$H8@$($^$9$,!"\e(Bencoded-word \e$B$rMQ$$$:$KHs\e(B ASCII
-(@ref{ASCII}) \e$BJ8;z$r\e(B header \e$B$KF~$l$?5-;v$bB8:_$7$^$9!#\e(B@refill
+The encoded-word is the only valid format to represent non-ASCII
+(@ref{ASCII}) characters in a header, but there are also invalid styles.
+Such kinds of evil messages represent non-ASCII (@ref{ASCII}) characters
+in headers without encoded-words (it is called "raw" non-ASCII
+(@ref{ASCII}) characters).@refill
-FLIM \e$B$O$3$l$i$rId9f2=!&I|9f2=$9$k5!G=$rDs6!$7$^$9!#\e(B
+FLIM provides encoding/decoding features of both encoded-word and
+invalid "raw" non-ASCII (@ref{ASCII}) characters.
@menu
<defun name="mime-open-entity">
<opts> type location
<p>
-Open an entity and return it.
+Entity \e$B$r3+$$$F!"$=$l$rJV$7$^$9!#\e(B
<p>
-<var>type</var> is representation-type. <cf node="mm-backend">
+<var>type</var> \e$B$O\e(B representation-type \e$B$G$9!#\e(B <cf node="mm-backend">
<p>
-<var>location</var> is location of entity. Specification of it is
-depended on representation-type.
+<var>location</var> \e$B$O\e(B entity \e$B$N0LCV$G$9!#;XDjJ}K!$O\e(B
+representation-type \e$B$K0M$C$FJQ$o$j$^$9!#\e(B
</defun>
<defun name="mime-parse-buffer">
<defun name="mime-find-entity-from-number">
<args> entity-number <opts> message
<p>
-Return entity from <var>entity-number</var> in <var>message</var>.
+<var>message</var> \e$B$+$i!"\e(B<var>enity-number</var> \e$B$N\e(B entity \e$B$rJV$7$^$9!#\e(B
<p>
-If <var>message</var> is not specified,
-<code>mime-message-structure</code> is used.
+<var>message</var> \e$B$,;XDj$5$l$F$$$J$$>l9g$O!"\e(B
+<code>mime-message-structrue</code> \e$B$,;H$o$l$^$9!#\e(B
</defun>
<defun name="mime-find-entity-from-node-id">
<args> entity-node-id <opts> message
<p>
-Return entity from <var>entity-node-id</var> in <var>message</var>.
+<var>message</var> \e$B$+$i!"\e(B<var>entity-node-id</var> \e$B$N\e(B entity \e$B$rJV$7$^\e(B
+\e$B$9!#\e(B
<p>
-If <var>message</var> is not specified,
-<code>mime-message-structure</code> is used.
+<var>message</var> \e$B$,;XDj$5$l$F$$$J$$>l9g$O!"\e(B
+<code>mime-message-structure</code> \e$B$,;H$o$l$^$9!#\e(B
</defun>
<defun name="mime-find-entity-from-content-id">
<args> cid <opts> message
<p>
-Return entity from <var>cid</var> in <var>message</var>.
+<var>message</var> \e$B$+$i!"\e(B<var>cid</var> \e$B$N\e(B entity \e$B$rJV$7$^$9!#\e(B
<p>
-If <var>message</var> is not specified,
-<code>mime-message-structure</code> is used.
+<var>message</var> \e$B$,;XDj$5$l$F$$$J$$>l9g$O!"\e(B
+<code>mime-message-structure</code> \e$B$,;H$o$l$^$9!#\e(B
</defun>
<defun name="mime-entity-cooked-p">
<args> entity
<p>
-Return non-nil if contents of <var>entity</var> has been already
-code-converted.
+<var>entity</var> \e$B$NFbMF$,4{$K%3!<%IJQ49$5$l$F$$$k>l9g$O\e(B nil \e$B$GL5$$CM\e(B
+\e$B$rJV$9!#\e(B
</defun>
<defun name="mime-insert-text-content">
<args> entity
<p>
-Insert before point a contents of <var>entity</var> as text entity.
+point \e$B$NA0$K\e(B <var>entity</var> \e$B$r\e(B text entity \e$B$H$7$FA^F~$7$^$9!#\e(B
<p>
-Contents of the <var>entity</var> are decoded as <dref>MIME
-charset</dref>. If the <var>entity</var> does not have charset
-parameter of Content-Type field, <code>default-mime-charset</code> is
-used as default value.
+<var>entity</var> \e$B$NFbMF$O\e(B <dref>MIMe charset</dref> \e$B$H$7$FI|9f2=$5$l\e(B
+\e$B$^$9!#\e(B<var>entity</var> \e$B$N\e(B Content-Type field \e$B$K\e(B charset paramter \e$B$,L5\e(B
+\e$B$$$H!"\e(B<code>default-mime-charset</code> \e$B$,=i4|CM$H$7$F;H$o$l$^$9!#\e(B
</defun>
<defvar name="default-mime-charset">
<defun name="mime-insert-entity-content">
<args> entity
<p>
-Insert content of <var>entity</var> at point.
+pointo \e$B$N0LCV$K\e(B <var>entity</var> \e$B$NFbMF$rA^F~$7$^$9!#\e(B
</defun>
<defun name="mime-write-entity-content">
<args> entity filename
<p>
-Write content of <var>entity</var> into <var>filename</var>.
+<var>entity</var> \e$B$NFbMF$r\e(B <var>filename</var> \e$B$K=q$-9~$_$^$9!#\e(B
</defun>
<defun name="mime-insert-entity">
<args> entity
<p>
-Insert header and body of <var>entity</var> at point.
+<var>entity</var> \e$B$N\e(B header \e$B$H\e(B body \e$B$r\e(B point \e$B$N$H$3$m$KA^F~$7$^$9!#\e(B
</defun>
<defun name="mime-write-entity">
<args> entity filename
<p>
-Write representation of <var>entity</var> into <var>filename</var>.
+<var>entity</var> \e$B$NI=8=$r\e(B <var>filename</var> \e$B$K=q$-9~$_$^$9!#\e(B
</defun>
<defun name="mime-write-entity-body">
<args> entity filename
<p>
-Write body of <var>entity</var> into <var>filename</var>.
+<var>entity</var> \e$B$N\e(B body \e$B$r\e(B <var>filename</var> \e$B$K=q$-9~$_$^$9!#\e(B
</defun>
<args> type
<opts> parents
<p>
-Define <var>type</var> as a mm-backend.
+<var>type</var> \e$B$r\e(B mm-backend \e$B$H$7$FDj5A$7$^$9!#\e(B
<p>
-If <var>PARENTS</var> is specified, <var>type</var> inherits parents.
-Each parent must be representation-type.
+<var>PARENTS</var> \e$B$,;XDj$5$l$F$$$k>l9g$O!"\e(B<var>type</var> \e$B$O\e(B prents
+\e$B$r7Q>5$7$^$9!#$=$l$>$l$N\e(B parent \e$B$O\e(B representation-type \e$B$G$"$kI,MW$,$"\e(B
+\e$B$j$^$9!#\e(B
<p>
-Example:
+\e$BNc\e(B:
<p>
<lisp>
(mm-define-backend chao (generic))
<defmacro name="mm-define-method">
<args> name args <rest> body
<p>
-Define <var>name</var> as a method function of (nth 1 (car
-<var>args</var>)) backend.
+<var>name</var> \e$B$r\e(B (nth 1 (car <var>args</var>)) backend \e$B$N\e(B method \e$B4X\e(B
+\e$B?t$H$7$FDj5A$7$^$9!#\e(B
<p>
-<var>args</var> is like an argument list of lambda, but (car
-<var>args</var>) must be specialized parameter. (car (car
-<var>args</var>)) is name of variable and (nth 1 (car
-<var>args</var>)) is name of backend (representation-type).
+<var>args</var> \e$B$O\e(B lambda \e$B$N0z?t%j%9%H$N$h$&$J$b$N$G$9$,!"\e(B(car
+<var>args</var>) \e$B$O;XDj$5$l$?\e(B parameter \e$B$G$"$kI,MW$,$"$j$^$9!#\e(B(car
+(car <var>args</var>)) \e$B$OJQ?t$NL>A0$G!"\e(B(nth 1 (car <var>args</var>))
+\e$B$O\e(B backend \e$B$NL>A0\e(B (representation-type) \e$B$G$9!#\e(B
<p>
-Example:
+\e$BNc\e(B:
<p>
<lisp>
(mm-define-method entity-cooked-p ((entity chao)) nil)
<defun name="mime-encode-region">
<args> start end encoding
<p>
-Encode region <var>start</var> to <var>end</var> of current buffer
-using <var>encoding</var>.
+\e$B8=:_$N\e(B buffer \e$B$N\e(B <var>start</var> \e$B$+$i\e(B <var>end</var> \e$B$^$G$N\e(B region \e$B$r\e(B
+<var>encoding</var> \e$B$r;H$C$FId9f2=$7$^$9!#\e(B
</defun>
<defun name="mime-decode-region">
<args> start end encoding
<p>
-Decode region <var>start</var> to <var>end</var> of current buffer
-using <var>encoding</var>.
+\e$B8=:_$N\e(B buffer \e$B$N\e(B <var>start</var> \e$B$+$i\e(B <var>end</var> \e$B$^$G$N\e(B region \e$B$r\e(B
+<var>encoding</var> \e$B$r;H$C$FI|9f2=$7$^$9!#\e(B
</defun>
<defun name="mime-insert-encoded-file">
<args> filename encoding
<p>
-Insert file <var>FILENAME</var> encoded by <var>ENCODING</var> format.
+<var>ENCODING</var> format \e$B$GId9f2=$5$l$?\e(B file <var>FILENAME</var> \e$B$r\e(B
+\e$BA^F~$9$k!#\e(B
</defun>
<defun name="mime-write-decoded-region">
<args> start end filename encoding
<p>
-Decode and write current region encoded by <var>encoding</var> into
-<var>filename</var>.
+<var>encoding</var> \e$B$GId9f2=$5$l$?8=:_$N\e(B region \e$B$rI|9f2=$7$F\e(B
+<var>filename</var>\e$B$K=q$-9~$_$^$9!#\e(B
<p>
-<var>start</var> and <var>end</var> are buffer positions.
+<var>start<var> \e$B$H\e(B <var>end</var> \e$B$O\e(B buffer \e$B$N0LCV$G$9!#\e(B
</defun>
-<h2> Other utilities
+<h2> \e$BB>$N\e(B utility
<node> Encoding information
<p>
<defun name="mime-encoding-list">
<opts> SERVICE
<p>
-Return list of Content-Transfer-Encoding.
+Content-Transfer-Encoding \e$B$N\e(B list \e$B$rJV$7$^$9!#\e(B
<p>
-If <var>service</var> is specified, it returns available list of
-Content-Transfer-Encoding for it.
+<var>service</var> \e$B$,;XDj$5$l$F$$$k$H!"$=$l$KBP$9$k\e(B
+Content-Transfer-Encoding \e$B$rJV$7$^$9!#\e(B
</defun>
<defun name="mime-encoding-alist">
<opts> SERVICE
<p>
-Return table of Content-Transfer-Encoding for completion.
+\e$BJd40$N$?$a$N\e(B Content-Transfer-Encoding \e$B$NI=$rJV$7$^$9!#\e(B
<p>
-If <var>service</var> is specified, it returns available list of
-Content-Transfer-Encoding for it.
+<var>service</var> \e$B$,;XDj$5$l$F$$$k>l9g$O$=$l$KBP$9$k\e(B
+Content-Transfer-Encoding \e$B$N\e(B list \e$B$rJV$7$^$9!#\e(B
</defun>
-<h2> How to write encoder/decoder module
+<h2> \e$BId9f2=\e(B/\e$BI|9f2=\e(B module \e$B$N=q$-J}\e(B
<node> mel-backend
<p>
<defmacro name="mel-define-method">
<args> name args <rest> body
<p>
-Define <var>name</var> as a method function of (nth 1 (car (last
-<var>args</var>))) backend.
+<var>name</var> \e$B$r\e(B (nth 1 (car (last <var>args</var>))) backend \e$B$N\e(B
+method \e$B4X?t$H$7$FDj5A$7$^$9!#\e(B
<p>
-<var>args</var> is like an argument list of lambda, but (car (last
-<var>args</var>)) must be specialized parameter. (car (car (last
-<var>args</var>))) is name of variable and (nth 1 (car (last
-<var>args</var>))) is name of backend (encoding).
+<var>args</var> \e$B$O\e(B lambda \e$B$N0z?t\e(B list \e$B$H;w$F$$$^$9$,!"\e(B(car (last
+<var>args</var>)) \e$B$O;XDj$5$l$?\e(B parameter \e$B$G$"$kI,MW$,$"$j$^$9!#\e(B(car
+(car (last <var>args</var>))) \e$B$OJQ?t$NL>A0$G!"\e(B(nth 1 (car (last
+<var>args</var>))) \e$B$O\e(B backend \e$B$NL>A0\e(B (encoding) \e$B$G$9!#\e(B
<p>
-Example:
+\e$BNc\e(B:
<p>
<lisp>
(mel-define-method mime-write-decoded-region (start end filename
<defmacro name="mel-define-method-function">
<args> spec function
<p>
-Set <var>spec</var>'s function definition to <var>function</var>.
+<var>spec</var> \e$B$N4X?tDj5A$r\e(B <var>function</var> \e$B$K@_Dj$7$^$9!#\e(B
<p>
-First element of <var>spec</var> is service.
+<var>spec</var> \e$B$N:G=i$NMWAG$O\e(B service \e$B$G$9!#\e(B
<p>
-Rest of <var>args</var> is like an argument list of lambda, but (car
-(last <var>args</var>)) must be specialized parameter. (car (car
-(last <var>args</var>))) is name of variable and (nth 1 (car (last
-<var>args</var>))) is name of backend (encoding).
+<var>args</var> \e$B$N;D$j$O\e(B lambda \e$B$N0z?t\e(B list \e$B;w$F$$$^$9$,!"\e(B(car (last
+<var>args</var>)) \e$B$O;XDj$5$l$?\e(B parameter \e$B$G$"$kI,MW$,$"$j$^$9!#\e(B(car
+(car (last <var>args</var>))) \e$B$OJQ?t$NL>A0$G!"\e(B(nth 1 (car (last
+<var>args</var>))) \e$B$O\e(B backend \e$B$NL>A0\e(B (encoding) \e$B$G$9!#\e(B
<p>
-Example:
+\e$BNc\e(B:
<p>
<lisp>
(mel-define-method-function (mime-encode-string string (nil "base64"))
</defmacro>
-<h2> How to add encoding/decoding service
+<h2> \e$BId9f2=\e(B/\e$BI|9f2=\e(B service \e$B$rDI2C$9$kJ}K!\e(B
<node> generic function for mel-backend
<p>
<defmacro name="mel-define-service">
<args> name
<opts> args doc-string
<p>
-Define <var>name</var> as a service for Content-Transfer-Encodings.
+<var>name</var> \e$B$r\e(B Content-Transfer-Encoding \e$B$N\e(B service \e$B$H$7$FDj5A$7$^\e(B
+\e$B$9!#\e(B
<p>
-If <var>args</var> is specified, <var>name</var> is defined as a
-generic function for the service.
+<var>args</var> \e$B$,;XDj$5$l$F$$$k$H!"\e(B<var>name</var> \e$B$O\e(B service \e$B$N\e(B
+generic function \e$B$H$7$FDj5A$5$l$^$9!#\e(B
<p>
-Example:
+\e$BNc\e(B:
<p>
<lisp>
(mel-define-service encoded-text-encode-string (string encoding)
<defvar name="eword-field-encoding-method-alist">
<p>
-Association list to specify field encoding method. Each element looks
-like (FIELD . METHOD).
+Field \e$B$rId9f2=$9$kJ}K!$r;XDj$9$kO"A[\e(B list\e$B!#3F\e(B element \e$B$O\e(B (FIELD
+. METHOD) \e$B$NMM$K$J$C$F$$$k!#\e(B
<p>
-If METHOD is <code>mime</code>, the FIELD will be encoded into MIME
-format (encoded-word).
+METHOD \e$B$,\e(B <code>mime</code> \e$B$G$"$l$P!"\e(BFIELD \e$B$O\e(B MIME format \e$B$KId9f2=$5\e(B
+\e$B$l$k\e(B (encoded-word)\e$B!#\e(B
<p>
-If METHOD is <code>nil</code>, the FIELD will not be encoded.
+METHOD \e$B$,\e(B <code>nil</code> \e$B$G$"$l$P!"\e(BFIELD \e$B$OId9f2=$5$l$J$$!#\e(B
<p>
-If METHOD is a MIME charset, the FIELD will be encoded as the charset
-when it must be convert into network-code.
+METHOD \e$B$,\e(B MIME charset \e$B$G$"$l$P!"\e(BFIELD \e$B$O%M%C%H%o!<%/%3!<%I$KJQ49$7$J\e(B
+\e$B$1$l$P$J$i$J$$$H$-$K\e(B charset \e$B$KId9f2=$5$l$k!#\e(B
<p>
-Otherwise the FIELD will be encoded as variable
-<code>default-mime-charset</code> when it must be convert into
-network-code.
+\e$B$=$&$G$J$1$l$P!"\e(BFIELD \e$B$O%M%C%H%o!<%/%3!<%I$KJQ49$7$J$1$l$P$J$i$J$$$H$-\e(B
+\e$B$K\e(B \e$BJQ?t\e(B <code>default-mime-charset</code> \e$B$GId9f2=$5$l$k\e(B
</defvar>
;;; Code:
-(require 'std11)
(require 'mime-def)
-
-(eval-when-compile (require 'cl))
+(require 'std11)
;;; @ lexical analyzer
(require 'mime-def)
(require 'eword-decode)
-(autoload 'eword-encode-field "eword-encode"
- "Encode header field STRING, and return the result.")
+(eval-and-compile
+
(autoload 'eword-encode-header "eword-encode"
"Encode header fields to network representation, such as MIME encoded-word.")
-
(autoload 'mime-parse-Content-Type "mime-parse"
"Parse STRING as field-body of Content-Type field.")
(autoload 'mime-read-Content-Type "mime-parse"
(autoload 'mime-parse-buffer "mime-parse"
"Parse BUFFER as a MIME message.")
+)
;;; @ Entity Representation and Implementation
;;;
;; Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
;; Author: Tomoji Kagatani <kagatani@rbc.ncl.omron.co.jp>
-;; Simon Leinen <simon@switch.ch> (ESMTP support)
-;; Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
+;; Simon Leinen <simon@switch.ch> (ESMTP support)
+;; MORIOKA Tomohiko <tomo@m17n.org> (separate smtp.el from smtpmail.el)
+;; Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
;; Keywords: SMTP, mail
;; This file is part of FLIM (Faithful Library about Internet Message).
;; 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
+;; along with this program; 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 'mail-utils) ; pick up mail-strip-quoted-names
+(require 'poe)
+(require 'poem)
+(require 'pcustom)
+(require 'mail-utils) ; mail-strip-quoted-names
+
+(eval-when-compile (require 'cl)) ; push
(defgroup smtp nil
"SMTP protocol for sending mail."
:group 'smtp)
(defcustom smtp-server (or (getenv "SMTPSERVER") smtp-default-server)
- "*The name of the host running SMTP server."
- :type '(choice (const nil) string)
+ "*The name of the host running SMTP server. It can also be a function
+called from `smtp-via-smtp' with arguments SENDER and RECIPIENTS."
+ :type '(choice (string :tag "Name")
+ (function :tag "Function"))
:group 'smtp)
(defcustom smtp-service "smtp"
:type '(choice (const nil) string)
:group 'smtp)
-(defvar smtp-debug-info nil)
+(defcustom smtp-debug-info nil
+ "*smtp debug info printout. messages and process buffer."
+ :type 'boolean
+ :group 'smtp)
+
(defvar smtp-read-point nil)
(defun smtp-make-fqdn ()
(error "Cannot generate valid FQDN. Set `smtp-local-domain' correctly.")))))
(defun smtp-via-smtp (sender recipients smtp-text-buffer)
- (let (process response extensions)
+ (let ((server (if (functionp smtp-server)
+ (funcall smtp-server sender recipients)
+ smtp-server))
+ process response extensions)
(save-excursion
(set-buffer
(get-buffer-create
- (format "*trace of SMTP session to %s*" smtp-server)))
+ (format "*trace of SMTP session to %s*" server)))
(erase-buffer)
(make-local-variable 'smtp-read-point)
(setq smtp-read-point (point-min))
(unwind-protect
(catch 'done
(setq process (open-network-stream-as-binary
- "SMTP" (current-buffer) smtp-server smtp-service))
+ "SMTP" (current-buffer) server smtp-service))
(or process (throw 'done nil))
(set-process-filter process 'smtp-process-filter)
extensions)
(setq extension-lines (cdr extension-lines)))))
- ;; ONEX --- One message transaction only (sendmail extension?)
+ ;; ONEX --- One message transaction only (sendmail extension?)
(if (or (memq 'onex extensions)
(memq 'xone extensions))
(progn
(>= (car response) 400))
(throw 'done (car (cdr response))))))
- ;; VERB --- Verbose (sendmail extension?)
+ ;; VERB --- Verbose (sendmail extension?)
(if (and smtp-debug-info
(or (memq 'verb extensions)
(memq 'xvrb extensions)))
(>= (car response) 400))
(throw 'done (car (cdr response))))))
- ;; XUSR --- Initial (user) submission (sendmail extension?)
+ ;; XUSR --- Initial (user) submission (sendmail extension?)
(if (memq 'xusr extensions)
(progn
(smtp-send-command process "XUSR")
process
(format "MAIL FROM:<%s>%s%s"
sender
- ;; SIZE --- Message Size Declaration (RFC1870)
+ ;; SIZE --- Message Size Declaration (RFC1870)
(if (memq 'size extensions)
(format " SIZE=%d"
(save-excursion
;; those two bytes anyway:
2)))
"")
- ;; 8BITMIME --- 8bit-MIMEtransport (RFC1652)
+ ;; 8BITMIME --- 8bit-MIMEtransport (RFC1652)
(if (and (memq '8bitmime extensions)
smtp-use-8bitmime)
" BODY=8BITMIME"
(not (integerp (car response)))
(>= (car response) 400))
(throw 'done (car (cdr response))))
-
+
;; RCPT TO:<recipient>
(while recipients
(smtp-send-command process
(not (integerp (car response)))
(>= (car response) 400))
(throw 'done (car (cdr response)))))
-
+
;; DATA
(smtp-send-command process "DATA")
(setq response (smtp-read-response process))
;; 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,
+;; along with this program; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; Code:
+(require 'poe)
+(require 'pcustom)
(require 'smtp)
(require 'sendmail)
(require 'time-stamp)
+(eval-when-compile (require 'static))
+
+(static-when (featurep 'xemacs)
+ (define-obsolete-variable-alias 'smtpmail-default-smtp-server
+ 'smtp-default-server)
+ (define-obsolete-variable-alias 'smtpmail-smtp-server 'smtp-server)
+ (define-obsolete-variable-alias 'smtpmail-smtp-service 'smtp-service)
+ (define-obsolete-variable-alias 'smtpmail-local-domain 'smtp-local-domain)
+ (define-obsolete-variable-alias 'smtpmail-debug-info 'smtp-debug-info)
+ )
+
;;;
(defcustom smtpmail-queue-mail nil
(backward-char 1)
(setq delimline (point-marker))
;; (sendmail-synch-aliases)
- (if mail-aliases
+ (if (and mail-aliases (fboundp 'expand-mail-aliases)) ; XEmacs
(expand-mail-aliases (point-min) delimline))
(goto-char (point-min))
;; ignore any blank lines in the header
;;; Code:
-(or (fboundp 'buffer-substring-no-properties)
- (require 'poe))
-
-(require 'custom)
+(require 'poe)
+(require 'poem) ; find-non-ascii-charset-string
+(require 'pcustom) ; std11-lexical-analyzer
;;; @ fetch