From fbd2fd7fb70f50973a861aaaafdf04a31e48933c Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 21 Aug 2000 20:48:17 +0000 Subject: [PATCH] * mime-vcard.el: New module. * semi-setup.el: Remove `application/x-pkcs7-signature', `application/x-pkcs7-mime'. Set up for "text/x-vcard". (mime-setup-enable-vcard): New variable. --- mime-vcard.el | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ semi-setup.el | 31 ++++++++++++++++---------- 2 files changed, 88 insertions(+), 12 deletions(-) create mode 100644 mime-vcard.el diff --git a/mime-vcard.el b/mime-vcard.el new file mode 100644 index 0000000..135cf6b --- /dev/null +++ b/mime-vcard.el @@ -0,0 +1,69 @@ +;;; mime-vcard.el --- mime-view content filter for vCard. + +;; Copyright (C) 2000 Free Software Foundation, Inc. + +;; Author: Daiki Ueno +;; Keywords: vCard, MIME, multimedia, mail, news + +;; This file is part of SEMI (Sample of Elastic MIME Interfaces). + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + + +;;; Commentary: +;; + +;;; Code: + +(require 'vcard) + +(defvar mime-vcard-standard-filters + (cons #'mime-vcard-filter-quoted-printable + vcard-standard-filters)) + +(defun mime-vcard-filter-quoted-printable (key data) + (save-match-data + (when (string-match ";\\(encoding=\\)?quoted-printable$" key) + (while (string-match "\\(=[0-9A-F][0-9A-F]\\)+" data) + (setq data + (replace-match + (concat + (string-as-multibyte + (decode-coding-string + (mime-decode-string + (match-string 0 data) "quoted-printable") + 'raw-text-dos))) + t t data)))) + data)) + +(defun mime-display-text/x-vcard (entity situation) + (save-restriction + (narrow-to-region (point-max)(point-max)) + (let ((vcard-standard-filters mime-display-text/x-vcard-filters)) + (insert + (string-as-multibyte + (vcard-format-string + (vcard-parse-string + (mime-entity-content entity) + #'vcard-standard-filter))))) + (if (not (eq (char-after (1- (point))) ?\n)) + (insert "\n")) + (mime-add-url-buttons) + (run-hooks 'mime-display-text/x-vcard-hook))) + +(provide 'mime-vcard) + +;;; mime-vcard.el ends here diff --git a/semi-setup.el b/semi-setup.el index ecdf2ae..7efd3ab 100644 --- a/semi-setup.el +++ b/semi-setup.el @@ -71,6 +71,25 @@ it is used as hook to set." '(text . html) 3) ))) +;; for text/x-vcard +(defvar mime-setup-enable-vcard + (module-installed-p 'vcard) + "*If it is non-nil, semi-setup sets uf to use mime-vcard.") + +(if mime-setup-enable-vcard + (eval-after-load "mime-view" + '(progn + (autoload 'mime-display-text/x-vcard "mime-vcard") + + (mime-add-condition + 'preview + '((type . text)(subtype . x-vcard) + (body . visible) + (body-presentation-method . mime-display-text/x-vcard)) + 'strict) + + (set-alist 'mime-view-type-subtype-score-alist + '(text . x-vcard) 3)))) ;; for PGP (defvar mime-setup-enable-pgp t @@ -121,21 +140,9 @@ it is used as hook to set." (mime-add-condition 'action - '((type . application)(subtype . x-pkcs7-signature) - (method . mime-verify-application/pkcs7-signature)) - 'strict "mime-pgp") - - (mime-add-condition - 'action '((type . application)(subtype . pkcs7-mime) (method . mime-view-application/pkcs7-mime)) 'strict "mime-pgp") - - (mime-add-condition - 'action - '((type . application)(subtype . x-pkcs7-mime) - (method . mime-view-application/pkcs7-mime)) - 'strict "mime-pgp") )) ) -- 1.7.10.4