David Bremner [Sat, 15 Jul 2017 02:01:26 +0000 (23:01 -0300)]
cli/new: improve error reporting
Recently a user reported a crash in notmuch new, but because of
missing error reporting, all they could say was "A Xapian exception
occured". This commit adds the extra information available about
the error message in the exception.
David Bremner [Thu, 3 Aug 2017 13:20:37 +0000 (09:20 -0400)]
debian: add maintainer scripts to remove old startup file
We do it for notmuch and notmuch-emacs because the history is a bit
unclear. It seems to be safe to call when that conffile is not owned
by a given package
This new function asks the database to reindex a given message.
The parameter `indexopts` is currently ignored, but is intended to
provide an extensible API to support e.g. changing the encryption or
filtering status (e.g. whether and how certain non-plaintext parts are
indexed).
David Bremner [Sun, 4 Jun 2017 12:32:30 +0000 (09:32 -0300)]
lib: add notmuch_message_count_files
This operation is relatively inexpensive, as the needed metadata is
already computed by our lazy metadata fetching. The goal is to support
better UI for messages with multipile files.
David Bremner [Sun, 4 Jun 2017 12:32:29 +0000 (09:32 -0300)]
lib: index message files with duplicate message-ids
The corresponding xapian document just gets more terms added to it,
but this doesn't seem to break anything. Values on the other hand get
overwritten, which is a bit annoying, but arguably it is not worse to
take the values (from, subject, date) from the last file indexed
rather than the first.
David Bremner [Sun, 4 Jun 2017 12:32:28 +0000 (09:32 -0300)]
test: add known broken tests for duplicate message id
There are many other problems that could be tested, but these ones we
have some hope of fixing because it doesn't require UI changes, just
indexing changes.
David Bremner [Sun, 4 Jun 2017 12:32:26 +0000 (09:32 -0300)]
lib: factor out message-id parsing to separate file.
This is really pure C string parsing, and doesn't need to be mixed in
with the Xapian/C++ layer. Although not strictly necessary, it also
makes it a bit more natural to call _parse_message_id from multiple
compilation units.
David Bremner [Sun, 4 Jun 2017 12:32:25 +0000 (09:32 -0300)]
lib/n_d_add_message: refactor test for new/ghost messages
The switch is easier to understand than the side effects in the if
test. It also potentially allows us more flexibility in breaking up
this function into smaller pieces, since passing private_status around
is icky.
David Bremner [Sun, 4 Jun 2017 12:32:24 +0000 (09:32 -0300)]
lib: isolate n_d_add_message and helper functions into own file
'database.cc' is becoming a monster, and it's hard to follow what the
various static functions are used for. It turns out that about 1/3 of
this file notmuch_database_add_message and helper functions not used
by any other function. This commit isolates this code into it's own
file.
Some side effects of this refactoring:
- find_doc_ids becomes the non-static (but still private)
_notmuch_database_find_doc_ids
- a few instances of 'string' have 'std::' prepended, avoiding the
need for 'using namespace std;' in the new file.
David Bremner [Tue, 11 Jul 2017 11:19:37 +0000 (08:19 -0300)]
emacs: Add commentary for MELPA users
We have a steady trickle of people using notmuch-emacs from melpa with
distro packages of notmuch, and then being confused when it doesn't
work. Try to warn people what a foot-gun this is; this commentary
should be copied to the melpa web site.
resolve lintian tag debhelper-but-no-misc-depends notmuch-emacs
This is likely not strictly necessary given that notmuch-emacs is a
transitional package. But having a simple consistency until we
eventually remove the transitional notmuch-emacs package seems ok too,
and fewer arbitrary lintian warnings will make real lintian warnings
more visible.
David Bremner [Mon, 17 Jul 2017 11:47:18 +0000 (08:47 -0300)]
util: make g_mime_utils_header_decode_date_unix match prototype
The problem shows up on 32 bit architectures where sizeof(time_t) !=
sizeof(gint64). Upcasting the 32 bit time_t to a 64 bit integer
should hopefully be safe.
David Bremner [Wed, 12 Jul 2017 10:48:18 +0000 (07:48 -0300)]
emacs: change default for notmuch-crypto-process-mime to t
There are some cases like remote usage where this might cause
problems, but those users can easily customize the variable. The
inconvenience seems to be outweighed by the security benefit for most
users.
config: deprecate/drop crypto.gpg_path under gmime 2.6/3.0
gmime 3.0 no longer offers a means to set the path for gpg.
Users can set $PATH anyway if they want to pick a
differently-installed gpg (e.g. /usr/local/bin/gpg), so this isn't
much of a reduction in functionality.
The one main difference is for people who have tried to use "gpg2" to
make use of gpg 2.1, but that isn't usefully co-installable anyway.
The reply-to munging code might behave differently whether there's an
exact match on the strings or not, or whether the string is a raw
addr-spec instead of an name-addr. These tests cover those variations
(i also had to tweak json output further below when this new test was
added).
David Bremner [Fri, 2 Jun 2017 23:57:01 +0000 (20:57 -0300)]
cli: make keyid from fingerprint in gmime 3.0
The "key_id" field seems to used for userid in gmime-3.0, while the
keyid is dropped in the fingerprint field if the full fingerprint is
not available.
We need to rewrite the loop for gmime-3.0; move the loop body to its
own function to avoid code duplication. Keep the common exit via
"goto DONE" to make this pure code movement. It's important to note
that the existing exit path only deallocates the iterator.
David Bremner [Sat, 1 Jul 2017 15:18:43 +0000 (12:18 -0300)]
cli/show: convert keyword options to booleans
There are two keyword options here that impliment boolean options. It
is simpler to use the built-in boolean argument handling, and also
more robust against divergence in parsing boolean and keyword arguments.