Gnus development mailing list
 help / color / mirror / Atom feed
* forgive me father, but...tm-vcard.el
@ 1998-08-07  3:48 Andrew J Cosgriff
       [not found] ` <ajc@bing.wattle.id.au>
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew J Cosgriff @ 1998-08-07  3:48 UTC (permalink / raw)
  Cc: Noah Friedman, MORIOKA Tomohiko

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]


I know vcards are evil and all, but since my Place of Employment is
going Netscape[1], i'm going to have to deal with vcards more and
more.  So I gave in and got TM to display vcards using Noah Friedman's
vcard.el library.

If anybody's got any good enhancements or wants to take it anywhere,
feel free - I'm not that good with Emacs-Lisp :)

I hope it's useful to other similarly afflicted people.

Enjoy,
 Andrew

[-- Attachment #2: tm-vcard.el --]
[-- Type: text/plain, Size: 3034 bytes --]

;;; tm-vcard --- allow TM (and hence Gnus, RMAIL, et al) to display a vcard MIME part
;;
;; Copyright (C) 1998 Andrew J Cosgriff
;;
;; Author: Andrew J Cosgriff <ajc@bing.wattle.id.au>
;; Created: Fri Aug  7 10:56:16 1998
;; Version: $Id: tm-vcard.el,v 1.5 1998/08/07 03:14:16 ajc Exp $
;; URI: http://bing.bofh.asn.au/sw/emacs-lisp/
;; Keywords: tm vcard gnus rmail mime
;;
;; 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 this program; if not, you can either send email to this
;; program's maintainer or write to: The Free Software Foundation,
;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; Noah Friedman wrote a generic bit of Emacs Lisp to parse VCard
;; data, saying "it'd be neat if somebody made this work with TM, so
;; Gnus and RMAIL can use it." - here goes...
;;
;; You'll need to get vcard.el from
;; http://www.splode.com/users/friedman/software/emacs-lisp/
;;
;; This code is available from http://bing.bofh.asn.au/sw/emacs-lisp/
;;
;;; TO DO:
;;
;; - buttonize things like email addresses and web pages (I think this
;;   is gnus-specific, so I'm not sure how it ought to be done)
;;
;; - BBDB ?
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; History:
;;
;; 1.1 - Initial version - show the vcard stuff in a separate buffer.
;;
;; 1.2 - show the vcard stuff in the same buffer.  much better !
;;
;; 1.3/1.4 - misc. fixes and prettying up for general release.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
;;
(require 'vcard)

(if (not (member "text/x-vcard" mime-viewer/default-showing-Content-Type-list))
    (setq mime-viewer/default-showing-Content-Type-list
	  (append mime-viewer/default-showing-Content-Type-list
		  '("text/x-vcard"))))

(if (not (member '("text/x-vcard" . mime-preview/filter-for-text/x-vcard) mime-viewer/content-filter-alist))
    (setq mime-viewer/content-filter-alist
	  (append '(("text/x-vcard" . mime-preview/filter-for-text/x-vcard))
		  mime-viewer/content-filter-alist)))


(defun mime-preview/filter-for-text/x-vcard (ctype params encoding)
  (let* ((mode mime::preview/original-major-mode)
	 (m (assq mode mime-viewer/code-converter-alist))
	 (charset (cdr (assoc "charset" params)))
	 (beg (point-min))
	 (str (buffer-substring beg (point-max)))
	 )
    (delete-region beg (point-max))
    (insert (vcard-format-string (vcard-parse-string str)))
    (mime-preview/decode-text-buffer charset encoding)
    ))

(provide 'tm-vcard)
;;; tm-vcard.el ends here

[-- Attachment #3: Type: text/plain, Size: 223 bytes --]


Footnotes: 
[1]  of course, with nnimap and all, I can still use Gnus. yay ! :)

-- 
Andrew J Cosgriff <ajc@bing.wattle.id.au> exterminate all rational thought !
                    space dogs celebrity compulsion brother

^ permalink raw reply	[flat|nested] 2+ messages in thread

* forgive me father, but...tm-vcard.el
       [not found] ` <ajc@bing.wattle.id.au>
@ 1998-08-14  2:59   ` Noah Friedman
  0 siblings, 0 replies; 2+ messages in thread
From: Noah Friedman @ 1998-08-14  2:59 UTC (permalink / raw)
  Cc: ding, morioka

>I know vcards are evil and all, but since my Place of Employment is
>going Netscape[1], i'm going to have to deal with vcards more and
>more.  So I gave in and got TM to display vcards using Noah Friedman's
>vcard.el library.

I don't think vcards are evil.  They make it much easier to parse and store
stuff in a database.  If you have to live a MIME world (which is not so
bad, really), vcards beat free-form signatures hands down.  (Disclaimer: I
work for Netscape.  Assume bias as you wish. :-))

Thanks for the code, too!  If you plan to publish your code somewhere on
the web, let me know and I'll add a link from my elisp software pages to
yours.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-08-14  2:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-07  3:48 forgive me father, but...tm-vcard.el Andrew J Cosgriff
     [not found] ` <ajc@bing.wattle.id.au>
1998-08-14  2:59   ` Noah Friedman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).