[25771] in SIPB bug reports
mutt ldap support
daemon@ATHENA.MIT.EDU (John Hawkinson)
Thu Aug 17 22:13:10 2006
From jhawk@MIT.EDU Fri Aug 18 02:13:10 2006
Return-Path: <jhawk@MIT.EDU>
Delivered-To: bug-sipb-mtg@CHARON.mit.edu
Received: (qmail 24220 invoked from network); 18 Aug 2006 02:13:10 -0000
Received: from biscayne-one-station.mit.edu (18.7.7.80)
by charon.mit.edu with SMTP; 18 Aug 2006 02:13:10 -0000
Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
by biscayne-one-station.mit.edu (8.13.6/8.9.2) with ESMTP id k7I2D8HN017942;
Thu, 17 Aug 2006 22:13:09 -0400 (EDT)
Received: from bart-savagewood.mit.edu (BART-SAVAGEWOOD.MIT.EDU [18.187.1.77])
(authenticated bits=56)
(User authenticated as jhawk@ATHENA.MIT.EDU)
by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id k7I2D1iM024502
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT);
Thu, 17 Aug 2006 22:13:01 -0400 (EDT)
Received: (from jhawk@localhost) by bart-savagewood.mit.edu (8.12.9.20060308)
id k7I2D00o026479; Thu, 17 Aug 2006 22:13:00 -0400 (EDT)
Date: Thu, 17 Aug 2006 22:13:00 -0400 (EDT)
Message-Id: <200608180213.k7I2D00o026479@bart-savagewood.mit.edu>
To: bug-sipb@MIT.EDU
Subject: mutt ldap support
From: John Hawkinson <jhawk@MIT.EDU>
X-Spam-Score: 1.217
X-Spam-Level: * (1.217)
X-Spam-Flag: NO
X-Scanned-By: MIMEDefang 2.42
Jake's email to consultdev about ldaps reminded me
about the support mutt has for external querying.
I hacked on mutt_ldap_query.pl from the mutt-contrib
area (/mit/sipb/src/mutt/mutt_ldap_query) so it talks to
LDAP.MIT.EDU and returns sane information, and insatlled
it in the sipb locker:
[bart-savagewood!jhawk] ~> mutt_ldap_query.pl jhawk gjs schiller
LDAP query: found 7
<jhawk@mit.edu> John A Hawkinson (617-797-0250) ELECTRICAL ENG & COMPUTER SCI
<gjs@mit.edu> Gerald J Sussman (617-253-5874) Dept of Electrical Engineering & Computer Science
<phschill@mit.edu> Peter H Schiller (617-253-5754) Department of Brain and Cognitive Sciences
<jis@mit.edu> Jeffrey I Schiller (617-253-0161) Information Services & Technology
<brads@mit.edu> Brad W Schiller (636-346-7112) MECHANICAL ENGINEERING
<mikes@mit.edu> Michael Schiller ()
<claro@mit.edu> David A Schiller ()
So now mutt does the right thing. With this addition to .muttrc:
set query_command = "mutt_ldap_query.pl '%s'"
Now pressing Q lets you query for things, and pressing ^T after
entering an email address expands the names, or lets you choose from
other addresses matching the search criteria (if non-unique). I'd
suggest adding it to the default .muttrc, since those commands
otherwise do nothing.
mutt's docs on this appended.
--jhawk
5. External Address Queries
Mutt supports connecting to external directory databases such as LDAP,
ph/qi, bbdb, or NIS through a wrapper script which connects to mutt
using a simple interface. Using the $query_command variable, you
specify the wrapper command to use. For example:
set query_command = "mutt_ldap_query.pl '%s'"
The wrapper script should accept the query on the command-line. It
should return a one line message, then each matching response on a
single line, each line containing a tab separated address then name
then some other optional information. On error, or if there are no
matching addresses, return a non-zero exit code and a one line error
message.
An example multiple response output:
Searching database ... 20 entries ... 3 matching:
me@cs.hmc.edu Michael Elkins mutt dude
blong@fiction.net Brandon Long mutt and more
roessler@guug.de Thomas Roessler mutt pgp
There are two mechanisms for accessing the query function of mutt. One
is to do a query from the index menu using the query function
(default: Q). This will prompt for a query, then bring up the query
menu which will list the matching responses. From the query menu, you
can select addresses to create aliases, or to mail. You can tag
multiple addresses to mail, start a new query, or have a new query
appended to the current responses.
The other mechanism for accessing the query function is for address
completion, similar to the alias completion. In any prompt for address
entry, you can use the complete-query function (default: ^T) to run a
query based on the current address you have typed. Like aliases, mutt
will look for what you have typed back to the last space or comma. If
there is a single response for that query, mutt will expand the
address in place. If there are multiple responses, mutt will activate
the query menu. At the query menu, you can select one or more
addresses to be added to the prompt.