mirror of https://github.com/djcb/mu.git
* add support for using mu cfind as an external address book for 'mutt' + document
This commit is contained in:
parent
66a839a742
commit
f8fd420215
|
@ -51,14 +51,15 @@ The regular expressions are Perl-compatible (as per the PCRE-library).
|
||||||
set the output format to the given value. The following are available:
|
set the output format to the given value. The following are available:
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
| --format= | description |
|
| --format= | description |
|
||||||
|-------------+-------------------------------|
|
|-------------+-----------------------------------|
|
||||||
| plain | default, simple list |
|
| plain | default, simple list |
|
||||||
| mutt | mutt alias-format |
|
| mutt-alias | mutt alias-format |
|
||||||
| wl | wanderlust addressbook format |
|
| mutt-ab | mutt external address book format |
|
||||||
| org-contact | org-mode org-contact format |
|
| wl | wanderlust addressbook format |
|
||||||
| bbdb | BBDB format |
|
| org-contact | org-mode org-contact format |
|
||||||
| csv | comma-separated values |
|
| bbdb | BBDB format |
|
||||||
|
| csv | comma-separated values |
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
@ -75,6 +76,19 @@ non-zero return value, for example:
|
||||||
| 2 | no matches (for 'mu cfind') |
|
| 2 | no matches (for 'mu cfind') |
|
||||||
.si
|
.si
|
||||||
|
|
||||||
|
.SH INTEGRATION WITH MUTT
|
||||||
|
|
||||||
|
You can use \fBmu cfind\fR as an external address book server for
|
||||||
|
\fBmutt\fR. For this to work add the following to your \fImuttrc\fR:
|
||||||
|
|
||||||
|
.sh
|
||||||
|
set query_command = "mu cfind --format=mutt-ab '%s'"
|
||||||
|
.si
|
||||||
|
|
||||||
|
Now, in mutt, you can easily search for e-mail address using the
|
||||||
|
\fBquery\fR-command, which is by default accessible by pressing \fBQ\fR.
|
||||||
|
|
||||||
|
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
|
|
||||||
Please report bugs if you find them:
|
Please report bugs if you find them:
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
|
|
||||||
enum _OutputFormat {
|
enum _OutputFormat {
|
||||||
FORMAT_PLAIN,
|
FORMAT_PLAIN,
|
||||||
FORMAT_MUTT,
|
FORMAT_MUTT_ALIAS,
|
||||||
|
FORMAT_MUTT_AB, /* mutt external address book */
|
||||||
FORMAT_WL,
|
FORMAT_WL,
|
||||||
FORMAT_BBDB,
|
FORMAT_BBDB,
|
||||||
FORMAT_CSV,
|
FORMAT_CSV,
|
||||||
|
@ -50,7 +51,8 @@ get_output_format (const char *formatstr)
|
||||||
OutputFormat format;
|
OutputFormat format;
|
||||||
} formats [] = {
|
} formats [] = {
|
||||||
{MU_CONFIG_FORMAT_PLAIN, FORMAT_PLAIN},
|
{MU_CONFIG_FORMAT_PLAIN, FORMAT_PLAIN},
|
||||||
{MU_CONFIG_FORMAT_MUTT, FORMAT_MUTT},
|
{MU_CONFIG_FORMAT_MUTT_ALIAS, FORMAT_MUTT_ALIAS},
|
||||||
|
{MU_CONFIG_FORMAT_MUTT_AB, FORMAT_MUTT_AB},
|
||||||
{MU_CONFIG_FORMAT_WL, FORMAT_WL},
|
{MU_CONFIG_FORMAT_WL, FORMAT_WL},
|
||||||
{MU_CONFIG_FORMAT_BBDB, FORMAT_BBDB},
|
{MU_CONFIG_FORMAT_BBDB, FORMAT_BBDB},
|
||||||
{MU_CONFIG_FORMAT_CSV, FORMAT_CSV},
|
{MU_CONFIG_FORMAT_CSV, FORMAT_CSV},
|
||||||
|
@ -101,7 +103,7 @@ each_contact_bbdb (const char *email, const char *name, time_t tstamp)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
each_contact_mutt (const char *email, const char *name)
|
each_contact_mutt_alias (const char *email, const char *name)
|
||||||
{
|
{
|
||||||
if (name) {
|
if (name) {
|
||||||
gchar *nick;
|
gchar *nick;
|
||||||
|
@ -114,6 +116,7 @@ each_contact_mutt (const char *email, const char *name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
each_contact_wl (const char *email, const char *name)
|
each_contact_wl (const char *email, const char *name)
|
||||||
{
|
{
|
||||||
|
@ -141,12 +144,15 @@ each_contact (const char *email, const char *name, time_t tstamp,
|
||||||
OutputFormat format)
|
OutputFormat format)
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case FORMAT_MUTT: each_contact_mutt (email, name); break;
|
case FORMAT_MUTT_ALIAS: each_contact_mutt_alias (email, name); break;
|
||||||
|
case FORMAT_MUTT_AB:
|
||||||
|
g_print ("%s\t%s\t\n", email, name ? name : ""); break;
|
||||||
case FORMAT_WL: each_contact_wl (email, name); break;
|
case FORMAT_WL: each_contact_wl (email, name); break;
|
||||||
case FORMAT_ORG_CONTACT: each_contact_org_contact (email, name); break;
|
case FORMAT_ORG_CONTACT: each_contact_org_contact (email, name); break;
|
||||||
case FORMAT_BBDB: each_contact_bbdb (email, name, tstamp); break;
|
case FORMAT_BBDB: each_contact_bbdb (email, name, tstamp); break;
|
||||||
|
|
||||||
case FORMAT_CSV: /* FIXME */
|
case FORMAT_CSV:
|
||||||
|
g_print ("%s,%s\n", name ? name : "", email);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_print ("%s%s%s\n", name ? name : "", name ? " " : "", email);
|
g_print ("%s%s%s\n", name ? name : "", name ? " " : "", email);
|
||||||
|
|
|
@ -35,7 +35,8 @@ G_BEGIN_DECLS
|
||||||
#define MU_CONFIG_FORMAT_XQUERY "xquery" /* output the xapian query */
|
#define MU_CONFIG_FORMAT_XQUERY "xquery" /* output the xapian query */
|
||||||
|
|
||||||
/* for cfind */
|
/* for cfind */
|
||||||
#define MU_CONFIG_FORMAT_MUTT "mutt" /* mutt alias style */
|
#define MU_CONFIG_FORMAT_MUTT_ALIAS "mutt-alias" /* mutt alias style */
|
||||||
|
#define MU_CONFIG_FORMAT_MUTT_AB "mutt-ab" /* mutt ext addr book */
|
||||||
#define MU_CONFIG_FORMAT_WL "wl" /* Wanderlust address-book */
|
#define MU_CONFIG_FORMAT_WL "wl" /* Wanderlust address-book */
|
||||||
#define MU_CONFIG_FORMAT_CSV "csv" /* comma-sep'd values */
|
#define MU_CONFIG_FORMAT_CSV "csv" /* comma-sep'd values */
|
||||||
#define MU_CONFIG_FORMAT_ORG_CONTACT "org-contact" /* org-contact */
|
#define MU_CONFIG_FORMAT_ORG_CONTACT "org-contact" /* org-contact */
|
||||||
|
|
Loading…
Reference in New Issue