(base64-internal-decode-string string)))
-(defun base64-insert-encoded-file (filename)
+(mel-define-method-function (mime-encode-string string (nil "base64"))
+ 'base64-encode-string)
+(mel-define-method-function (mime-decode-string string (nil "base64"))
+ '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"))
+ 'base64-decode-region)
+
+(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)))
+ (base64-decode-string string)
+ (error "Invalid encoded-text %s" string)))
+
+(mel-define-method mime-insert-encoded-file (filename (nil "base64"))
"Encode contents of file FILENAME to base64, and insert the result.
It calls external base64 encoder specified by
`base64-external-encoder'. So you must install the program (maybe
(insert "\n"))
))
-(defun base64-write-decoded-region (start end filename)
+(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
;;; @ etc
;;;
-(defun base64-encoded-length (string)
- (let ((len (length string)))
- (* (+ (/ len 3)
- (if (= (mod len 3) 0) 0 1)
- ) 4)
- ))
-
(defun pack-sequence (seq size)
"Split sequence SEQ into SIZE elements packs,
and return list of packs. [mel-b; tl-seq function]"