comparison lisp/vm/vm-digest.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents 859a2309aef8
children 441bb1e64a06
comparison
equal deleted inserted replaced
23:0edd3412f124 24:4103f0995bd7
414 ;; eat preceding newlines 414 ;; eat preceding newlines
415 (while (= (preceding-char) ?\n) 415 (while (= (preceding-char) ?\n)
416 (delete-char -1)) 416 (delete-char -1))
417 ;; put one back 417 ;; put one back
418 (insert ?\n))) 418 (insert ?\n)))
419 ;; insert a trailing message separator 419 ;; there should be at least one valid header at
420 ;; delete the digest separator 420 ;; the beginning of an encapsulated message. If
421 ;; insert the leading separator 421 ;; there isn't a valid header, then assume that
422 (if prev-sep 422 ;; the digest was packed improperly and that this
423 (progn 423 ;; isn't a real boundary.
424 (delete-region (match-beginning 0) (match-end 0)) 424 (if (not
425 (insert (vm-trailing-message-separator folder-type)))) 425 (save-excursion
426 (setq prev-sep (point)) 426 (save-match-data
427 (insert (vm-leading-message-separator folder-type)) 427 (skip-chars-forward "\n")
428 (setq after-prev-sep (point)) 428 (and (vm-match-header)
429 ;; eat trailing newlines 429 (or (vm-digest-get-header-contents "From")
430 (while (= (following-char) ?\n) 430 (not (re-search-forward separator-regexp
431 (delete-char 1)) 431 nil t)))))))
432 (insert ident-header) 432 (setq prev-sep (point)
433 after-prev-sep (point))
434 ;; insert a trailing message separator
435 ;; delete the digest separator
436 ;; insert the leading separator
437 (if prev-sep
438 (progn
439 (delete-region (match-beginning 0) (match-end 0))
440 (insert (vm-trailing-message-separator folder-type))))
441 (setq prev-sep (point))
442 (insert (vm-leading-message-separator folder-type))
443 (setq after-prev-sep (point))
444 ;; eat trailing newlines
445 (while (= (following-char) ?\n)
446 (delete-char 1))
447 (insert ident-header))
433 ;; try to match message separator and repeat. 448 ;; try to match message separator and repeat.
434 (setq match (re-search-forward separator-regexp nil t))) 449 (setq match (re-search-forward separator-regexp nil t)))
435 ;; from the last separator to eof is the digest epilogue. 450 ;; from the last separator to eof is the digest epilogue.
436 ;; discard it. 451 ;; discard it.
437 (delete-region (or prev-sep (point-min)) (point-max)) 452 (delete-region (or prev-sep (point-min)) (point-max))
593 (widen) 608 (widen)
594 (goto-char (vm-text-of m)) 609 (goto-char (vm-text-of m))
595 (cond ((search-forward "\n----------------------------------------------------------------------\n" (vm-text-end-of m) t) 610 (cond ((search-forward "\n----------------------------------------------------------------------\n" (vm-text-end-of m) t)
596 "rfc1153") 611 "rfc1153")
597 (t "rfc934")))))) 612 (t "rfc934"))))))
613
614 (defun vm-digest-get-header-contents (header-name-regexp)
615 (let ((contents nil)
616 regexp)
617 (setq regexp (concat "^\\(" header-name-regexp "\\)\\|\\(^$\\)"))
618 (save-excursion
619 (let ((case-fold-search t))
620 (if (and (re-search-forward regexp nil t)
621 (match-beginning 1)
622 (progn (goto-char (match-beginning 0))
623 (vm-match-header)))
624 (vm-matched-header-contents)
625 nil )))))