(require 'mh-e)
(mh-require 'gnus-util nil t)
(mh-require 'mm-bodies nil t)
(mh-require 'mm-decode nil t)
(mh-require 'mm-view nil t)
(mh-require 'mml nil t)
(defun-mh mh-gnus-local-map-property gnus-local-map-property (map)
"Return a list suitable for a text property list specifying keymap MAP."
(cond (mh-xemacs-flag (list 'keymap map))
((>= emacs-major-version 21) (list 'keymap map))
(t (list 'local-map map))))
(defun-mh mh-mm-merge-handles mm-merge-handles (handles1 handles2)
(append (if (listp (car handles1)) handles1 (list handles1))
(if (listp (car handles2)) handles2 (list handles2))))
(defun-mh mh-mm-set-handle-multipart-parameter
mm-set-handle-multipart-parameter (handle parameter value)
(if handle
(put-text-property 0 (length (car handle)) parameter value
(car handle))))
(defun-mh mh-mm-inline-text-vcard mm-inline-text-vcard (handle)
(let (buffer-read-only)
(mm-insert-inline
handle
(concat "\n-- \n"
(ignore-errors
(if (fboundp 'vcard-pretty-print)
(vcard-pretty-print (mm-get-part handle))
(vcard-format-string
(vcard-parse-string (mm-get-part handle)
'vcard-standard-filter))))))))
(defun-mh mh-mm-possibly-verify-or-decrypt
mm-possibly-verify-or-decrypt (parts ctl)
nil)
(defmacro-mh mh-mm-handle-multipart-ctl-parameter
mm-handle-multipart-ctl-parameter (handle parameter)
`(get-text-property 0 ,parameter (car ,handle)))
(defun-mh mh-mm-readable-p mm-readable-p (handle)
"Say whether the content of HANDLE is readable."
(and (< (with-current-buffer (mm-handle-buffer handle)
(buffer-size)) 10000)
(mm-with-unibyte-buffer
(mm-insert-part handle)
(and (eq (mm-body-7-or-8) '7bit)
(not (mh-mm-long-lines-p 76))))))
(defun-mh mh-mm-long-lines-p mm-long-lines-p (length)
"Say whether any of the lines in the buffer is longer than LENGTH."
(save-excursion
(goto-char (point-min))
(end-of-line)
(while (and (not (eobp))
(not (> (current-column) length)))
(forward-line 1)
(end-of-line))
(and (> (current-column) length)
(current-column))))
(defun-mh mh-mm-keep-viewer-alive-p mm-keep-viewer-alive-p (handle)
nil)
(defun-mh mh-mm-destroy-parts mm-destroy-parts (list)
"Older versions of Emacs don't have this function."
nil)
(defun-mh mh-mm-uu-dissect-text-parts mm-uu-dissect-text-parts (handles)
"Emacs 21 and XEmacs don't have this function."
nil)
(defun-mh mh-mml-minibuffer-read-disposition
mml-minibuffer-read-disposition (type &optional default)
(unless default (setq default
(if (and (string-match "\\`text/" type)
(not (string-match "\\`text/rtf\\'" type)))
"inline"
"attachment")))
(let ((disposition (completing-read
(format "Disposition (default %s): " default)
'(("attachment") ("inline") (""))
nil t nil nil default)))
(if (not (equal disposition ""))
disposition
default)))
(defun mh-mm-save-part (handle)
"Write HANDLE to a file."
(let ((name (mail-content-type-get (mm-handle-type handle) 'name))
(filename (mail-content-type-get
(mm-handle-disposition handle) 'filename))
file)
(when filename
(setq filename (file-name-nondirectory filename)))
(setq file (read-file-name "Save MIME part to: "
(or mm-default-directory
default-directory)
nil nil (or filename name "")))
(setq mm-default-directory (file-name-directory file))
(and (or (not (file-exists-p file))
(yes-or-no-p (format "File %s already exists; overwrite? "
file)))
(mm-save-part-to-file handle file))))
(defun mh-mm-text-html-renderer ()
"Find the renderer Gnus is using to display text/html MIME parts."
(or (and (boundp 'mm-inline-text-html-renderer) mm-inline-text-html-renderer)
(and (boundp 'mm-text-html-renderer) mm-text-html-renderer)))
(provide 'mh-gnus)