Sync up witch `semi-vcard' branch.
authorkeiichi <keiichi>
Tue, 10 Nov 1998 07:33:57 +0000 (07:33 +0000)
committerkeiichi <keiichi>
Tue, 10 Nov 1998 07:33:57 +0000 (07:33 +0000)
(mime-display-text/x-vcard): Preserve encoding.
(mime-display-text/x-vcard): New function.
(mime-preview-condition): Set up for 'mime-preview-text/x-vcard.

mime-view.el

index 2804365..837942d 100644 (file)
@@ -390,6 +390,12 @@ Each elements are regexp of field-name.")
 
 (ctree-set-calist-strictly
  'mime-preview-condition
+ '((type . text)(subtype . x-vcard)
+   (body . visible)
+   (body-presentation-method . mime-display-text/x-vcard)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition
  '((type . text)(subtype . t)
    (body . visible)
    (body-presentation-method . mime-display-text/plain)))
@@ -454,6 +460,32 @@ Each elements are regexp of field-name.")
       (enriched-decode beg (point-max))
       )))
 
+(defun mime-display-text/x-vcard (entity situation)
+  (save-restriction
+    (narrow-to-region (point-max)(point-max))
+    (mime-insert-text-content entity)
+    (run-hooks 'mime-text-decode-hook)
+    (goto-char (point-min))
+    (while (re-search-forward
+            "\\(;\\(encoding=\\)?quoted-printable:\\)\\(\\(=[0-9A-F][0-9A-F]\\|=\r\n\\|[^\r\n]\\)*\\)"
+            nil t)
+      (replace-match
+       (concat
+        (buffer-substring (match-beginning 1) (match-end 1))
+        (string-as-multibyte
+         (mime-decode-string
+          (decode-coding-string
+           (buffer-substring (match-beginning 3) (match-end 3)) 'raw-text-dos)
+          "quoted-printable")))
+       t t))
+    (decode-coding-region (point-min) (point-max) 'undecided)
+    (goto-char (point-max))
+    (if (not (eq (char-after (1- (point))) ?\n))
+        (insert "\n"))
+    (mime-add-url-buttons)
+    (run-hooks 'mime-display-text/x-vcard-hook)
+    ))
+
 (defvar mime-view-announcement-for-message/partial
   (if (and (>= emacs-major-version 19) window-system)
       "\