update cfind, server for new contacts-cache

Use the new APIs.
This commit is contained in:
djcb 2019-04-28 13:58:34 +03:00
parent 8193cc3e4c
commit e9a0939f8f
7 changed files with 1266 additions and 1262 deletions

View File

@ -1,4 +1,4 @@
.TH MU CFIND 1 "May 2013" "User Manuals"
.TH MU CFIND 1 "April 2019" "User Manuals"
.SH NAME
@ -38,10 +38,9 @@ would find all contacts with a gmail-address, while
lists all contacts with Mary in either name or e-mail address.
If you do not specify a search expression, \fBmu cfind\fR returns the full
list of contacts. Note, \fBmu cfind\fR does not use the
database, but uses a cache file with e-mail addresses, which is populated
during the indexing process.
If you do not specify a search expression, \fBmu cfind\fR returns the full list
of contacts. Note, \fBmu cfind\fR uses a cache with the e-mail information,
which is populated during the indexing process.
The regular expressions are Perl-compatible (as per the PCRE-library used by
GRegex).
@ -65,25 +64,24 @@ sets the output format to the given value. The following are available:
.fi
(*) CSV is not really standardized, but \fBmu cfind\fR follows some common
practices: any double-quote is replaced by a double-double quote (thus,
"hello" become ""hello"", and fields with commas are put in
double-quotes. Normally, this should only apply to name fields.
(*) CSV is not fully standardized, but \fBmu cfind\fR follows some common
practices: any double-quote is replaced by a double-double quote (thus, "hello"
become ""hello"", and fields with commas are put in double-quotes. Normally,
this should only apply to name fields.
.TP
\fB\-\-personal\fR only show addresses seen in messages where one of 'my'
e-mail addresses was seen in one of the address fields; this is to exclude
addresses only seen in mailing-list messages. See the \fB\-\-my-address\fR
parameter in \fBmu index\fR.
\fB\-\-personal\fR only show addresses seen in messages where one of 'my' e-mail
addresses was seen in one of the address fields; this is to exclude addresses
only seen in mailing-list messages. See the \fB\-\-my-address\fR parameter in
\fBmu index\fR.
.TP
\fB\-\-after=\fR\fI<timestamp>\fR only show addresses last seen after
\fI<timestamp>\fR. \fI<timestamp>\fR is a UNIX \fBtime_t\fR value, the number
of seconds since 1970-01-01 (in UTC).
\fI<timestamp>\fR. \fI<timestamp>\fR is a UNIX \fBtime_t\fR value, the number of
seconds since 1970-01-01 (in UTC).
From the command line, you can use the \fBdate\fR command to get this
value. For example, only consider addresses last seen after 2009-06-01, you
could specify
From the command line, you can use the \fBdate\fR command to get this value. For
example, only consider addresses last seen after 2009-06-01, you could specify
.nf
--after=`date +%s --date='2009-06-01'`
.fi
@ -103,15 +101,15 @@ contact was found. Anything else leads to a non-zero return value:
.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:
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:
.nf
set query_command = "mu cfind --format=mutt-ab '%s'"
.fi
Now, in mutt, you can easily search for e-mail addresses using the
\fBquery\fR-command, which is (by default) accessible by pressing \fBQ\fR.
Now, in mutt, you can search for e-mail addresses using the \fBquery\fR-command,
which is (by default) accessible by pressing \fBQ\fR.
.SH ENCODING
@ -121,8 +119,7 @@ output-file, so emacs/bbdb can handle things correctly, without guessing.
.SH BUGS
Please report bugs if you find them at
\fBhttps://github.com/djcb/mu/issues\fR.
Please report bugs if you find them at \fBhttps://github.com/djcb/mu/issues\fR.
.SH AUTHOR

View File

@ -1,25 +1,22 @@
/*
** Copyright (C) 2011-2016 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** Copyright (C) 2011-2019 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** 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 3, or (at your option) any
** later version.
** 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 3, 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.
** 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, write to the Free Software Foundation,
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
** You should have received a copy of the GNU General Public License along with
** this program; if not, write to the Free Software Foundation, Inc., 51
** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif /*HAVE_CONFIG_H*/
#include <stdlib.h>
#include <stdio.h>
@ -45,14 +42,14 @@
static gchar*
guess_last_name (const char *name)
{
const gchar *lastsp;
const gchar *lastsp;
if (!name)
return g_strdup ("");
if (!name)
return g_strdup ("");
lastsp = g_strrstr (name, " ");
lastsp = g_strrstr (name, " ");
return g_strdup (lastsp ? lastsp + 1 : "");
return g_strdup (lastsp ? lastsp + 1 : "");
}
/**
@ -67,17 +64,17 @@ guess_last_name (const char *name)
static gchar*
guess_first_name (const char *name)
{
const gchar *lastsp;
const gchar *lastsp;
if (!name)
return g_strdup ("");
if (!name)
return g_strdup ("");
lastsp = g_strrstr (name, " ");
lastsp = g_strrstr (name, " ");
if (lastsp)
return g_strndup (name, lastsp - name);
else
return g_strdup (name);
if (lastsp)
return g_strndup (name, lastsp - name);
else
return g_strdup (name);
}
/**
@ -93,87 +90,87 @@ guess_first_name (const char *name)
static gchar*
cleanup_str (const char* str)
{
gchar *s;
const gchar *cur;
unsigned i;
gchar *s;
const gchar *cur;
unsigned i;
if (mu_str_is_empty(str))
return g_strdup ("");
if (mu_str_is_empty(str))
return g_strdup ("");
s = g_new0 (char, strlen(str) + 1);
s = g_new0 (char, strlen(str) + 1);
for (cur = str, i = 0; *cur; ++cur) {
if (ispunct(*cur) || isspace(*cur))
continue;
else
s[i++] = *cur;
}
for (cur = str, i = 0; *cur; ++cur) {
if (ispunct(*cur) || isspace(*cur))
continue;
else
s[i++] = *cur;
}
return s;
return s;
}
static char*
uniquify_nick (const char *nick, GHashTable *nicks)
{
guint u;
guint u;
for (u = 2; u != 1000; ++u) {
char *cand;
cand = g_strdup_printf ("%s%u", nick, u);
if (!g_hash_table_contains (nicks, cand))
return cand;
}
for (u = 2; u != 1000; ++u) {
char *cand;
cand = g_strdup_printf ("%s%u", nick, u);
if (!g_hash_table_contains (nicks, cand))
return cand;
}
return g_strdup (nick); /* if all else fails */
return g_strdup (nick); /* if all else fails */
}
static gchar*
guess_nick (const char* name, GHashTable *nicks)
{
gchar *fname, *lname, *nick;
gchar initial[7];
gchar *fname, *lname, *nick;
gchar initial[7];
fname = guess_first_name (name);
lname = guess_last_name (name);
fname = guess_first_name (name);
lname = guess_last_name (name);
/* if there's no last name, use first name as the nick */
if (mu_str_is_empty(fname) || mu_str_is_empty(lname)) {
g_free (lname);
nick = fname;
goto leave;
}
/* if there's no last name, use first name as the nick */
if (mu_str_is_empty(fname) || mu_str_is_empty(lname)) {
g_free (lname);
nick = fname;
goto leave;
}
memset (initial, 0, sizeof(initial));
/* couldn't we get an initial for the last name? */
if (g_unichar_to_utf8 (g_utf8_get_char (lname), initial) == 0) {
g_free (lname);
nick = fname;
goto leave;
}
memset (initial, 0, sizeof(initial));
/* couldn't we get an initial for the last name? */
if (g_unichar_to_utf8 (g_utf8_get_char (lname), initial) == 0) {
g_free (lname);
nick = fname;
goto leave;
}
nick = g_strdup_printf ("%s%s", fname, initial);
g_free (fname);
g_free (lname);
nick = g_strdup_printf ("%s%s", fname, initial);
g_free (fname);
g_free (lname);
leave:
{
gchar *tmp;
tmp = cleanup_str (nick);
g_free (nick);
nick = tmp;
}
{
gchar *tmp;
tmp = cleanup_str (nick);
g_free (nick);
nick = tmp;
}
if (g_hash_table_contains (nicks, nick)) {
char *tmp;
tmp = uniquify_nick (nick, nicks);
g_free (nick);
nick = tmp;
}
if (g_hash_table_contains (nicks, nick)) {
char *tmp;
tmp = uniquify_nick (nick, nicks);
g_free (nick);
nick = tmp;
}
g_hash_table_add (nicks, g_strdup(nick));
g_hash_table_add (nicks, g_strdup(nick));
return nick;
return nick;
}
@ -181,53 +178,54 @@ leave:
static void
print_header (MuConfigFormat format)
{
switch (format) {
case MU_CONFIG_FORMAT_BBDB:
g_print (";; -*-coding: utf-8-emacs;-*-\n"
";;; file-version: 6\n");
break;
case MU_CONFIG_FORMAT_MUTT_AB:
g_print ("Matching addresses in the mu database:\n");
break;
default:
break;
}
switch (format) {
case MU_CONFIG_FORMAT_BBDB:
g_print (";; -*-coding: utf-8-emacs;-*-\n"
";;; file-version: 6\n");
break;
case MU_CONFIG_FORMAT_MUTT_AB:
g_print ("Matching addresses in the mu database:\n");
break;
default:
break;
}
}
static void
each_contact_bbdb (const char *email, const char *name, time_t tstamp)
{
char *fname, *lname, *now, *timestamp;
char *fname, *lname, *now, *timestamp;
fname = guess_first_name (name);
lname = guess_last_name (name);
now = mu_date_str ("%Y-%m-%d", time(NULL));
timestamp = mu_date_str ("%Y-%m-%d", tstamp);
fname = guess_first_name (name);
lname = guess_last_name (name);
now = mu_date_str ("%Y-%m-%d", time(NULL));
timestamp = mu_date_str ("%Y-%m-%d", tstamp);
g_print ("[\"%s\" \"%s\" nil nil nil nil (\"%s\") "
"((creation-date . \"%s\") (time-stamp . \"%s\")) nil]\n",
fname, lname, email, now, timestamp);
g_print ("[\"%s\" \"%s\" nil nil nil nil (\"%s\") "
"((creation-date . \"%s\") (time-stamp . \"%s\")) nil]\n",
fname, lname, email, now, timestamp);
g_free (now);
g_free (timestamp);
g_free (fname);
g_free (lname);
g_free (now);
g_free (timestamp);
g_free (fname);
g_free (lname);
}
static void
each_contact_mutt_alias (const char *email, const char *name,
GHashTable *nicks)
GHashTable *nicks)
{
gchar *nick;
if (!name)
return;
gchar *nick;
nick = guess_nick (name, nicks);
mu_util_print_encoded ("alias %s %s <%s>\n",
nick, name, email);
g_free (nick);
if (!name)
return;
nick = guess_nick (name, nicks);
mu_util_print_encoded ("alias %s %s <%s>\n",
nick, name, email);
g_free (nick);
}
@ -235,52 +233,52 @@ each_contact_mutt_alias (const char *email, const char *name,
static void
each_contact_wl (const char *email, const char *name, GHashTable *nicks)
{
gchar *nick;
gchar *nick;
if (!name)
return;
if (!name)
return;
nick = guess_nick (name, nicks);
mu_util_print_encoded ("%s \"%s\" \"%s\"\n",
email, nick, name);
g_free (nick);
nick = guess_nick (name, nicks);
mu_util_print_encoded ("%s \"%s\" \"%s\"\n",
email, nick, name);
g_free (nick);
}
static void
each_contact_org_contact (const char *email, const char *name)
{
if (name)
mu_util_print_encoded (
"* %s\n:PROPERTIES:\n:EMAIL: %s\n:END:\n\n",
name, email);
if (name)
mu_util_print_encoded (
"* %s\n:PROPERTIES:\n:EMAIL: %s\n:END:\n\n",
name, email);
}
static void
print_csv_field (const char *str)
{
char *s;
char *s;
if (!str)
return;
if (!str)
return;
s = mu_str_replace (str, "\"", "\"\"");
if (strchr (s, ','))
mu_util_print_encoded ("\"%s\"", s);
else
mu_util_print_encoded ("%s", s);
s = mu_str_replace (str, "\"", "\"\"");
if (strchr (s, ','))
mu_util_print_encoded ("\"%s\"", s);
else
mu_util_print_encoded ("%s", s);
g_free (s);
g_free (s);
}
static void
each_contact_csv (const char *email, const char *name)
{
print_csv_field (name);
mu_util_print_encoded (",");
print_csv_field (email);
mu_util_print_encoded ("\n");
print_csv_field (name);
mu_util_print_encoded (",");
print_csv_field (email);
mu_util_print_encoded ("\n");
}
@ -288,155 +286,185 @@ each_contact_csv (const char *email, const char *name)
static void
print_plain (const char *email, const char *name, gboolean color)
{
if (name) {
if (color) fputs (MU_COLOR_MAGENTA, stdout);
mu_util_fputs_encoded (name, stdout);
fputs (" ", stdout);
}
if (name) {
if (color) fputs (MU_COLOR_MAGENTA, stdout);
mu_util_fputs_encoded (name, stdout);
fputs (" ", stdout);
}
if (color)
fputs (MU_COLOR_GREEN, stdout);
if (color)
fputs (MU_COLOR_GREEN, stdout);
mu_util_fputs_encoded (email, stdout);
mu_util_fputs_encoded (email, stdout);
if (color)
fputs (MU_COLOR_DEFAULT, stdout);
if (color)
fputs (MU_COLOR_DEFAULT, stdout);
fputs ("\n", stdout);
fputs ("\n", stdout);
}
typedef struct {
MuConfigFormat format;
gboolean color, personal;
time_t after;
GHashTable *nicks;
MuConfigFormat format;
gboolean color, personal;
time_t after;
GRegex *rx;
GHashTable *nicks;
size_t n;
} ECData;
static void
each_contact (const char *email, const char *name, gboolean personal,
time_t tstamp, unsigned freq, ECData *ecdata)
each_contact (const char *full_address,
const char *email, const char *name, gboolean personal,
time_t last_seen, size_t freq, gint64 tstamp,
ECData *ecdata)
{
if (ecdata->personal && !personal)
return;
if (ecdata->personal && !personal)
return;
if (tstamp < ecdata->after)
return;
if (tstamp < ecdata->after)
return;
switch (ecdata->format) {
case MU_CONFIG_FORMAT_MUTT_ALIAS:
each_contact_mutt_alias (email, name, ecdata->nicks);
break;
case MU_CONFIG_FORMAT_MUTT_AB:
mu_util_print_encoded ("%s\t%s\t\n",
email, name ? name : "");
break;
case MU_CONFIG_FORMAT_WL:
each_contact_wl (email, name, ecdata->nicks);
break;
case MU_CONFIG_FORMAT_ORG_CONTACT:
each_contact_org_contact (email, name);
break;
case MU_CONFIG_FORMAT_BBDB:
each_contact_bbdb (email, name, tstamp);
break;
case MU_CONFIG_FORMAT_CSV:
each_contact_csv (email, name);
break;
default:
print_plain (email, name, ecdata->color);
}
if (ecdata->rx &&
!g_regex_match (ecdata->rx, email, 0, NULL) &&
!g_regex_match (ecdata->rx, name ? name : "", 0, NULL))
return;
++ecdata->n;
switch (ecdata->format) {
case MU_CONFIG_FORMAT_MUTT_ALIAS:
each_contact_mutt_alias (email, name, ecdata->nicks);
break;
case MU_CONFIG_FORMAT_MUTT_AB:
mu_util_print_encoded ("%s\t%s\t\n",
email, name ? name : "");
break;
case MU_CONFIG_FORMAT_WL:
each_contact_wl (email, name, ecdata->nicks);
break;
case MU_CONFIG_FORMAT_ORG_CONTACT:
each_contact_org_contact (email, name);
break;
case MU_CONFIG_FORMAT_BBDB:
each_contact_bbdb (email, name, last_seen);
break;
case MU_CONFIG_FORMAT_CSV:
each_contact_csv (email, name);
break;
case MU_CONFIG_FORMAT_DEBUG: {
char datebuf[32];
strftime(datebuf, sizeof(datebuf), "%F %T",
gmtime(&last_seen));
g_print ("%s\n\tname: %s\n\t%s\n\tpersonal: %s\n\tfreq: %zu\n"
"\tlast-seen: %s\n",
email,
name ? name : "<none>",
full_address,
personal ? "yes" : "no",
freq,
datebuf);
} break;
default:
print_plain (email, name, ecdata->color);
}
}
static MuError
run_cmd_cfind (const char* pattern,
gboolean personal, time_t after,
MuConfigFormat format,
gboolean color, GError **err)
run_cmd_cfind (MuStore *store,
const char* pattern,
gboolean personal,
time_t after,
MuConfigFormat format,
gboolean color,
GError **err)
{
gboolean rv;
MuContacts *contacts;
size_t num;
ECData ecdata;
gboolean rv;
MuContacts *contacts;
ECData ecdata;
ecdata.personal = personal;
ecdata.after = after;
ecdata.format = format;
ecdata.color = color;
ecdata.nicks = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
memset(&ecdata, 0, sizeof(ecdata));
contacts = mu_contacts_new
(mu_runtime_path(MU_RUNTIME_PATH_CONTACTS));
if (!contacts) {
g_set_error (err, MU_ERROR_DOMAIN,
MU_ERROR_CONTACTS_CANNOT_RETRIEVE,
"could not retrieve contacts");
return MU_ERROR_CONTACTS_CANNOT_RETRIEVE;
}
if (pattern) {
ecdata.rx = g_regex_new (pattern,
G_REGEX_CASELESS|G_REGEX_OPTIMIZE,
0, err);
if (!ecdata.rx)
return MU_ERROR_CONTACTS;
}
print_header (format);
rv = mu_contacts_foreach (contacts,
(MuContactsForeachFunc)each_contact,
&ecdata, pattern, &num);
g_hash_table_unref (ecdata.nicks);
mu_contacts_destroy (contacts);
ecdata.personal = personal;
ecdata.n = 0;
ecdata.after = after;
ecdata.format = format;
ecdata.color = color;
ecdata.nicks = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
print_header (format);
rv = mu_contacts_foreach (mu_store_contacts(store),
(MuContactsForeachFunc)each_contact, &ecdata);
g_hash_table_unref (ecdata.nicks);
if (num == 0) {
g_warning ("no matching contacts found");
return MU_ERROR_NO_MATCHES;
}
if (ecdata.rx)
g_regex_unref (ecdata.rx);
return rv ? MU_OK : MU_ERROR_CONTACTS;
if (ecdata.n == 0) {
g_warning ("no matching contacts found");
return MU_ERROR_NO_MATCHES;
}
return rv ? MU_OK : MU_ERROR_CONTACTS;
}
static gboolean
cfind_params_valid (MuConfig *opts)
{
switch (opts->format) {
case MU_CONFIG_FORMAT_PLAIN:
case MU_CONFIG_FORMAT_MUTT_ALIAS:
case MU_CONFIG_FORMAT_MUTT_AB:
case MU_CONFIG_FORMAT_WL:
case MU_CONFIG_FORMAT_BBDB:
case MU_CONFIG_FORMAT_CSV:
case MU_CONFIG_FORMAT_ORG_CONTACT:
break;
default:
g_warning ("invalid output format %s",
opts->formatstr ? opts->formatstr : "<none>");
return FALSE;
}
switch (opts->format) {
case MU_CONFIG_FORMAT_PLAIN:
case MU_CONFIG_FORMAT_MUTT_ALIAS:
case MU_CONFIG_FORMAT_MUTT_AB:
case MU_CONFIG_FORMAT_WL:
case MU_CONFIG_FORMAT_BBDB:
case MU_CONFIG_FORMAT_CSV:
case MU_CONFIG_FORMAT_ORG_CONTACT:
case MU_CONFIG_FORMAT_DEBUG:
break;
default:
g_warning ("invalid output format %s",
opts->formatstr ? opts->formatstr : "<none>");
return FALSE;
}
/* only one pattern allowed */
if (opts->params[1] && opts->params[2]) {
g_warning ("usage: mu cfind [options] [<ptrn>]");
return FALSE;
}
/* only one pattern allowed */
if (opts->params[1] && opts->params[2]) {
g_warning ("usage: mu cfind [options] [<ptrn>]");
return FALSE;
}
return TRUE;
return TRUE;
}
MuError
mu_cmd_cfind (MuConfig *opts, GError **err)
mu_cmd_cfind (MuStore *store, MuConfig *opts, GError **err)
{
g_return_val_if_fail (opts, MU_ERROR_INTERNAL);
g_return_val_if_fail (opts->cmd == MU_CONFIG_CMD_CFIND,
MU_ERROR_INTERNAL);
g_return_val_if_fail (store, MU_ERROR_INTERNAL);
g_return_val_if_fail (opts, MU_ERROR_INTERNAL);
g_return_val_if_fail (opts->cmd == MU_CONFIG_CMD_CFIND,
MU_ERROR_INTERNAL);
if (!cfind_params_valid (opts)) {
g_set_error (err, MU_ERROR_DOMAIN, MU_ERROR_IN_PARAMETERS,
"invalid parameters");
return MU_ERROR_IN_PARAMETERS;
}
if (!cfind_params_valid (opts)) {
g_set_error (err, MU_ERROR_DOMAIN, MU_ERROR_IN_PARAMETERS,
"invalid parameters");
return MU_ERROR_IN_PARAMETERS;
}
return run_cmd_cfind (opts->params[1],
opts->personal,
opts->after,
opts->format,
!opts->nocolor,
err);
return run_cmd_cfind (store,
opts->params[1],
opts->personal,
opts->after,
opts->format,
!opts->nocolor,
err);
}

File diff suppressed because it is too large Load Diff

View File

@ -644,13 +644,14 @@ mu_cmd_execute (MuConfig *opts, GError **err)
/* already handled in mu-config.c */
case MU_CONFIG_CMD_HELP: return MU_OK;
case MU_CONFIG_CMD_CFIND: merr = mu_cmd_cfind (opts, err); break;
case MU_CONFIG_CMD_MKDIR: merr = mu_cmd_mkdir (opts, err); break;
case MU_CONFIG_CMD_SCRIPT: merr = mu_cmd_script (opts, err); break;
case MU_CONFIG_CMD_VIEW: merr = mu_cmd_view (opts, err); break;
case MU_CONFIG_CMD_VERIFY: merr = mu_cmd_verify (opts, err); break;
case MU_CONFIG_CMD_EXTRACT: merr = mu_cmd_extract (opts, err); break;
case MU_CONFIG_CMD_CFIND:
merr = with_store (mu_cmd_cfind, opts, TRUE, err); break;
case MU_CONFIG_CMD_FIND:
merr = with_store (mu_cmd_find, opts, TRUE, err); break;
case MU_CONFIG_CMD_INDEX:

View File

@ -118,13 +118,14 @@ MuError mu_cmd_script (MuConfig *opts, GError **err);
/**
* execute the cfind command
*
* @param store store object to use
* @param opts configuration options
* @param err receives error information, or NULL
*
* @return MU_OK (0) if the command succeeds,
* some error code otherwise
*/
MuError mu_cmd_cfind (MuConfig *opts, GError **err);
MuError mu_cmd_cfind (MuStore *store, MuConfig *opts, GError **err);
/**

View File

@ -54,7 +54,8 @@ get_output_format (const char *formatstr)
{"json", MU_CONFIG_FORMAT_JSON},
{"xml", MU_CONFIG_FORMAT_XML},
{"xquery", MU_CONFIG_FORMAT_XQUERY},
{"mquery", MU_CONFIG_FORMAT_MQUERY}
{"mquery", MU_CONFIG_FORMAT_MQUERY},
{"debug", MU_CONFIG_FORMAT_DEBUG}
};
for (i = 0; i != G_N_ELEMENTS(formats); i++)

View File

@ -47,6 +47,7 @@ enum _MuConfigFormat {
MU_CONFIG_FORMAT_CSV, /* comma-sep'd values */
MU_CONFIG_FORMAT_ORG_CONTACT, /* org-contact */
MU_CONFIG_FORMAT_BBDB, /* BBDB */
MU_CONFIG_FORMAT_DEBUG,
/* for find, view */
MU_CONFIG_FORMAT_SEXP, /* output sexps (emacs) */