• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/mh-e/

Lines Matching +defs:mh +defs:mml +defs:tag +defs:present

0 ;;; mh-mime.el --- MH-E MIME support
9 ;; See: mh-e.el
36 ;; Implement mh-auto-mh-to-mime (if non-nil, \\[mh-send-letter]
37 ;; invokes mh-mh-to-mime automatically before sending.)
38 ;; Actually, instead of mh-auto-mh-to-mime,
40 ;; MIME option to mh-forward command to move to content-description
47 (require 'mh-e)
48 (require 'mh-gnus) ;needed because mh-gnus.el not compiled
55 (require 'mml)
66 (autoload 'mml-unsecure-message "mml-sec")
75 ;; This has to be a macro, since we do: (setf (mh-buffer-data) ...)
76 ;;;###mh-autoload
77 (defmacro mh-buffer-data ()
79 `(gethash (current-buffer) mh-globals-hash))
82 (mh-defstruct (mh-buffer-data (:conc-name mh-mime-)
83 (:constructor mh-make-buffer-data))
92 (defvar mh-mm-inline-media-tests
148 mh-mm-inline-text-vcard
153 ("message/rfc822" mh-mm-inline-message identity)
178 (".*" mm-inline-text mh-mm-readable-p))
181 (defvar mh-mime-save-parts-directory nil
182 "Default to use for `mh-mime-save-parts-default-directory'.
187 (defvar mh-mime-button-commands
188 '((mh-press-button "\r" "Toggle Display")))
189 (defvar mh-mime-button-map
193 (set-keymap-parent map mh-show-mode-map))
194 (mh-do-in-gnu-emacs
195 (define-key map [mouse-2] 'mh-push-button))
196 (mh-do-in-xemacs
197 (define-key map '(button2) 'mh-push-button))
198 (dolist (c mh-mime-button-commands)
201 (defvar mh-mime-button-line-format-alist
206 (defvar mh-mime-button-line-format "%{%([%p. %d%T]%)%}%e\n")
207 (defvar mh-mime-security-button-pressed nil)
208 (defvar mh-mime-security-button-line-format "%{%([[%t:%i]%D]%)%}\n")
209 (defvar mh-mime-security-button-end-line-format "%{%([[End of %t]%D]%)%}\n")
210 (defvar mh-mime-security-button-line-format-alist
215 (defvar mh-mime-security-button-map
218 (set-keymap-parent map mh-show-mode-map))
219 (define-key map "\r" 'mh-press-button)
220 (mh-do-in-gnu-emacs
221 (define-key map [mouse-2] 'mh-push-button))
222 (mh-do-in-xemacs
223 (define-key map '(button2) 'mh-push-button))
233 ;;;###mh-autoload
234 (defun mh-display-with-external-viewer (part-index)
257 (mh-folder-mime-action
260 (let* ((part (get-text-property (point) 'mh-data))
269 (folder mh-show-folder-buffer)
274 (mh-handle-set-external-undisplayer folder handle function)))
279 ;;;###mh-autoload
280 (defun mh-folder-inline-mime-part (part-index)
294 (mh-folder-mime-action part-index #'mh-mime-inline-part nil))
296 (defun mh-mime-inline-part ()
300 (data (get-text-property (point) 'mh-data))
301 (inserted-flag (get-text-property (point) 'mh-mime-inserted))
307 (add-text-properties (mh-line-beginning-position)
308 (mh-line-end-position) '(mh-mime-inserted t))
314 start (progn (goto-char start) (mh-line-end-position))
315 `(mh-region (,start . ,end)))))
317 (mh-press-button)
322 ;;;###mh-autoload
323 (defun mh-folder-save-mime-part (part-index)
338 (mh-folder-mime-action part-index #'mh-mime-save-part nil))
340 (defun mh-mime-save-part ()
343 (let ((data (get-text-property (point) 'mh-data)))
346 (file-name-as-directory (or mh-mime-save-parts-directory
348 (mh-mm-save-part data)
349 (setq mh-mime-save-parts-directory mm-default-directory)))))
351 ;;;###mh-autoload
352 (defun mh-folder-toggle-mime-part (part-index)
368 (mh-folder-mime-action part-index #'mh-press-button t))
370 ;;;###mh-autoload
371 (defun mh-mime-save-parts (prompt)
376 option `mh-mime-save-parts-default-directory' unless you use a
382 (let ((msg (if (eq major-mode 'mh-show-mode)
383 (mh-show-buffer-message-number)
384 (mh-get-msg-num t)))
385 (folder (if (eq major-mode 'mh-show-mode)
386 mh-show-folder-buffer
387 mh-current-folder))
388 (command (if (mh-variant-p 'nmh) "mhstore" "mhn"))
392 (equal nil mh-mime-save-parts-default-directory)
393 (equal t mh-mime-save-parts-default-directory))
394 (not mh-mime-save-parts-directory))
397 (equal t mh-mime-save-parts-default-directory))
398 mh-mime-save-parts-directory)
401 mh-mime-save-parts-directory)
402 "" mh-mime-save-parts-directory t ""))
403 ((stringp mh-mime-save-parts-default-directory)
404 mh-mime-save-parts-default-directory)
406 mh-mime-save-parts-directory))))
407 (if (and (equal directory "") mh-mime-save-parts-directory)
408 (setq directory mh-mime-save-parts-directory))
411 (if (equal nil mh-mime-save-parts-default-directory)
412 (setq mh-mime-save-parts-directory directory))
414 (set-buffer (get-buffer-create mh-log-buffer))
416 (setq mh-mime-save-parts-directory directory)
417 (let ((initial-size (mh-truncate-log-buffer)))
419 (expand-file-name command mh-progs) nil t nil
420 (mh-list-to-string (list folder msg "-auto"
421 (if (not (mh-variant-p 'nmh))
425 (switch-to-buffer-other-window mh-log-buffer)
428 ;;;###mh-autoload
429 (defun mh-toggle-mh-decode-mime-flag ()
430 "Toggle the value of `mh-decode-mime-flag'."
432 (setq mh-decode-mime-flag (not mh-decode-mime-flag))
433 (mh-show nil t)
434 (message "%s" (if mh-decode-mime-flag
438 ;;;###mh-autoload
439 (defun mh-toggle-mime-buttons ()
440 "Toggle option `mh-display-buttons-for-inline-parts-flag'."
442 (setq mh-display-buttons-for-inline-parts-flag
443 (not mh-display-buttons-for-inline-parts-flag))
444 (mh-show nil t))
451 (defun mh-mm-inline-message (handle)
456 (clean-message-header mh-clean-message-header-flag)
457 (invisible-headers mh-invisible-header-fields-compiled)
463 (mh-mime-display
464 (or (gethash handle (mh-mime-handles-cache (mh-buffer-data)))
465 (setf (gethash handle (mh-mime-handles-cache (mh-buffer-data)))
468 (mh-mm-uu-dissect-text-parts handles)
470 (setf (mh-mime-handles (mh-buffer-data))
471 (mh-mm-merge-handles
472 handles (mh-mime-handles (mh-buffer-data))))
476 (mh-show-xface)
478 (mh-clean-msg-header (point-min)
483 (mh-start-of-uncleaned-message)))
484 (mh-decode-message-header)
485 (mh-show-addr)
487 (when (eq mh-highlight-citation-style 'gnus)
488 (mh-gnus-article-highlight-citation))
491 (mh-display-smileys)
492 (mh-display-emphasis)
505 ;;;###mh-autoload
506 (defun mh-decode-message-header ()
508 (when mh-decode-mime-flag
510 (rfc2047-decode-region (point-min) (mh-mail-header-end)))))
512 ;;;###mh-autoload
513 (defun mh-mime-display (&optional pre-dissected-handles)
516 handles. If present they are displayed otherwise the buffer is
519 (folder mh-show-folder-buffer)
523 (mh-handle-set-external-undisplayer folder handle function)))
535 (mh-mm-uu-dissect-text-parts handles)
537 (setf (mh-mime-handles (mh-buffer-data))
538 (mh-mm-merge-handles handles
539 (mh-mime-handles (mh-buffer-data))))
541 (mh-decode-message-body)))
555 (mh-mime-display-part handles))
557 (mh-signature-highlight))))
563 (defun mh-decode-message-body ()
578 (narrow-to-region (min (1+ (mh-mail-header-end)) (point-max))
585 (defun mh-mime-display-part (handle)
590 (mh-mime-display-single handle))
592 (mh-mime-display-alternative (cdr handle)))
593 ((and mh-pgp-support-flag
596 (mh-mime-display-security handle))
598 (mh-mime-display-mixed (cdr handle)))))
600 (defun mh-mime-display-mixed (handles)
602 (mapcar #'mh-mime-display-part handles))
604 (defun mh-mime-display-alternative (handles)
611 (mh-mime-display-part preferred)
612 (mh-mime-maybe-display-alternatives others))
616 (mh-mime-display-single preferred)
617 (mh-mime-maybe-display-alternatives others)
620 (mh-mime-display-mixed handles)))))
622 (defun mh-mime-maybe-display-alternatives (alternatives)
624 If `mh-mime-display-alternatives-flag' is non-nil then display
626 (when (and mh-display-buttons-for-alternatives-flag alternatives)
631 (mh-insert-mime-button x (mh-mime-part-index x) nil))
634 (defun mh-mime-display-security (handle)
639 (mh-insert-mime-security-button handle)
640 (mh-mime-display-mixed (cdr handle))
642 (let ((mh-mime-security-button-line-format
643 mh-mime-security-button-end-line-format))
644 (mh-insert-mime-security-button handle))
645 (mh-mm-set-handle-multipart-parameter
646 handle 'mh-region (cons (point-min-marker) (point-max-marker)))))
648 (defun mh-mime-display-single (handle)
651 (small-image-flag (mh-small-image-p handle))
658 (mh-inline-vcard-p handle); inline vcard OR
669 (cond ((and mh-pgp-support-flag
674 (mh-insert-mime-button handle (mh-mime-part-index handle) nil))
676 (not mh-display-buttons-for-inline-parts-flag))
679 (mh-signature-highlight handle))
681 mh-display-buttons-for-inline-parts-flag)
683 (mh-insert-mime-button handle (mh-mime-part-index handle) nil)
685 (mh-mm-display-part handle)))
690 ;; using an extra property 'mh-region to remember the region that is added
693 (defun mh-mm-display-part (handle)
696 (let ((id (get-text-property (point) 'mh-part))
713 (let ((region (get-text-property point 'mh-region)))
715 (mh-funcall-if-exists
738 (when (eq mh-highlight-citation-style 'gnus)
739 (mh-gnus-article-highlight-citation))
740 (mh-display-smileys)
741 (mh-display-emphasis)
742 (mh-signature-highlight handle))
751 (mh-insert-mime-button handle id (mm-handle-displayed-p handle))
754 (add-text-properties (mh-line-beginning-position)
755 (mh-line-end-position)
756 `(mh-region ,region)))))))
758 (defun mh-mime-part-index (handle)
763 (or (gethash handle (mh-mime-part-index-hash (mh-buffer-data)))
764 (setf (gethash handle (mh-mime-part-index-hash (mh-buffer-data)))
765 (incf (mh-mime-parts-count (mh-buffer-data))))))
767 (defun mh-small-image-p (handle)
769 This is only useful if a Content-Disposition header is not present."
771 mh-mm-inline-media-tests)))
779 (or (mh-do-in-xemacs
780 (and (mh-funcall-if-exists glyphp image)
782 (or mh-max-inline-image-width (window-pixel-width)))
784 (or mh-max-inline-image-height
786 (mh-do-in-gnu-emacs
787 (let ((size (mh-funcall-if-exists image-size image)))
789 (< (cdr size) (or mh-max-inline-image-height
791 (< (car size) (or mh-max-inline-image-width
794 (defun mh-inline-vcard-p (handle)
804 (not (mh-signature-separator-p)))))))
806 (defun mh-signature-highlight (&optional handle)
815 ((eq (mh-mm-text-html-renderer) 'lynx) "^ --$")
820 (mh-do-in-gnu-emacs
822 (overlay-put ov 'face 'mh-show-signature)
824 (mh-do-in-xemacs
826 'face 'mh-show-signature))))))
838 (defun mh-insert-mime-button (handle index displayed)
864 mh-mime-button-line-format mh-mime-button-line-format-alist
865 `(,@(mh-gnus-local-map-property mh-mime-button-map)
866 mh-callback mh-mm-display-part
867 mh-part ,index
868 mh-data ,handle))
873 :action 'mh-widget-press-button
874 :button-keymap mh-mime-button-map
877 (dolist (ov (mh-funcall-if-exists overlays-in begin end))
878 (mh-funcall-if-exists overlay-put ov 'evaporate t))))
885 (defun mh-insert-mime-security-button (handle)
887 (let* ((protocol (mh-mm-handle-multipart-ctl-parameter handle 'protocol))
895 (info (or (mh-mm-handle-multipart-ctl-parameter handle 'gnus-info)
897 (details (mh-mm-handle-multipart-ctl-parameter handle 'gnus-details))
900 (setq pressed-details (if mh-mime-security-button-pressed details ""))
901 (setq face (mh-mime-security-button-face info))
905 mh-mime-security-button-line-format
906 mh-mime-security-button-line-format-alist
907 `(,@(mh-gnus-local-map-property mh-mime-security-button-map)
908 mh-button-pressed ,mh-mime-security-button-pressed
909 mh-callback mh-mime-security-press-button
910 mh-line-format ,mh-mime-security-button-line-format
911 mh-data ,handle))
915 :action 'mh-widget-press-button
916 :button-keymap mh-mime-security-button-map
919 (dolist (ov (mh-funcall-if-exists overlays-in begin end))
920 (mh-funcall-if-exists overlay-put ov 'evaporate t))
928 (defun mh-mime-security-button-face (info)
931 'mh-show-pgg-good)
933 'mh-show-pgg-bad)
935 'mh-show-pgg-unknown)
937 'mh-show-pgg-unknown)
939 'mh-show-pgg-good)))
946 (defun mh-folder-mime-action (part-index action include-security-flag)
953 (unless mh-showing-mode
954 (mh-show))
955 (mh-in-show-buffer (mh-show-buffer)
959 (let ((part (get-text-property p 'mh-part)))
963 (get-text-property p 'mh-data)
964 (integerp (get-text-property p 'mh-part)))))))
966 (cond ((and (get-text-property point 'mh-part)
968 (= (get-text-property point 'mh-part) part-index)))
970 ((and (get-text-property point 'mh-data)
975 (mh-goto-next-button nil criterion)
980 ;;;###mh-autoload
981 (defun mh-goto-next-button (backward-flag &optional criterion)
997 (while (get-text-property (point) 'mh-data)
1006 (while (and (get-text-property (point) 'mh-data)
1021 (when (and (get-text-property (point) 'mh-data)
1027 (defun mh-widget-press-button (widget el)
1031 (mh-press-button))
1033 (defun mh-press-button ()
1039 (let ((mm-inline-media-tests mh-mm-inline-media-tests)
1040 (data (get-text-property (point) 'mh-data))
1041 (function (get-text-property (point) 'mh-callback))
1043 (folder mh-show-folder-buffer))
1046 (mh-handle-set-external-undisplayer folder handle function)))
1052 (defun mh-push-button (event)
1059 (mh-do-at-event-location event
1060 (let ((folder mh-show-folder-buffer)
1061 (mm-inline-media-tests mh-mm-inline-media-tests)
1062 (data (get-text-property (point) 'mh-data))
1063 (function (get-text-property (point) 'mh-callback)))
1065 (mh-handle-set-external-undisplayer folder handle func)))
1068 (defun mh-handle-set-external-undisplayer (folder handle function)
1075 (if (mh-mm-keep-viewer-alive-p handle)
1081 (push new-handle (mh-mime-handles (mh-buffer-data)))))
1084 (defun mh-mime-security-press-button (handle)
1086 (if (mh-mm-handle-multipart-ctl-parameter handle 'gnus-info)
1087 (mh-mime-security-show-details handle)
1088 (let ((region (mh-mm-handle-multipart-ctl-parameter handle 'mh-region))
1093 (with-current-buffer (mh-mm-handle-multipart-ctl-parameter handle 'buffer)
1096 (new (mh-mm-possibly-verify-or-decrypt (cdr handle) handle)))
1098 (mh-mm-destroy-parts (cdr handle))
1100 (mh-mime-display-security handle)
1106 (defun mh-mime-security-show-details (handle)
1108 (let ((details (mh-mm-handle-multipart-ctl-parameter handle 'gnus-details)))
1110 (let ((mh-mime-security-button-pressed
1111 (not (get-text-property (point) 'mh-button-pressed)))
1112 (mh-mime-security-button-line-format
1113 (get-text-property (point) 'mh-line-format)))
1115 (while (eq (get-text-property (point) 'mh-line-format)
1116 mh-mime-security-button-line-format)
1121 (mh-insert-mime-security-button handle))
1126 'mh-line-format mh-mime-security-button-line-format)
1135 ;;;###mh-autoload
1136 (defun mh-add-missing-mime-version-header ()
1150 ;;;###mh-autoload
1151 (defun mh-display-smileys ()
1153 (when (and mh-graphical-smileys-flag (mh-small-show-buffer-p))
1154 (mh-funcall-if-exists smiley-region (point-min) (point-max))))
1156 ;;;###mh-autoload
1157 (defun mh-display-emphasis ()
1159 (when (and mh-graphical-emphasis-flag (mh-small-show-buffer-p))
1165 (defun mh-small-show-buffer-p ()
1174 (setq max (cdr (or (assoc 'mh-show-mode font-lock-maximum-size)
1185 ;;;###mh-autoload
1186 (defun mh-compose-forward (&optional description folder range)
1187 "Add tag to forward a message.
1192 folder. Check the documentation of `mh-interactive-range' to see
1195 The option `mh-compose-insertion' controls what type of tags are inserted."
1198 (mml-minibuffer-read-description))
1200 (mh-prompt-for-folder "Message from"
1201 mh-sent-from-folder nil))
1203 (if (and (equal folder mh-sent-from-folder)
1204 (numberp mh-sent-from-msg))
1205 mh-sent-from-msg
1206 (nth 0 (mh-translate-range folder "cur"))))
1208 (mh-read-range "Forward" folder
1214 (let ((messages (mapconcat 'identity (mh-list-to-string range) " ")))
1215 (dolist (message (mh-translate-range folder messages))
1216 (if (equal mh-compose-insertion 'mml)
1217 (mh-mml-forward-message description folder (format "%s" message))
1218 (mh-mh-forward-message description folder (format "%s" message))))))
1220 ;;;###mh-autoload
1221 (defun mh-mml-forward-message (description folder message)
1226 (let ((msg (if (and (equal message "") (numberp mh-sent-from-msg))
1227 mh-sent-from-msg
1231 ;; Rationale: mml-attach-file constructs a malformed composition
1233 (mml-attach-file (format "%s%s/%d"
1234 mh-user-path (substring folder 1) msg)
1236 (mml-attach-file (format "%s%s/%d"
1237 mh-user-path (substring folder 1) msg)
1242 (defun mh-mh-forward-message (&optional description folder messages)
1243 "Add tag to forward a message.
1248 See also \\[mh-mh-to-mime]."
1250 (mml-minibuffer-read-description)
1251 (mh-prompt-for-folder "Message from" mh-sent-from-folder nil)
1253 (if (numberp mh-sent-from-msg)
1255 mh-sent-from-msg)
1271 (if (numberp mh-sent-from-msg)
1272 (insert " " (int-to-string mh-sent-from-msg))))
1275 ;;;###mh-autoload
1276 (defun mh-compose-insertion (&optional inline)
1277 "Add tag to include a file such as an image or sound.
1284 The option `mh-compose-insertion' controls what type of tags are
1288 (if (equal mh-compose-insertion 'mml)
1290 (mh-mml-attach-file "inline")
1291 (mh-mml-attach-file))
1292 (call-interactively 'mh-mh-attach-file)))
1294 (defun mh-mml-attach-file (&optional disposition)
1295 "Add a tag to insert a MIME message part from a file.
1301 This is basically `mml-attach-file' from Gnus, modified such that a prefix
1304 (let* ((file (mml-minibuffer-read-file "Attach file: "))
1305 (type (mh-minibuffer-read-type file))
1306 (description (mml-minibuffer-read-description))
1308 (mh-mml-minibuffer-read-disposition type))))
1309 (mml-insert-empty-tag 'part 'type type 'filename file
1312 (defun mh-mh-attach-file (filename type description attributes)
1313 "Add a tag to insert a MIME message part from a file.
1319 See also \\[mh-mh-to-mime]."
1320 (interactive (let ((filename (mml-minibuffer-read-file "Attach file: ")))
1323 (mh-minibuffer-read-type filename)
1324 (mml-minibuffer-read-description)
1329 (mh-mh-compose-type filename type description attributes))
1331 (defun mh-mh-compose-type (filename type
1349 ;;;###mh-autoload
1350 (defun mh-mh-compose-anon-ftp (host filename type description)
1351 "Add tag to include anonymous ftp reference to a file.
1357 See also \\[mh-mh-to-mime]."
1361 (mh-minibuffer-read-type "DUMMY-FILENAME")
1362 (mml-minibuffer-read-description)))
1363 (mh-mh-compose-external-type "anon-ftp" host filename
1366 ;;;###mh-autoload
1367 (defun mh-mh-compose-external-compressed-tar (host filename description)
1368 "Add tag to include anonymous ftp reference to a compressed tar file.
1371 the command \\[mh-mh-compose-anon-ftp], the file will also be
1375 See also \\[mh-mh-to-mime]."
1379 (mml-minibuffer-read-description)))
1380 (mh-mh-compose-external-type "anon-ftp" host filename
1394 (defvar mh-access-types
1412 ;;;###mh-autoload
1413 (defun mh-mh-compose-external-type (access-type host filename type
1417 "Add tag to refer to a remote file.
1426 See also \\[mh-mh-to-mime]."
1428 (completing-read "Access type: " mh-access-types)
1431 (mh-minibuffer-read-type "DUMMY-FILENAME")
1432 (if current-prefix-arg (mml-minibuffer-read-description))
1456 (defvar mh-mh-to-mime-args nil
1457 "Extra arguments for \\[mh-mh-to-mime] to pass to the \"mhbuild\" command.
1458 The arguments are passed to \"mhbuild\" if \\[mh-mh-to-mime] is
1462 ;;;###mh-autoload
1463 (defun mh-mh-to-mime (&optional extra-args)
1472 `mh-mh-to-mime-args'. For example, you can build a consistency
1473 check into the message by setting `mh-mh-to-mime-args' to
1479 The hook `mh-mh-to-mime-hook' is called after the message has been
1483 \\[mh-mh-to-mime-undo]."
1485 (mh-mh-quote-unescaped-sharp)
1487 (message "Running %s..." (if (mh-variant-p 'nmh) "mhbuild" "mhn"))
1489 ((mh-variant-p 'nmh)
1490 (mh-exec-cmd-error nil
1492 (if extra-args mh-mh-to-mime-args)
1495 (mh-exec-cmd-error (format "mhdraft=%s" buffer-file-name)
1497 (if extra-args mh-mh-to-mime-args)
1500 (message "Running %s...done" (if (mh-variant-p 'nmh) "mhbuild" "mhn"))
1501 (run-hooks 'mh-mh-to-mime-hook))
1503 (defun mh-mh-quote-unescaped-sharp ()
1505 If the \"#\" character is present in the first column, but it isn't
1512 (unless (mh-mh-directive-present-p (point) (mh-line-end-position))
1514 (goto-char (mh-line-end-position)))))
1516 ;;;###mh-autoload
1517 (defun mh-mh-to-mime-undo (noconfirm)
1518 "Undo effects of \\[mh-mh-to-mime].
1548 (defvar mh-identity-pgg-default-user-id)
1550 ;;;###mh-autoload
1551 (defun mh-mml-secure-message-encrypt (method)
1552 "Add tag to encrypt the message.
1555 message. Use the command \\[mh-mml-unsecure-message] to remove
1556 this tag. Use a prefix argument METHOD to be prompted for one of
1557 the possible security methods (see `mh-mml-method-default')."
1558 (interactive (list (mh-mml-query-cryptographic-method)))
1559 (mh-secure-message method "encrypt" mh-identity-pgg-default-user-id))
1561 ;;;###mh-autoload
1562 (defun mh-mml-secure-message-sign (method)
1563 "Add tag to sign the message.
1566 message. Use the command \\[mh-mml-unsecure-message] to remove
1567 this tag. Use a prefix argument METHOD to be prompted for one of
1568 the possible security methods (see `mh-mml-method-default')."
1569 (interactive (list (mh-mml-query-cryptographic-method)))
1570 (mh-secure-message method "sign" mh-identity-pgg-default-user-id))
1572 ;;;###mh-autoload
1573 (defun mh-mml-secure-message-signencrypt (method)
1574 "Add tag to encrypt and sign the message.
1577 message. Use the command \\[mh-mml-unsecure-message] to remove
1578 this tag. Use a prefix argument METHOD to be prompted for one of
1579 the possible security methods (see `mh-mml-method-default')."
1580 (interactive (list (mh-mml-query-cryptographic-method)))
1581 (mh-secure-message method "signencrypt" mh-identity-pgg-default-user-id))
1583 (defvar mh-mml-cryptographic-method-history ())
1585 (defun mh-mml-query-cryptographic-method ()
1588 (let ((def (or (car mh-mml-cryptographic-method-history)
1589 mh-mml-method-default)))
1592 nil t nil 'mh-mml-cryptographic-method-history def))
1593 mh-mml-method-default))
1595 (defun mh-secure-message (method mode &optional identity)
1596 "Add tag to encrypt or sign message.
1601 (if (not mh-pgp-support-flag)
1610 (mml-unsecure-message)
1614 (mh-goto-header-end 1)
1615 (if mh-identity-pgg-default-user-id
1616 (mml-insert-tag 'secure 'method method 'mode mode
1617 'sender mh-identity-pgg-default-user-id)
1618 (mml-insert-tag 'secure 'method method 'mode mode)))))))
1620 ;;;###mh-autoload
1621 (defun mh-mml-to-mime ()
1631 (when mh-pgp-support-flag ;; This is only needed for PGP
1636 (condition-case err (mml-to-mime)
1644 ;;;###mh-autoload
1645 (defun mh-mml-unsecure-message ()
1648 (if (not mh-pgp-support-flag)
1650 (mml-unsecure-message)))
1657 ;;;###mh-autoload
1658 (defun mh-mml-tag-present-p ()
1659 "Check if the current buffer has text which may be a MML tag."
1664 "\\(<#\\(mml\\|part\\)\\(.\\|\n\\)*>[ \n\t]*<#/\\(mml\\|part\\)>\\|"
1668 (defvar mh-media-type-regexp
1674 ;;;###mh-autoload
1675 (defun mh-mh-directive-present-p (&optional begin end)
1682 (block 'search-for-mh-directive
1686 (point) (mh-line-end-position))))
1689 (return-from 'search-for-mh-directive t))
1692 (string-match mh-media-type-regexp
1694 (return-from 'search-for-mh-directive t)))))))
1697 (defun mh-minibuffer-read-type (filename &optional default)
1707 (probed-type (mh-file-mime-type filename))
1717 ;;;###mh-autoload
1718 (defun mh-file-mime-type (filename)
1722 ((not (mh-have-file-command))
1729 (let ((tmp-buffer (get-buffer-create mh-temp-buffer)))
1736 (if (not (re-search-forward mh-media-type-regexp nil t))
1738 (mh-file-mime-type-substitute (match-string 0) filename)))
1741 (defvar mh-file-mime-type-substitutions
1763 (defun mh-file-mime-type-substitute (content-type filename)
1765 Substitutions are made from the `mh-file-mime-type-substitutions'
1767 (let ((subst mh-file-mime-type-substitutions)
1780 (defvar mh-have-file-command 'undefined
1781 "Cached value of function `mh-have-file-command'.
1783 initialized. Always use the command `mh-have-file-command'.")
1785 ;;;###mh-autoload
1786 (defun mh-have-file-command ()
1789 (when (eq mh-have-file-command 'undefined)
1790 (setq mh-have-file-command
1795 (expand-file-name "inc" mh-progs))))))
1796 mh-have-file-command)
1803 ;;;###mh-autoload
1804 (defun mh-mime-cleanup ()
1806 (let ((mime-data (gethash (current-buffer) mh-globals-hash)))
1808 (mh-funcall-if-exists remove-images (point-min) (point-max))
1810 (mh-mm-destroy-parts (mh-mime-handles mime-data))
1811 (remhash (current-buffer) mh-globals-hash))))
1813 ;;;###mh-autoload
1814 (defun mh-destroy-postponed-handles ()
1816 (let ((mime-data (mh-buffer-data)))
1818 (mh-mm-destroy-parts (mh-mime-handles mime-data)))
1819 (remhash (current-buffer) mh-globals-hash)))
1821 (provide 'mh-mime)
1828 ;; arch-tag: 0dd36518-1b64-4a84-8f4e-59f422d3f002
1829 ;;; mh-mime.el ends here