• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/gnus/

Lines Matching +defs:mm +defs:uu +defs:dissect +defs:text +defs:parts

0 ;;; mm-uu.el --- Return uu stuff as mm handles
33 (require 'mm-decode)
48 (defcustom mm-uu-decode-function 'uudecode-decode-region
59 (defcustom mm-uu-binhex-decode-function 'binhex-decode-region
69 (defvar mm-uu-yenc-decode-function 'yenc-decode-region)
71 (defvar mm-uu-pgp-beginning-signature
74 (defvar mm-uu-beginning-regexp nil)
76 (defvar mm-dissect-disposition "inline"
77 "The default disposition of uu parts.
80 (defcustom mm-uu-emacs-sources-regexp "\\.emacs\\.sources"
86 (defcustom mm-uu-diff-groups-regexp
93 (defvar mm-uu-type-alist
97 mm-uu-postscript-extract
99 (uu
102 mm-uu-uu-extract
103 mm-uu-uu-filename)
107 mm-uu-binhex-extract
109 mm-uu-binhex-filename)
113 mm-uu-yenc-extract
114 mm-uu-yenc-filename)
118 mm-uu-shar-extract)
124 mm-uu-forward-extract
126 mm-uu-forward-test)
130 mm-uu-gnatsweb-extract)
134 mm-uu-pgp-signed-extract
140 mm-uu-pgp-encrypted-extract
146 mm-uu-pgp-key-extract
147 mm-uu-gpg-key-skip-to-last
152 mm-uu-emacs-sources-extract
154 mm-uu-emacs-sources-test)
158 mm-uu-diff-extract
160 mm-uu-diff-test))
165 After modifying this list you must run \\[mm-uu-configure].")
167 (defcustom mm-uu-configure-list '((shar . disabled))
168 "A list of mm-uu configuration.
174 mm-uu-type-alist)
177 (defvar mm-uu-text-plain-type '("text/plain" (charset . gnus-decoded))
178 "MIME type and parameters for text/plain parts.
183 (defsubst mm-uu-type (entry)
186 (defsubst mm-uu-beginning-regexp (entry)
189 (defsubst mm-uu-end-regexp (entry)
192 (defsubst mm-uu-function-extract (entry)
195 (defsubst mm-uu-function-1 (entry)
198 (defsubst mm-uu-function-2 (entry)
201 (defun mm-uu-copy-to-buffer (&optional from to)
209 (with-current-buffer (generate-new-buffer " *mm-uu*")
214 (defun mm-uu-configure-p (key val)
215 (member (cons key val) mm-uu-configure-list))
217 (defun mm-uu-configure (&optional symbol value)
221 (setq mm-uu-beginning-regexp nil)
223 (if (mm-uu-configure-p (mm-uu-type entry) 'disabled)
225 (setq mm-uu-beginning-regexp
226 (concat mm-uu-beginning-regexp
227 (if mm-uu-beginning-regexp "\\|")
228 (mm-uu-beginning-regexp entry)))))
229 mm-uu-type-alist))
231 (mm-uu-configure)
239 (defun mm-uu-uu-filename ()
246 (defun mm-uu-binhex-filename ()
251 (defun mm-uu-yenc-filename ()
257 (defun mm-uu-forward-test ()
263 (defun mm-uu-postscript-extract ()
264 (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
267 (defun mm-uu-emacs-sources-extract ()
268 (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
271 (list mm-dissect-disposition
277 (defun mm-uu-emacs-sources-test ()
280 mm-uu-emacs-sources-regexp
281 (string-match mm-uu-emacs-sources-regexp gnus-newsgroup-name)))
283 (defun mm-uu-diff-extract ()
284 (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
285 '("text/x-patch" (charset . gnus-decoded))))
287 (defun mm-uu-diff-test ()
289 mm-uu-diff-groups-regexp
290 (string-match mm-uu-diff-groups-regexp gnus-newsgroup-name)))
292 (defun mm-uu-forward-extract ()
293 (mm-make-handle (mm-uu-copy-to-buffer
298 (defun mm-uu-uu-extract ()
299 (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
308 (list mm-dissect-disposition
311 (defun mm-uu-binhex-extract ()
312 (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
320 (list mm-dissect-disposition
323 (defun mm-uu-yenc-extract ()
324 (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
332 (list mm-dissect-disposition
336 (defun mm-uu-shar-extract ()
337 (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
340 (defun mm-uu-gnatsweb-extract ()
345 (mm-dissect-buffer t)))
347 (defun mm-uu-pgp-signed-test (&rest rest)
352 ((eq mm-verify-option 'never) nil)
353 ((eq mm-verify-option 'always) t)
354 ((eq mm-verify-option 'known) t)
362 (defun mm-uu-pgp-signed-extract-1 (handles ctl)
363 (let ((buf (mm-uu-copy-to-buffer (point-min) (point-max))))
365 (if (mm-uu-pgp-signed-test)
372 (mm-set-handle-multipart-parameter
373 mm-security-handle 'gnus-details
378 ;; Previously, an attacker could replace the text inside our
386 (if (re-search-forward mm-uu-pgp-beginning-signature nil t)
392 (list (mm-make-handle buf mm-uu-text-plain-type))))
394 (defun mm-uu-pgp-signed-extract ()
395 (let ((mm-security-handle (list (format "multipart/signed"))))
396 (mm-set-handle-multipart-parameter
397 mm-security-handle 'protocol "application/x-gnus-pgp-signature")
400 (add-text-properties 0 (length (car mm-security-handle))
401 (list 'buffer (mm-uu-copy-to-buffer))
402 (car mm-security-handle))
403 (setcdr mm-security-handle
404 (mm-uu-pgp-signed-extract-1 nil
405 mm-security-handle)))
406 mm-security-handle))
408 (defun mm-uu-pgp-encrypted-test (&rest rest)
413 ((eq mm-decrypt-option 'never) nil)
414 ((eq mm-decrypt-option 'always) t)
415 ((eq mm-decrypt-option 'known) t)
420 (defun mm-uu-pgp-encrypted-extract-1 (handles ctl)
421 (let ((buf (mm-uu-copy-to-buffer (point-min) (point-max)))
438 (if (and (mm-uu-pgp-encrypted-test)
442 (equal (mm-handle-multipart-ctl-parameter mm-security-handle
449 (setq charset (mm-charset-to-coding-system charset))
453 (insert (mm-decode-coding-string (prog1
456 (mm-enable-multibyte))
458 (mm-enable-multibyte))
459 (list (mm-make-handle buf mm-uu-text-plain-type)))
460 (list (mm-make-handle buf '("application/pgp-encrypted")))))))
462 (defun mm-uu-pgp-encrypted-extract ()
463 (let ((mm-security-handle (list (format "multipart/encrypted"))))
464 (mm-set-handle-multipart-parameter
465 mm-security-handle 'protocol "application/x-gnus-pgp-encrypted")
468 (add-text-properties 0 (length (car mm-security-handle))
469 (list 'buffer (mm-uu-copy-to-buffer))
470 (car mm-security-handle))
471 (setcdr mm-security-handle
472 (mm-uu-pgp-encrypted-extract-1 nil
473 mm-security-handle)))
474 mm-security-handle))
476 (defun mm-uu-gpg-key-skip-to-last ()
478 (end-regexp (mm-uu-end-regexp entry))
479 (beginning-regexp (mm-uu-beginning-regexp entry)))
481 (not (mm-uu-configure-p (mm-uu-type entry) 'disabled)))
488 (defun mm-uu-pgp-key-extract ()
489 (let ((buf (mm-uu-copy-to-buffer start-point end-point)))
490 (mm-make-handle buf
494 (defun mm-uu-dissect (&optional noheader mime-type)
495 "Dissect the current buffer and return a list of uu handles.
498 value of `mm-uu-text-plain-type'."
500 (mm-uu-text-plain-type (or mime-type mm-uu-text-plain-type))
501 text-start start-point end-point file-name result entry func)
511 (setq text-start (point))
512 (while (re-search-forward mm-uu-beginning-regexp nil t)
515 (let ((alist mm-uu-type-alist)
518 (if (string-match (mm-uu-beginning-regexp (car alist))
522 (if (setq func (mm-uu-function-1 entry))
525 (when (and (not (mm-uu-configure-p (mm-uu-type entry) 'disabled))
526 (let ((end-regexp (mm-uu-end-regexp entry)))
533 (or (not (setq func (mm-uu-function-2 entry)))
535 (if (and (> start-point text-start)
537 (goto-char text-start)
540 (mm-make-handle (mm-uu-copy-to-buffer text-start start-point)
541 mm-uu-text-plain-type)
544 (funcall (mm-uu-function-extract entry))
546 (goto-char (setq text-start end-point))))
548 (if (and (> (point-max) (1+ text-start))
550 (goto-char text-start)
553 (mm-make-handle (mm-uu-copy-to-buffer text-start (point-max))
554 mm-uu-text-plain-type)
560 (defun mm-uu-dissect-text-parts (handle &optional decoded)
561 "Dissect text parts and put uu handles into HANDLE.
562 Assume text has been decoded if DECODED is non-nil."
563 (let ((buffer (mm-handle-buffer handle)))
566 (mm-uu-dissect-text-parts elem decoded)))
568 (let ((type (mm-handle-media-type handle))
575 (string-match "\\`text/\\|\\`application/pgp\\'" type)
582 (mm-handle-type handle)
586 (mm-uu-dissect
590 (mm-with-multibyte-buffer
591 (insert (mm-decode-string (mm-get-part handle)
593 (mm-uu-dissect
595 ((setq encoding (mm-handle-encoding handle))
600 (mm-decode-content-transfer-encoding
602 (mm-uu-dissect t (list type))))
605 (mm-uu-dissect t (list type)))))))
609 (string-equal (mm-handle-media-type (cadr children))
611 (kill-buffer (mm-handle-buffer (cadr children)))
616 (mm-uu-dissect-text-parts elem decoded))))))
619 (mm-uu-dissect-text-parts elem decoded))))))
621 (provide 'mm-uu)
624 ;;; mm-uu.el ends here