MH & nmh: Email for Users & Programmers

May, 2006

Faces
by Brent Welch

One of the more fun features of exmh is its ability to display the facesaver bitmap of the person that sent you mail. There are two sources of the bitmap images: the facesaver database or inline X-Face: mail header fields. These two sources can be used independently, but the main trick is getting exmh configured properly to use them.

Facesaver Database

The exmh installer asks for two pieces of facesaver-related information: the root directory of your faces installation and a search path of faces directories. This assumes that you have retrieved the faces software and associated databases and installed them under one directory, which is referred to as its root directory. The default is /usr/local/faces. Underneath this directory there should be one or more directories that contain facesaver databases. These directories are named in the search path; the names are relative to the root of the faces installation. Typically there are facesaver, logos -- and a local database, which is called parc at my site. The first two databases come from the facesaver.tar.Z and logos.tar.Z files, respectively. The default values are:

Faces Root Directory: /usr/local/faces
Faces Search Path: parc logos news facesaver

If you are setting up your own database, you need to understand how the database is organized. It is easiest to demonstrate by example. For myself, welch@parc.xerox.com, my facesaver image is found as com/xerox/parc/welch/face.xbm. exmh looks for this file under each of the directories named by the faces search path. The complete pathname might be /usr/local/faces/parc/com/xerox/parc/welch/face.xbm. If a bitmap is not found, then the search algorithm trims off trailing components in an effort to find a more general bitmap, typically a company or organizational logo. At your site, for example, you might only have /usr/local/faces/logos/com/xerox/face.xbm, which contains the Xerox corporate logo.

If your exmh installation is not correct, or if you have a personal faces database that the exmh maintainer doesn't know about, then you can also override the install-time settings with the FACEPATH environment variable. This is a more traditional search path of colon-separated directory names. For example, you could override the search path with this value of FACEPATH:

    /usr/mary/faces:/usr/local/faces/facesaver:/usr/local/faces/logos
    

X-Face Header Fields

The X-Face: header field contains a compressed version of a facesaver bitmap, which is a 48x48x1 (monochrome) bitmap. The faces software comes with some filters and scripts to generate these and decompress them. The X-Face: field was designed as a way of distributing your facesaver image so that folks can update their databases. However, at the moment, exmh just decompresses the bitmap and displays it. It requires a Preference setting for the X-Face pipeline for this to work. If the pipeline is blank (the default), no processing is done. To decompress and display the field, use a pipeline setting like this:

    uncompface | ikon2xbm
    
To create an X-Face: header field, use:
    xbm2ikon myface.xbm | compface
    
The uncompface program comes with the faces software. It also has a version of ikon2xbm, but a faster version of this program (a C program instead of some scripts) is distributed with exmh in its misc directory. Future versions of exmh will cache the results of decompressing the X-Face: line in a personal faces database, but in the current version it just writes to the file /tmp/FACES.pid. If you are inspired you could add a Hook_MsgDisplay (Section Programming exmh) to stash this file into a real facesaver database.