Commit graph

2389 commits

Author SHA1 Message Date
Carl Worth
a47bf6e7dc notmuch-test: Add test to verify that uuencoded data is not indexed.
As recently promised, no new features are being accepted to notmuch
without corresponding new tests for the test suite.
2010-02-05 10:33:11 -08:00
Carl Worth
bc79dc9d6c notmuch-test: Add several tests of "notmuch search"
These tests were surprisingly simple to write---not much code at all
and most of them worked the first time even with hand-prepared
versions of the expected output.
2010-02-05 10:33:06 -08:00
Carl Worth
5c938e51b2 notmuch-test: Add a new add_message function.
The previous generate_message function is what's needed when testing
"notmuch new". But after that, we never want to generate a message
without also adding it to the index. So create a new add_message
function with this convenience.
2010-02-04 17:34:48 -08:00
Carl Worth
2bc0af15aa Eliminate some useless gobject boilerplate.
If we had external users of this filter then they might expect some of
these macros to exist. But since this is just internal, that's just
unneeded noise.
2010-02-04 17:26:00 -08:00
Carl Worth
3767c6f9f9 notmuch new: Don't index uuencoded data.
With modern MIME attachments, we're already avoiding indexing the
attachments. But for old-school uuencoded data in the mail, we have
been directly indexing the encoded data as terms, (which is not useful
at all---nobody will ever ytry to search based on the seemingly random
uuencoded data).

Additionally, indexing a modestly large uuencoded file seems to make
Xapian go insane, (consuming *lots* of memory).

We fix both problems by detecting uuencoded content and not performing
any indexing of it.
2010-02-04 17:08:11 -08:00
Carl Worth
d111c720ba notmuch reply: Rename the mailing_list_munged_reply_to function
This function detects whether the address in the Reply-To header
already appears in either To or Cc. So give it a name that reflects
what it does (reply_to_header_is_redundant) rather than the old name
which described one possible use of the function, (as a simple
heuristic for detecting whether a mailing list had applied reply-to
munging).
2010-02-04 12:42:09 -08:00
Carl Worth
62379f3dee notmuch reply: Prevent GMIME assertion complaints for empty Reply-to header.
Apparently, GMime doesn't want to create a valid address list object
for an empty string. That's annoying, but it's easy enough to test for
the empty string and avoid the problem.
2010-02-04 12:42:09 -08:00
Carl Worth
82e47ec92b notmuch reply: Use strstr instead of strcasestr for portability.
This change was already recommended in a comment in the original
implementation of this patch. If someone really wants to support
un-munging in the case of To: and Reply-To: having the same address
but different case, then they can provide a portable approach for
that.
2010-02-04 12:42:09 -08:00
Carl Worth
aea35aa5c6 notmuch reply: Fix the support for reply-to un-munging.
The condition was using a reversed sense for the test of the return
value of strcasestr, (perhaps confusing it with the usage of strcmp?).
2010-02-04 12:42:09 -08:00
Carl Worth
9953e9a5a8 notmuch-reply: Add missing whitespace.
Some recently-added functions were to hard for me to read without
the expected whitespace. Fix these.
2010-02-04 12:42:09 -08:00
Carl Worth
9041c1389c notmuch-test: Test "notmuch reply" with a reply-to-munged mail
This is a test for the recently added feature where we detect that the
reply-to address already exists in the To: or Cc: header so will
already be replied to. In this case we want to include the From:
address in our reply, (where, otherwise we would use the Reply-To
address *instead* of the address in the From header).
2010-02-04 12:42:03 -08:00
Jed Brown
fddd3d831b notmuch-reply.c: Handle munged `Reply-To' headers.
Some mailing lists engage in the evil practice of changing the Reply-To
header so that replies from all mailers go to the list by default, at
the expense of not responding to the person who actually sent the
message.  When this is detected, we reply to `From' and remove the
duplicate response to the mailing list.  Consider a reply to the
following message.

  From: Some User <some.user@example.com>
  To: Sample users list <sample-users@sample.org>
  Reply-To: Sample users list <sample-users@sample.org>

