diff --git a/NEWS b/NEWS index 7e1f364a..4bc69902 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ * NEWS (user visible changes) +** Release 0.9.4 + + - add the 'cfind' command, to search/export contact information + - add 'flag:unread' as a synonym for 'flag:new OR NOT flag:unseen' + ** Release 0.9.3 <2011-02-13 Sun> - don't warn about missing files with --quiet diff --git a/configure.ac b/configure.ac index e151cb3d..2474d92e 100644 --- a/configure.ac +++ b/configure.ac @@ -142,7 +142,7 @@ AC_SUBST(XAPIAN_LIBS) # note that MU_XAPIAN_DB_VERSION does not necessarily follow MU # versioning, as we hopefully don't have updates for each version; # also, this has nothing to do with Xapian's software version -AC_DEFINE(MU_XAPIAN_DB_VERSION,["9.2"], ['Schema' version of the database]) +AC_DEFINE(MU_XAPIAN_DB_VERSION,["9.4"], ['Schema' version of the database]) AC_ARG_WITH([gui], [AS_HELP_STRING([--with-gui=gtk2|gtk3|none])], diff --git a/man/mu-easy.1 b/man/mu-easy.1 index d4fa7fa8..6598d839 100644 --- a/man/mu-easy.1 +++ b/man/mu-easy.1 @@ -1,4 +1,4 @@ -.TH MU-EASY 1 "November 2010" "User Manuals" +.TH MU-EASY 1 "March 2010" "User Manuals" .SH NAME @@ -42,7 +42,8 @@ When \fBmu\fR sees such a file, it will excluded this directory and its sub-directories. .SH SEARCHING YOUR E-MAIL -After you have indexed your mail, you can search it. Normally, the search + +After you have indexed your mail,you can search it. Normally, the search results are to standard output, but the output can also be in the form of Maildir with symbolic links to the found messages. This enables integration with e-mail clients; see the \fBmu-find\fR man page for details, the syntax of @@ -138,11 +139,11 @@ Get all messages from Jim without an attachment: Get all unread messages where the subject mentions Ångström: .nf - \fB$ mu find flag:new subject:Ångström\fR + \fB$ mu find flag:unread subject:Ångström\fR .fi which is equivalent to: .nf - \fB$ mu find flag:new subject:angstrom\fR + \fB$ mu find flag:unread subject:angstrom\fR .fi because does mu is case-insensitive and accent-insensitive. diff --git a/man/mu-find.1 b/man/mu-find.1 index f8d35c6f..2f00910b 100644 --- a/man/mu-find.1 +++ b/man/mu-find.1 @@ -1,4 +1,4 @@ -.TH MU FIND 1 "January 2011" "User Manuals" +.TH MU FIND 1 "March 2011" "User Manuals" .SH NAME @@ -124,6 +124,7 @@ listed in the following table: p,passed Passed ('Handled') r,replied Replied s,seen Seen + u,unread Unread (shorthand for 'new or not seen') t,thrashed Marked for deletion a,attach Has attachment z,signed Signed message @@ -400,13 +401,14 @@ Find all messages in the 'Archive' folder from Fred: $ mu find from:fred maildir:/Archive .fi -Find all messages with attachments: +Find all unread messages with attachments: .nf - $ mu find flag:attach + $ mu find flag:unread flag:attach .fi + .SS Integrating mu find with mail clients .TP diff --git a/src/mu-msg-file.c b/src/mu-msg-file.c index 1ac9a14f..65194611 100644 --- a/src/mu-msg-file.c +++ b/src/mu-msg-file.c @@ -99,7 +99,8 @@ mu_msg_file_get_flags_from_path (const char *path) mtype = check_msg_type (path, &info); if (mtype == MSG_TYPE_NEW) { /* we ignore any new-msg flags */ - flags = MU_MSG_FLAG_NEW; + /* note NEW implies UNREAD */ + flags = MU_MSG_FLAG_NEW | MU_MSG_FLAG_UNREAD; goto leave; } @@ -120,6 +121,10 @@ mu_msg_file_get_flags_from_path (const char *path) } } + /* the UNREAD pseudo flag => NEW OR NOT SEEN */ + if (!(flags & MU_MSG_FLAG_SEEN)) + flags |= MU_MSG_FLAG_UNREAD; + leave: g_free(info); return flags; @@ -147,7 +152,7 @@ get_flags_str_s (MuMsgFlags flags) flagstr[i++] = 'S'; if (flags & MU_MSG_FLAG_TRASHED) flagstr[i++] = 'T'; - + flagstr[i] = '\0'; return flagstr; diff --git a/src/mu-msg-flags.c b/src/mu-msg-flags.c index 4aaa43c4..8189aa4a 100644 --- a/src/mu-msg-flags.c +++ b/src/mu-msg-flags.c @@ -37,6 +37,7 @@ static const MuMsgFlags ALL_FLAGS[] = { /* r */ MU_MSG_FLAG_REPLIED, /* s */ MU_MSG_FLAG_SEEN, /* t */ MU_MSG_FLAG_TRASHED, + /* u */ MU_MSG_FLAG_UNREAD, /* x */ MU_MSG_FLAG_ENCRYPTED, /* z */ MU_MSG_FLAG_SIGNED }; @@ -53,7 +54,10 @@ mu_msg_flag_from_char (char k) case 't': return MU_MSG_FLAG_TRASHED; case 'd': return MU_MSG_FLAG_DRAFT; case 'f': return MU_MSG_FLAG_FLAGGED; - + + /* NEW OR NOT SEEN */ + case 'u': return MU_MSG_FLAG_UNREAD; + case 'z': return MU_MSG_FLAG_SIGNED; case 'x': return MU_MSG_FLAG_ENCRYPTED; case 'a': return MU_MSG_FLAG_HAS_ATTACH; @@ -75,6 +79,9 @@ mu_msg_flag_name (MuMsgFlags flag) case MU_MSG_FLAG_TRASHED: return "trashed"; case MU_MSG_FLAG_DRAFT: return "draft"; case MU_MSG_FLAG_FLAGGED: return "flagged"; + + /* ie., NEW or NOT SEEN */ + case MU_MSG_FLAG_UNREAD: return "unread"; case MU_MSG_FLAG_SIGNED: return "signed"; case MU_MSG_FLAG_ENCRYPTED: return "encrypted"; @@ -96,6 +103,9 @@ mu_msg_flag_char (MuMsgFlags flag) case MU_MSG_FLAG_TRASHED: return 't'; case MU_MSG_FLAG_DRAFT: return 'd'; case MU_MSG_FLAG_FLAGGED: return 'f'; + + /* NEW OR NOT SEEN */ + case MU_MSG_FLAG_UNREAD: return 'u'; case MU_MSG_FLAG_SIGNED: return 'z'; case MU_MSG_FLAG_ENCRYPTED: return 'x'; diff --git a/src/mu-msg-flags.h b/src/mu-msg-flags.h index a343f77a..0b500fda 100644 --- a/src/mu-msg-flags.h +++ b/src/mu-msg-flags.h @@ -56,14 +56,19 @@ enum _MuMsgFlags { /* "F"->flagged message */ MU_MSG_FLAG_FLAGGED = 1 << 6, + /* "U"->unread message; it's a pseudo/convenience flag that + * means (NEW or not SEEN) */ + MU_MSG_FLAG_UNREAD = 1 << 7, + + /* these we get from the contents */ /* "Z"->signed message */ - MU_MSG_FLAG_SIGNED = 1 << 7, + MU_MSG_FLAG_SIGNED = 1 << 8, /* "X"->encrypted message */ - MU_MSG_FLAG_ENCRYPTED = 1 << 8, + MU_MSG_FLAG_ENCRYPTED = 1 << 9, /* "A"->message has attachment */ - MU_MSG_FLAG_HAS_ATTACH = 1 << 9 + MU_MSG_FLAG_HAS_ATTACH = 1 << 10 }; typedef enum _MuMsgFlags MuMsgFlags; diff --git a/src/mu-store.cc b/src/mu-store.cc index 68121020..e1eadcac 100644 --- a/src/mu-store.cc +++ b/src/mu-store.cc @@ -309,30 +309,24 @@ add_terms_values_date (Xapian::Document& doc, MuMsg *msg, static void -add_terms_values_number (Xapian::Document& doc, MuMsg *msg, - MuMsgFieldId mfid) +add_terms_values_number (Xapian::Document& doc, MuMsg *msg, MuMsgFieldId mfid) { const std::string pfx (1, mu_msg_field_xapian_prefix(mfid)); gint64 num = mu_msg_get_field_numeric (msg, mfid); + const std::string numstr (Xapian::sortable_serialise((double)num)); - doc.add_value ((Xapian::valueno)mfid, numstr); if (mfid == MU_MSG_FIELD_ID_FLAGS) { - const char* flags, *cur; - cur = flags = mu_msg_flags_str_s ((MuMsgFlags)num); - while (cur && *cur) { - char kar = tolower (*cur); - doc.add_term (pfx + kar); - ++cur; - } + for (const char *cur = mu_msg_flags_str_s ((MuMsgFlags)num); + cur && *cur; ++cur) + doc.add_term (pfx + (char)tolower (*cur)); } else if (mfid == MU_MSG_FIELD_ID_PRIO) { doc.add_term (pfx + std::string(1, mu_msg_prio_char((MuMsgPrio)num))); - - } else - doc.add_term (pfx + numstr); + } //else + // doc.add_term (pfx + numstr); } static void diff --git a/src/tests/test-mu-msg-file.c b/src/tests/test-mu-msg-file.c index 51e98dce..30b1c3ed 100644 --- a/src/tests/test-mu-msg-file.c +++ b/src/tests/test-mu-msg-file.c @@ -40,14 +40,15 @@ static void test_mu_msg_file_get_flags_from_path(void) MuMsgFlags flags; } paths[] = { { - "/home/foo/Maildir/test/cur/123456:2,FR", - MU_MSG_FLAG_REPLIED | MU_MSG_FLAG_FLAGGED}, { - "/home/foo/Maildir/test/new/123456", MU_MSG_FLAG_NEW}, { + "/home/foo/Maildir/test/cur/123456:2,FSR", + MU_MSG_FLAG_REPLIED | MU_MSG_FLAG_SEEN | MU_MSG_FLAG_FLAGGED}, { + "/home/foo/Maildir/test/new/123456", + MU_MSG_FLAG_NEW | MU_MSG_FLAG_UNREAD}, { "/home/foo/Maildir/test/new/123456:2,FR", - MU_MSG_FLAG_NEW}, { + MU_MSG_FLAG_NEW | MU_MSG_FLAG_UNREAD}, { "/home/foo/Maildir/test/cur/123456:2,DTP", MU_MSG_FLAG_DRAFT | MU_MSG_FLAG_TRASHED | - MU_MSG_FLAG_PASSED}, { + MU_MSG_FLAG_PASSED | MU_MSG_FLAG_UNREAD }, { "/home/foo/Maildir/test/cur/123456:2,S", MU_MSG_FLAG_SEEN} }; diff --git a/src/tests/test-mu-msg.c b/src/tests/test-mu-msg.c index 2ee4292b..dabc9d7a 100644 --- a/src/tests/test-mu-msg.c +++ b/src/tests/test-mu-msg.c @@ -182,7 +182,7 @@ test_mu_msg_03 (void) "\nLet's write some fünkÿ text\nusing umlauts.\n\nFoo.\n"); g_assert_cmpuint (mu_msg_get_flags(msg), - ==, 0); + ==, MU_MSG_FLAG_UNREAD); mu_msg_unref (msg);