From d5329d3696f3bfb7c9b90dd21bbdc4b1aba5d35a Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 29 Aug 2010 16:30:55 +0300 Subject: [PATCH] * mu-config: add some config options for mu extract --- src/mu-config.c | 27 +++++++++++++++++++++++++++ src/mu-config.h | 9 ++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/mu-config.c b/src/mu-config.c index 8534b578..47fc1c6e 100644 --- a/src/mu-config.c +++ b/src/mu-config.c @@ -206,6 +206,31 @@ config_options_group_mkdir (MuConfigOptions *opts) } +static GOptionGroup* +config_options_group_extract (MuConfigOptions *opts) +{ + GOptionGroup *og; + GOptionEntry entries[] = { + {"all", 0, 0, G_OPTION_ARG_NONE, &opts->all, + "extract all attachments", NULL}, + {"all-parts", 0, 0, G_OPTION_ARG_NONE, &opts->all_parts, + "extract all parts (incl. non-attachments)", NULL}, + {"target-dir", 0, 0, G_OPTION_ARG_STRING, &opts->targetdir, + "target directory for saving", NULL}, + { NULL, 0, 0, 0, NULL, NULL, NULL } + }; + + og = g_option_group_new ("extract", + "options for the 'extract' command", + "", NULL, NULL); + g_option_group_add_entries (og, entries); + + return og; +} + + + + static gboolean parse_params (MuConfigOptions *opts, int *argcp, char ***argvp) @@ -224,6 +249,8 @@ parse_params (MuConfigOptions *opts, int *argcp, char ***argvp) config_options_group_find (opts)); g_option_context_add_group (context, config_options_group_mkdir (opts)); + g_option_context_add_group (context, + config_options_group_extract (opts)); rv = g_option_context_parse (context, argcp, argvp, &error); if (!rv) { diff --git a/src/mu-config.h b/src/mu-config.h index be369c24..9536f540 100644 --- a/src/mu-config.h +++ b/src/mu-config.h @@ -48,19 +48,22 @@ struct _MuConfigOptions { gboolean rebuild; /* empty the database before indexing */ gboolean autoupgrade; /* automatically upgrade db * when needed */ - /* options for querying */ gboolean xquery; /* give the Xapian query instead of search results */ char *fields; /* fields to show in output */ char *sortfield; /* field to sort by (string) */ gboolean descending; /* sort descending? */ - unsigned summary_len; /* max # of lines of msg in summary */ - + unsigned summary_len; /* max # of lines of msg in summary */ /* output to a maildir with symlinks */ char *linksdir; /* maildir to output symlinks */ gboolean clearlinks; /* clear a linksdir before filling */ mode_t dirmode; /* mode for the created maildir */ + + /* options for extracting parts */ + gboolean *all_parts; /* extract all parts */ + gboolean *all; /* extract all attachments */ + char *targetdir; /* where to save the attachments */ }; typedef struct _MuConfigOptions MuConfigOptions;