Merge branch 'master' into find-exec

This commit is contained in:
Dirk-Jan C. Binnema 2011-07-10 14:12:03 +03:00
commit 838bb25d4e
9 changed files with 69 additions and 22 deletions

View File

@ -25,10 +25,9 @@ any).
instead of displaying the full message, output a summary based upon the first
lines of the message.
\fB\-\-separate\fR
add an ascii \\014 (0x0c, or \fIform-feed\fR) between messages when displaying
multiple messages.
\fB\-\-terminator\fR
terminate messaages with a \\f (\fIform-feed\fR) characters when displaying
them. This is useful when you want to further process them.
.SH BUGS

View File

@ -34,7 +34,7 @@
#include "mu-contacts.h"
#include "mu-runtime.h"
#define VIEW_SEPARATOR '\f' /* form-feed */
#define VIEW_TERMINATOR '\f' /* form-feed */
static void
@ -196,8 +196,8 @@ mu_cmd_view (MuConfig *opts)
if (rv != MU_EXITCODE_OK)
break;
/* add a separator between two messages? */
if (opts->params[i+1] && opts->separate)
g_print ("%c", VIEW_SEPARATOR);
if (opts->terminator)
g_print ("%c", VIEW_TERMINATOR);
}
return rv;

View File

@ -245,8 +245,8 @@ config_options_group_view (MuConfig *opts)
GOptionEntry entries[] = {
{"summary", 0, 0, G_OPTION_ARG_NONE, &opts->summary,
"only show a short summary of the message (false)", NULL},
{"separate", 0, 0, G_OPTION_ARG_NONE, &opts->separate,
"separate messages with ascii-0x07 (form-feed)", NULL},
{"terminate", 0, 0, G_OPTION_ARG_NONE, &opts->terminator,
"terminate messages with ascii-0x07 (\\f, form-feed)", NULL},
{NULL, 0, 0, 0, NULL, NULL, NULL}
};

View File

@ -108,9 +108,9 @@ struct _MuConfig {
* messages */
/* options for view */
gboolean separate; /* add separator between
* multiple messages in mu
* view */
gboolean terminator; /* add separator \f between
* multiple messages in mu
* view */
/* output to a maildir with symlinks */
char *linksdir; /* maildir to output symlinks */

View File

@ -212,7 +212,7 @@ static const MuMsgField FIELD_DATA[] = {
MU_MSG_FIELD_TYPE_STRING_LIST,
"tag", 'x', 'X',
FLAG_GMIME | FLAG_XAPIAN_TERM | FLAG_XAPIAN_PREFIX_ONLY |
FLAG_NORMALIZE
FLAG_NORMALIZE | FLAG_XAPIAN_ESCAPE
}
};

View File

@ -407,6 +407,9 @@ add_terms_values_string_list (Xapian::Document& doc, MuMsg *msg,
if (mu_msg_field_normalize (mfid))
mu_str_normalize_in_place (val, TRUE);
if (mu_msg_field_xapian_escape (mfid))
mu_str_ascii_xapian_escape_in_place (val);
doc.add_term (prefix(mfid) +
std::string(val, 0, MU_STORE_MAX_TERM_LENGTH));

View File

@ -115,7 +115,7 @@ test_mu_index (void)
store = mu_store_new (xpath, NULL, NULL);
g_assert (store);
g_assert_cmpuint (mu_store_count (store), ==, 8);
g_assert_cmpuint (mu_store_count (store), ==, 9);
mu_store_destroy (store);
g_free (muhome);
@ -498,7 +498,7 @@ test_mu_view_multi_separate (void)
tmpdir = test_mu_common_get_random_tmpdir();
g_assert (g_mkdir_with_parents (tmpdir, 0700) == 0);
cmdline = g_strdup_printf ("%s view --separate --muhome=%s "
cmdline = g_strdup_printf ("%s view --terminate --muhome=%s "
"%s%cbar%ccur%cmail5 "
"%s%cbar%ccur%cmail5",
MU_PROGRAM,
@ -517,8 +517,7 @@ test_mu_view_multi_separate (void)
len = strlen(output);
/* g_print ("\n[%s](%u)\n", output, len); */
g_assert_cmpuint (len,==,165);
g_assert_cmpuint (len,==,166);
g_free (output);
g_free (cmdline);

View File

@ -87,7 +87,6 @@ run_and_count_matches (const char *xpath, const char *query)
MuQuery *mquery;
MuMsgIter *iter;
guint count1, count2;
GHashTable *hash;
mquery = mu_query_new (xpath, NULL);
g_assert (query);
@ -107,9 +106,6 @@ run_and_count_matches (const char *xpath, const char *query)
mu_query_destroy (mquery);
g_assert (iter);
hash = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify)g_free, NULL);
assert_no_dups (iter);
/* run query twice, to test mu_msg_iter_reset */
@ -414,7 +410,7 @@ test_mu_query_attach (void)
/* g_print ("(%s)\n", xpath); */
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
for (i = 0; i != G_N_ELEMENTS(queries); ++i)
g_assert_cmpuint (run_and_count_matches (xpath, queries[i].query),
==, queries[i].count);
@ -450,6 +446,36 @@ test_mu_query_tags (void)
}
static void
test_mu_query_tags_02 (void)
{
gchar *xpath;
int i;
QResults queries[] = {
{ "x:paradise", 1},
{ "tag:@NextActions", 1},
{ "x:queensrÿche", 1},
{ "tag:lost OR tag:operation:mindcrime", 2},
};
xpath = fill_database (MU_TESTMAILDIR2);
g_assert (xpath != NULL);
/* g_print ("(%s)\n", xpath); */
for (i = 0; i != G_N_ELEMENTS(queries); ++i) {
/* g_print ("%s\n", queries[i].query); */
g_assert_cmpuint (run_and_count_matches (xpath, queries[i].query),
==, queries[i].count);
}
g_free (xpath);
}
int
main (int argc, char *argv[])
{
@ -474,6 +500,8 @@ main (int argc, char *argv[])
test_mu_query_attach);
g_test_add_func ("/mu-query/test-mu-query-tags",
test_mu_query_tags);
g_test_add_func ("/mu-query/test-mu-query-tags_02",
test_mu_query_tags_02);
g_log_set_handler (NULL,
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,

View File

@ -0,0 +1,18 @@
Date: Thu, 31 Jul 2008 14:57:25 -0400
From: "Geoff Tate" <jeff@example.com>
Subject: eyes of a stranger
To: "Enrico Fermi" <enrico@example.com>
Message-id: <3BE9E6535E302944823E7A1A20D852173@msg.id>
MIME-version: 1.0
X-label: @NextActions, operation:mindcrime, Queensrÿche
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Precedence: high
And I raise my head and stare
Into the eyes of a stranger
I've always known that the mirror never lies
People always turn away
From the eyes of a stranger
Afraid to know what
Lies behind the stare