Prior to this patch, `notmuch reply' produces

  To: Sample users list <sample-users@sample.org>,
      Sample users list <sample-users@sample.org>

and after the patch,

  To: Some User <some.user@example.com>,
      Sample users list <sample-users@sample.org>

Signed-off-by: Jed Brown <jed@59A2.org>
2010-02-04 12:10:43 -08:00
Jed Brown
fb50f31048 notmuch-reply.c: Factor adding recipients into common function
This code was already duplicated. We move it to a new, shared
add_recipients_from_message function, in preparation for more
sophisticated mailing list logic.

Signed-off-by: Jed Brown <jed@59A2.org>
2010-02-04 12:10:43 -08:00
Carl Worth
bcba87a3e2 notmuch-test: Test "notmuch reply" with multiple recipients
The feature tested here is that we reply to both the sender and to
others addresses on the To: line of the original message, but that we
don't reply to our own address.
2010-02-04 12:10:43 -08:00
Carl Worth
fbe595e3b9 notmuch-test: Add test for "notmuch reply" with a CC header.
A simple test to help round out the set of tested features.
2010-02-04 12:10:43 -08:00
Carl Worth
96134fc723 notmuch-test: Add "notmuch reply" test for reply-to support.
This is the standard support of reply-to, (replying to that address
rather than the from address). It has nothing to do with the proposed
feature for extra-clever handling of a mail from a mailing-list that
has munged the reply-to header.
2010-02-04 12:10:43 -08:00
Carl Worth
33f55e43e1 notmuch-test: Test "notmuch reply" from alternate address.
When reply to a message addresses to an address configured in the
other_email setting in the configuration file, the reply should use
that address in the From header. Test this.
2010-02-04 12:10:43 -08:00
Carl Worth
4e66b777cf notmuch-test: Add a basic test of "notmuch reply"
Simply ensuring that the reply template is formatted as expected.
2010-02-04 12:10:42 -08:00
Carl Worth
5a4532860c notmuch-test: Eliminate sleeps to speed up test suite run
We were sleeping merely to ensure that our updates to the mail store
would result in the mtime of the appropriate directories being
updated. We make the test suite run faster by not sleeping, but
instead explicitly updating the mtime of the directory to a future
time with touch.

We're careful to ensure that the time is not merely in the future
compared to the current time, but also later than any previous update
to the same directory mtime.
2010-02-04 12:10:42 -08:00
Carl Worth
a821ba5737 notmuch-test: Allow custom headers when generating messages
This provides the control that future tests will need, (for example,
adding a CC field to ensure proper handling with "notmuch reply",
etc.)
2010-02-04 08:44:05 -08:00
Carl Worth
0d67c52f4d notmuch-test: Use named-parameters for generate_message function
This makes the test suite bash-specific, but that's not much of
an issue for me, (if somebody else would prefer some other language
then they can rewrite the test suite and maintain it).

The advantage here is that we'll now be able to easily generate
custom messages for testing operations that depend on the message
content, (such as "notmuch reply", etc.).
2010-02-04 08:44:05 -08:00
Carl Worth
8d37b2f982 Add actual testing to notmuch-test
We verify that each command creates output exactly as expected (after
ignoring variable output such as the report of how long an operation
took).
2010-02-04 08:44:05 -08:00
martin f. krafft
c2904e9842 Add suggestion to vim-addon-manager.
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-26 09:52:58 +13:00
Carl Worth
a2d919eb2f Add a very rough beginning of a test suite.
This notmuch-test script simply runs a few different notmuch operations,
(things that I found were useful while testing the rename-support code).

It's not useful as a test suite yet, since it doesn't actually check
the results of any operation, (the user of the suite has to know what
the results should be and must manually verify them. So there's no
integration with the build system yet, (no "make test" target).

But I didn't want to lose what I had so far, so here it is.
2010-01-24 07:36:39 +13:00
Carl Worth
4e051f8d95 notmuch.desktop: Clarify that this is the emacs interface to notmuch.
And the name is notmuch not not much.
2010-01-24 07:30:08 +13:00
Jeffrey C. Ollie
1bf121924d Add install target for notmuch.desktop file.
Add an install target that uses desktop-file-install to install the
desktop file in the appropriate location.  The location of the install
can be modified by changing the desktop_dir variable.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
2010-01-24 07:29:54 +13:00
Carl Worth
c25bc03dc6 Fix misspelling of DT_UNKNOWN.
How foolish of me to advertise the fact that I pushed a commit without
compiling it first...
2010-01-23 22:45:23 +13:00
Carl Worth
184625ac9b README: Tighten up the text a bit.
As Keith pointed out, (with a humorous citation from Mark Twain),
the two uses of "very" added nothing to the description. Also,
"large collection of email" was repeated uselessly.
2010-01-23 19:00:25 +13:00
Carl Worth
344c48a47d Add some comments to document the recently-fixed handling of d_type.
The fix was subtle, (requiring less code than originally expected), so
it behooves us to document it well.
2010-01-23 18:58:30 +13:00
Geo Carncross
c5416b6f1b notmuch new: Fix to work on filesystems returning DT_UNKNOWN
Such as reiserfs or xfs. This has been broken since the merge of
support for rename and deletion of files from the mail store.

Here's the original justification for the patch:

A review of notmuch-new.c shows three uses of ->d_type:

Near line 153, in _entries_resemble_maildir() we can simply allow for
DT_UNKNOWN. This would fail if people have MH-style folders which have
three folders called "new" "cur" and "tmp", but that seems unlikely, in
which case the "tmp" folder would simply not be scanned.

Near line 273 in add_files_recursive() we have another check. If
DT_UNKNOWN, we fall through, then add_files_recursive() does a stat
almost immediately, returning with success if the path isn't a
directory.

Thus, the fallback is already written.

Finally, near line 343, in add_files_recursive() (a long function) we
have another check. Here we can simply treat DT_UNKNOWN as DT_LNK, since
the logic for the stat() results are the same.
2010-01-23 18:52:30 +13:00
martin f. krafft
b416d7e6b9 builddep on dh must be versioned due to overrides
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 14:58:32 +13:00
martin f. krafft
6e4be17ab8 Install vim plugin with vim-addons
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 14:58:19 +13:00
martin f. krafft
9a66a8f877 add myself to uploaders
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 14:40:35 +13:00
martin f. krafft
cd9778c967 put cworth as maintainer per his own request
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 14:40:17 +13:00
martin f. krafft
814d2887ae Build-depend on emacs23
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 14:19:16 +13:00
martin f. krafft
38f1bf18c3 add ITP bug number to changelog entry about upload
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 14:09:00 +13:00
martin f. krafft
76ba495696 no need to create /usr/share dirs
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 14:08:08 +13:00
martin f. krafft
1551c35925 Put debian/* under separate copyright.
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 14:07:41 +13:00
martin f. krafft
cf72677e34 Fix suggestions/enhancements for vim+emacs
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 14:06:09 +13:00
martin f. krafft
61209b5d65 Start new changelog stanza pending upload
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 14:05:45 +13:00
martin f. krafft
9cef26de47 add Vcs-Browser field
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-21 13:59:40 +13:00
martin f. krafft
0ea5f3fc0e Merge branch 'upstream' 2010-01-21 13:58:55 +13:00
martin f. krafft
1ef33800df Install zsh completion file
According to the Debian zsh maintainer Clint Adams, this is the first
time that a package installs its own completer into zsh. Part of the
reason this is not usually done is because zsh does not provide a stable
API.

We agreed to try it, given that notmuch is expected to change quite
a bit initially. If there are problems or the completer goes stable,
we'll move it into the upstream zsh repository.

Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-14 18:12:13 +13:00
Carl Worth
c340c1bd11 notmuch new: Print upgrade progress report as a percentage.
Previously we were printing a number of messages upgraded so far. The
original motivation for this was to accurately reflect the fact that
there are two passes, (so each message is processed twice and it's not
accurate to represent with a single count). But as it turns out, the
second pass takes zero time (relatively speaking) so we're still not
accounting for it.

If nothing else, the percentage-based reporting makes for a cleaner
API for the progress_notify function.
2010-01-09 17:38:23 -08:00
Carl Worth
ccf2e0cc42 lib: Add non-content terms with a WDF value of 0.
The WDF is the "within-document frequency" value for a particular
term. It's intended to provide an indication of how frequent a term is
within a document, (for use in computing relevance). Xapian's term
generator already computes WDF values when we use that, (which we do
for indexing all mail content).

We don't use the term generator when adding single terms for things
that don't actually appear in the mail document, (such as tags, the
filename, etc.). In this case, the WDF value for these terms doesn't
matter much.

But Xapian's flint backend can be more efficient with changes to terms
that don't affect the document "length". So there's a performance
advantage for manipulating tags (with the flint backend) if the WDF of
these terms is 0.
2010-01-09 11:18:27 -08:00
Carl Worth
45b1856782 lib: Explicitly set BoolWeight when searching.
All notmuch searches currently sort by value (either date or message
ID) so it's just wasted effort for Xapian to compute relevance values
for each result. We now explicitly tell Xapian that we're uninterested
in the relevance values.
2010-01-09 11:16:40 -08:00
Carl Worth
d12801c8b4 lib: Split the database upgrade into two phases for safer operation.
The first phase copies data from the old format to the new format
without deleting anything. This allows an old notmuch to still use the
database if the upgrade process gets interrupted. The second phase
performs the deletion (after updating the database version number). If
the second phase is interrupted, there will be some unused data in the
database, but it shouldn't cause any actual harm.
2010-01-09 11:13:12 -08:00
martin f. krafft
994e46845d Add build-dependency on emacs
Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-09 11:50:12 +13:00
Carl Worth
5fe5e802ab lib: Delete stale timestamp documents during database upgrade.
Once we move the timestamp to the new directory document, we don't
need the old one anymore.
2010-01-08 09:57:09 -08:00
Carl Worth
c485c51585 notmuch new: Don't prevent database upgrade from being interrupted.
Our signal handler is designed to quickly flush out changes and then
exit. But if a database upgrade is in progress when the user
interrupts, then we just want to immediately abort. We could do
something fancy like add a return value to our progress_notify
function to allow it to tell the upgrade process to abort. But it's
actually much cleaner and robust to delay the installation of our
signal handler so that the default abort happens on SIGINT.
2010-01-08 08:45:16 -08:00