]> git.notmuchmail.org Git - notmuch/log
notmuch
12 years agotest: Add test that emacs detects and hides top-post quotes of original messages
Carl Worth [Fri, 10 Jun 2011 23:28:26 +0000 (16:28 -0700)]
test: Add test that emacs detects and hides top-post quotes of original messages

This tests the recently-added detection/hiding of top-posted quotations and
in the testing, it takes advantage of the less-recently-added
visible-buffer-string function for emitting only the visible text
from a buffer.

12 years agonotmuch.el: hide original message in top posted replies.
David Bremner [Wed, 24 Feb 2010 18:30:06 +0000 (14:30 -0400)]
notmuch.el: hide original message in top posted replies.

This code treats top posted copies essentially like signatures, except
that it doesn't sanity check their length, since neither do their
senders.

New user-visible variables:

notmuch-wash-button-original-hidden-format
notmuch-wash-button-original-visible-format

Rebased-by: Carl Worth <cworth@cworth.org>
12 years agoUse stock GMimeSession by default
Daniel Kahn Gillmor [Fri, 3 Jun 2011 23:57:46 +0000 (19:57 -0400)]
Use stock GMimeSession by default

Our use of GMimeSession was unneeded boilerplate, and we weren't doing
anything with it.  This simplifies and clarifies that assumption.

If we want to do anything fancier later, the examples in the gmime
source are a reasonable source to work from in defining a new
GMimeSession derivative.

Since GMimeSession is going away in GMime 2.6, though, i don't
recommend using it.

12 years agoshow: Avoid inadvertently closing stdout
Jameson Graef Rollins [Sat, 28 May 2011 21:52:00 +0000 (14:52 -0700)]
show: Avoid inadvertently closing stdout

GMime has a nasty habit of taking ownership by default of any FILE*
handed to it va g_mime_stream_file_new. Specifically it will close the
FILE* when the stream is destroyed---even though GMime didn't open the
file itself.

To avoid this bad behavior, we have to carefully set_owner(FALSE)
after calling g_mime_stream_file_new. In the format_part_content_text
function, since commit d92146d3a6809f8ad940302af49cd99a0820665e we've
been calling g_mime_stream_file_new unconditionally, but only calling
g_mime_stream_file_set_owner(FALSE) conditionally.

This led to the FILE* being closed early when notmuch show output was
redirected to a file.

Fixing this fixes the test-suite cases that broke with the previous
commit, (which added redirected "notmuch show" calls to the test suite
to expose this bug).

Edited-by: Carl Worth <cworth@cworth.org> with a new commit message to
explain the bug and fix.

12 years agotest: modify multipart test to use test_expect_equal_file
Jameson Graef Rollins [Sat, 28 May 2011 21:16:30 +0000 (14:16 -0700)]
test: modify multipart test to use test_expect_equal_file

Again, this is a much cleaner and more thorough test, and in fact
exposes a bug in the format=text output, that will be fixed the next
commit.  Because of this, some of the multipart tests currently fail.

12 years agotest: update emacs test to use test_expect_equal_file
Jameson Graef Rollins [Sat, 28 May 2011 20:46:24 +0000 (13:46 -0700)]
test: update emacs test to use test_expect_equal_file

This is a much cleaner way to do the emacs tests, since we're actually
comparing output against existing files with expected output.  We also
won't miss any trailing newlines this way.

And speaking of which, one of the expected output files was actually
missing a trailing blank line that was actually in one of the original
messages, so this was fixed.

12 years agoMake `notmuch-show-clean-address' parsing-error-proof.
Dmitry Kurochkin [Thu, 12 May 2011 13:56:25 +0000 (17:56 +0400)]
Make `notmuch-show-clean-address' parsing-error-proof.

Mail-header-parse-address may fail for an invalid address.
Before the change, this would result in empty notmuch-show buffer
with an error message like: Scan error: "Unbalanced parentheses".
The patch wraps the function in condition-case and returns
unchanged address in case of error.

12 years agotest: add "notmuch-show for message with invalid From" test
Dmitry Kurochkin [Thu, 12 May 2011 13:56:26 +0000 (17:56 +0400)]
test: add "notmuch-show for message with invalid From" test

12 years agoemacs: Cleaner interface when prompting for sender address
Thomas Jost [Sat, 28 May 2011 21:51:56 +0000 (14:51 -0700)]
emacs: Cleaner interface when prompting for sender address

Most of the time, every entry in the list of identities has the same user name
part. It can then be filled in automatically, and the user can only be prompted
for the email address, which makes the interface much cleaner.

12 years agoemacs: Don't always prompt for the "From" address when replying
Thomas Jost [Sat, 28 May 2011 21:51:55 +0000 (14:51 -0700)]
emacs: Don't always prompt for the "From" address when replying

When replying, the From: address is already filled in by notmuch reply, so most
of the time there is no need to prompt the user for it.

12 years agoemacs: fix notmuch-show-part-button to not include newline
Jameson Graef Rollins [Sat, 28 May 2011 21:51:54 +0000 (14:51 -0700)]
emacs: fix notmuch-show-part-button to not include newline

This makes the button cleaner, so that it doesn't include the entire
rest of the line that the button is on.

12 years agoFix misspelling in search output sanitization test.
Austin Clements [Sat, 28 May 2011 21:51:53 +0000 (14:51 -0700)]
Fix misspelling in search output sanitization test.

A simple spelling fix in the text description.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
12 years agoavoid segfault when calling sanitize_string() on NULL
Daniel Kahn Gillmor [Sat, 28 May 2011 21:51:52 +0000 (14:51 -0700)]
avoid segfault when calling sanitize_string() on NULL

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
12 years agolib/message-file: plug three memleaks.
Anton Khirnov [Sat, 28 May 2011 21:51:51 +0000 (14:51 -0700)]
lib/message-file: plug three memleaks.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
12 years agoUse message-field-value instead of message-fetch-field in FCC header setup.
Dmitry Kurochkin [Sat, 28 May 2011 21:51:50 +0000 (14:51 -0700)]
Use message-field-value instead of message-fetch-field in FCC header setup.

For message-fetch-field the buffer is expected to be narrowed to
just the header of the message.  That is not the case when
notmuch-fcc-header-setup is run, hence a wrong header value may be
returned.  E.g. when forwarding an
email, (message-fetch-field "From") returns the From header value
of the forwarded email.

Message-field-value is the same as message-fetch-field, only
narrows the buffer to the headers first.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
12 years agobindings/python: Bump bindings version to 0.6
Sebastian Spaeth [Thu, 2 Jun 2011 15:44:23 +0000 (17:44 +0200)]
bindings/python: Bump bindings version to 0.6

To match the upcoming release, and with the updated API to match the
current libnotmuch, bump the python version number (notmuch.__VERSION__)
to 0.6.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
12 years agobindings/python: Implement Tags().__nonzero__()
Sebastian Spaeth [Thu, 2 Jun 2011 15:28:50 +0000 (17:28 +0200)]
bindings/python: Implement Tags().__nonzero__()

Analog to Threads.__nonzero__ this allows us to perform list() on a Threads() object and to repeatedly call "if Tags():" or "bool(Tags())" without implicitly invoking len(), thus exhausting our iterator.

While touching this code, I added a small micro-optimization to the Tag next() function. There is no need to explicitly check _is_valid, as _get implicitly does check for validness and returns None, if there is no more Tag to fetch. This avoids some roundtrips into the library when iterating through Tags.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
12 years agobindings/python: implement Threads().__nonzero__
Sebastian Spaeth [Thu, 2 Jun 2011 14:28:00 +0000 (16:28 +0200)]
bindings/python: implement Threads().__nonzero__

 __nonzero__ checks if Threads() contains at least one more valid thread

 The existence of this function makes 'if Threads(): foo' work, as that
 previously implicitely called len() exhausting the iterator. This
 function makes `bool(Threads())` work repeatedly.

For further info, see http://docs.python.org/reference/datamodel.html.
Credits for the hint go to Brian May.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
12 years agobindings/python: Include the new get_filenames in the API docs
Sebastian Spaeth [Thu, 2 Jun 2011 07:20:56 +0000 (09:20 +0200)]
bindings/python: Include the new get_filenames in the API docs

They had accidentally been left out, so we should also include the
function docs for get_messages in the API docs.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
12 years agobindings/python: Implement Message().get_filenames()
Sebastian Spaeth [Thu, 2 Jun 2011 06:56:03 +0000 (08:56 +0200)]
bindings/python: Implement Message().get_filenames()

Message().get_filenames() will return a generator that allows to
iterator over the recorded filenames for a certain Message. Do ntoe that
as all generators, these are one-time use only. You will have to reget
them to perform various actions. So this works::

  len(Message().get_filenames())
  list(Message().get_filenames())
  for n in Message().get_filenames():
    print n

But this won't::

  names = Message().get_filenames()
  len(names) #uses up the iterator
  list(names) #outch, already used up...

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
12 years agoemacs: Use "message-cited-text" instead of "message-cited-text-face"
Pieter Praet [Sun, 20 Mar 2011 10:06:22 +0000 (11:06 +0100)]
emacs: Use "message-cited-text" instead of "message-cited-text-face"

(describe-face 'message-cited-text-face)
> message-cited-text-face is an alias for the face `message-cited-text'.
> This face is obsolete since 22.1; use `message-cited-text' instead.

Signed-off-by: Pieter Praet <pieter@praet.org>
Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
12 years agotest: cleanup search-output test names (no functional change)
Jameson Graef Rollins [Sun, 8 May 2011 23:55:07 +0000 (16:55 -0700)]
test: cleanup search-output test names (no functional change)

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
12 years agotest: add test for sanitized notmuch-search output
Florian Friesdorf [Sun, 8 May 2011 23:13:15 +0000 (01:13 +0200)]
test: add test for sanitized notmuch-search output

This feature was recently added, so it of course needs a test now.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
Edited-by: Carl Worth <cworth@cworth.org> Fixed test to use
notmuch_search_sanitize in order to be robust against unpredictable
thread ID numbers, (due to unpredictable order in which the filesystem
presents files).

12 years agoSanitize "Subject:" and "Author:" fields to not contain control characters in notmuch...
Andreas Amann [Sun, 8 May 2011 21:14:33 +0000 (23:14 +0200)]
Sanitize "Subject:" and "Author:" fields to not contain control characters in notmuch-search

When a Subject field contained encoded CRLF sequences, these sequences
would appear unfiltered in the output of notmuch search. This confused
the notmuch emacs interface leading to "Unexpected Output"
messages. This is now fixed by replacing all characters with ASCII
code less than 32 with a question mark.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
12 years agoemacs: Define several faces for the crypto-status button
Thomas Jost [Wed, 30 Mar 2011 22:31:04 +0000 (00:31 +0200)]
emacs: Define several faces for the crypto-status button

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
jrollins modified this patch to conform to recent changes in the
crypto processing since this patch was originally sent in.

12 years agotest: Create and set temporary home directory
Florian Friesdorf [Mon, 18 Apr 2011 17:41:39 +0000 (19:41 +0200)]
test: Create and set temporary home directory

In the master branch in test/emacs two tests access the build users home
directory, so does emacs_deliver_message in the crypto branch.

The tests should not touch the build user's home directory. The patch
creates a directory in the temporary test directory and sets home
accordingly.

In case of a non-existent home directory, the tests are failing without
this patch.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
12 years agotest: remove json test for search null result, since it's being more properly tested...
Jameson Graef Rollins [Sun, 8 May 2011 21:13:05 +0000 (14:13 -0700)]
test: remove json test for search null result, since it's being more properly tested in search-output

The test in json was inferior to the one in search-output, since it
wasn't properly testing for the presence of a trailing newline.

12 years agotest: move utf-8 subject search test from json to search test script
Jameson Graef Rollins [Sun, 8 May 2011 21:04:47 +0000 (14:04 -0700)]
test: move utf-8 subject search test from json to search test script

This test doesn't have anything to do with json, and has everything to
do with testing search capability, so I'm not sure why it was in the
wrong place.

12 years agotest: Move a test from search to search-output, and add a similar json test
Jameson Graef Rollins [Fri, 6 May 2011 18:57:16 +0000 (11:57 -0700)]
test: Move a test from search to search-output, and add a similar json test

The "Search for non-existent message prints nothing" test fits better
with the existing tests in search-output, so move it there. Also add a
similar test for the --format=json case.

These tests also use the new test_expect_equal_file function, (to ensure
that the presence of a trailing newline is correctly tested).

12 years agoFix missing final newline in notmuch search output
Jameson Graef Rollins [Fri, 6 May 2011 19:03:04 +0000 (12:03 -0700)]
Fix missing final newline in notmuch search output

A previous commit to fix json formatting for null results
(0b1ddc5f6652bde99d63d9d553777b3d926694cf) accidentally introduced a
regression that removed trailing newlines for non-json output.  (There
wasn't a good test for this previously, but there is now).  The
problem is due to the fundamental differences in formatting between
the json and non-json outputs.  The only way to fix this was to add a
new formatting field that represents the string to output at the end
of a null result.

All output formatting tests should pass now, (in particular, the 4
recent test failures introduced to show this bug).

12 years agotest: modify search-output test to use the new test_expect_equal_file function
Jameson Graef Rollins [Fri, 6 May 2011 18:52:10 +0000 (11:52 -0700)]
test: modify search-output test to use the new test_expect_equal_file function

These test now properly test for the presence of a newline at the end
of all output.  Right now some of these test will fail because the
search output is currently broken to *not* produce proper newlines in
some cases.

12 years agoadd note about updating the debian symbols file to the RELEASE file
Jameson Graef Rollins [Thu, 5 May 2011 16:38:38 +0000 (09:38 -0700)]
add note about updating the debian symbols file to the RELEASE file

12 years agoconfigure: Fix detection of libdir in ldconfig configuration
Carl Worth [Wed, 1 Jun 2011 20:02:58 +0000 (13:02 -0700)]
configure: Fix detection of libdir in ldconfig configuration

Ever since commit b4b5e9ce4dac62111ec11da6d22b7e618056801f the
detection of libdir in the ldconfig configuration has been broken,
resulting in RPATH being set when not needed and not wanted.

The cause was a change from an IFS setting of:

IFS="$(printf '\n\t')"

to a new setting of:

IFS="$(printf '\n')"

That looks desirable since we want to split the output of ldconfig
based on newlines, (and not split on any filename that might have an
embedded tab in it). The subtle bug in the above is that the shell
trims any trailing newlines when performing command substitution so
the final statement above was equivalent to:

IFS=''

which prevented any splitting of the ldconfig output at all.

Fix this by avoiding command substitution and just using a literal
newline in the source file for setting this variable.

12 years agovim: add delete commands
Felipe Contreras [Sun, 6 Feb 2011 12:10:53 +0000 (14:10 +0200)]
vim: add delete commands

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
12 years agovim: add support for delete in search view
Felipe Contreras [Thu, 9 Dec 2010 19:19:44 +0000 (21:19 +0200)]
vim: add support for delete in search view

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
12 years agovim: add support to mark as read in search view
Felipe Contreras [Thu, 9 Dec 2010 19:15:43 +0000 (21:15 +0200)]
vim: add support to mark as read in search view

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
12 years agovim: add support to mark as read in show view
Felipe Contreras [Wed, 16 Jun 2010 22:38:47 +0000 (01:38 +0300)]
vim: add support to mark as read in show view

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
12 years agoRename signerstatustostring to signer_status_to_string
Carl Worth [Tue, 31 May 2011 23:20:56 +0000 (16:20 -0700)]
Rename signerstatustostring to signer_status_to_string

Otherwise, it's fartoohardformetoreadthis code.

12 years agoReduce some excessive indentation.
Carl Worth [Tue, 31 May 2011 23:18:45 +0000 (16:18 -0700)]
Reduce some excessive indentation.

I prefer checking a condition and returning early rather than making
large blocks of code within a function conditional.

12 years agoshow: Remove some dead code from show_text_part_content
Carl Worth [Tue, 31 May 2011 23:16:04 +0000 (16:16 -0700)]
show: Remove some dead code from show_text_part_content

Now that this function registers an internal error if called with a
non-text part, we can remove the conditions for multipart and
message-part content types.

12 years agonotmuch show: Don't do text conversions for non-text parts
Carl Worth [Tue, 31 May 2011 23:13:21 +0000 (16:13 -0700)]
notmuch show: Don't do text conversions for non-text parts

This fixes the recently-added test case (in test/multipart)
demonstrating corruption of binary parts that happen to contain CRLF
pairs.

We restore the original code from show_one_part_content to
format_part_content_raw. Then, for good measure, we rename
show_part_content to the more descriptive show_text_part_content and
add an internal error if it is ever called with a non-text part.

12 years agotest: Add test showing notmuch corrupts a part with a CRLF pair in it
Carl Worth [Tue, 31 May 2011 22:39:26 +0000 (15:39 -0700)]
test: Add test showing notmuch corrupts a part with a CRLF pair in it

Since commit 2f8871df6ea3c0b44f85a0fc1b4f58a6b70b0a0e notmuch has been
using a function (show_part_content) originally written only for text
parts to save all MIME parts. The problem with this is that this
function converts CRLF pairs to LF only and optionally converts to
UTF-8 encoding. These two conversions have the potential to corrupt
binary data when passed through the function.

This test demonstrates that corruption, and so fails currently, until
we fix the bug.

12 years agotest: Fix a misspelling in one of our test cases.
Carl Worth [Tue, 31 May 2011 22:19:12 +0000 (15:19 -0700)]
test: Fix a misspelling in one of our test cases.

Not that it affects the correctness of the test, but it's nice to use
proper spelling. This kind of change could invalidate a signature on the
test message, but I think that would have happened previously when the
HTML part was added in the first place.

12 years agotest: add test for saving attachments using notmuch-show-save-part
Dmitry Kurochkin [Tue, 10 May 2011 03:30:51 +0000 (07:30 +0400)]
test: add test for saving attachments using notmuch-show-save-part

Use .gz filenames for saved attachments in the tests to check
that Emacs does not re-compress the file.

Use test_expect_equal_file instead of test_expect_equal to avoid
binary output on the console.

12 years agotest: copy files in test_expect_equal_file instead of moving them
Dmitry Kurochkin [Tue, 10 May 2011 03:30:50 +0000 (07:30 +0400)]
test: copy files in test_expect_equal_file instead of moving them

Before the change, test_expect_equal_file moved files it compared
in case of failure.  The patch changes it to copy the files
instead.  This allows testing non-temporary files which are
stored in git.

Note: the change should not result in new temporary files left
after the tests.  Test_expect_equal_file used to move files only
on failure, so callers had to cleanup them anyway.

12 years agoDon't re-compress .gz & al. in notmuch-show-save-part.
Dmitry Kurochkin [Mon, 9 May 2011 23:33:55 +0000 (03:33 +0400)]
Don't re-compress .gz & al. in notmuch-show-save-part.

Write-region handles some file names specially, see Emacs Lisp
manual section 25.11 Making Certain File Names "Magic" [1].  This
is a nice feature for normal text editing, but it is not
desirable if we need to save raw file content (e.g. attachment).
In particular, this affects archives and may result in corrupted
attachments saved with notmuch-show-save-part (attachment button
click handler).

Turns out, smart GNUS folks encountered the same problem and
implemented write-region wrapper which inhibits some file name
handlers.  In particular, this wrapper is used in mm-save-part,
which is why notmuch-save-attachments that uses it works fine
with archives.

The patch replaces write-region with mm-write-region in
notmuch-show-save-part.  Also it removes coding-system-for-write
and require-final-newline setting in notmuch-show-save-part.  The
former is set in mm-write-region.  The latter seems to be
unneeded because mm-save-part does not use it.

[1] http://www.gnu.org/s/emacs/manual/html_node/elisp/Magic-File-Names.html

12 years agoemacs: Give mutlipart/{signed, encrypted} their own part handler.
Jameson Graef Rollins [Fri, 27 May 2011 18:52:19 +0000 (11:52 -0700)]
emacs: Give mutlipart/{signed, encrypted} their own part handler.

This is the best way to make the displayed output for
decrypted/verified messages clearer.  The special sigstatus and
encstatus buttons are now displayed under the part header button.  The
part header button is also tweaked to provide information to user
about how to proces crypto.

12 years agoemacs: Do not attempt to render arbitrary application parts.
Jameson Graef Rollins [Fri, 27 May 2011 10:27:38 +0000 (03:27 -0700)]
emacs: Do not attempt to render arbitrary application parts.

We probably shouldn't have been doing this anyway, but we do it here
specifically because we don't want the content of the
application/pgp-encrypted parts to be displayed and cluttering the
message show.

12 years agoRender all parts of multipart/encrypted when decrypting.
Jameson Graef Rollins [Fri, 27 May 2011 10:27:37 +0000 (03:27 -0700)]
Render all parts of multipart/encrypted when decrypting.

The primary goal here is to keep the decrypted output as similarly
structured as undecrypted output as possible.  Now, when decrypting
parts, only the original encrypted part is replaced by the it's
decrypted content.  If this part isn't itself a multipart, then all
part numbering should remain consistent during decryption.

The only draw back here is that the useless application/pgp-encrypted
sub-part of the multipart/encrypted part is also emitted.  But this
part can be easily ignored by clients.

12 years agoDo not replace multipart/signed part with content part when doing verification.
Jameson Graef Rollins [Fri, 27 May 2011 10:27:36 +0000 (03:27 -0700)]
Do not replace multipart/signed part with content part when doing verification.

Some folks have complained about the part renumbering that occurs when
the entire multipart/signed part is replaced with the part contents
after verification.  This is primarily because it incurs an additional
computational cost to retrieve individual parts, since verification
has to be performed again to ensure that part numbering is consistent.
This patch simply leaves the full multipart/signed part as is.

The emacs crypto test is also updated to reflect this change.

12 years agotag signed/encrypted during notmuch new
Jameson Graef Rollins [Thu, 26 May 2011 01:01:20 +0000 (18:01 -0700)]
tag signed/encrypted during notmuch new

This patch adds the tag "signed" to messages with any multipart/signed
parts, and the tag "encrypted" to messages with any
multipart/encrypted parts.  This only occurs when messages are indexed
during notmuch new, so a database rebuild is required to have old
messages tagged.

12 years agoemacs: Add support for PGP/MIME verification/decryption
Jameson Graef Rollins [Thu, 26 May 2011 01:01:19 +0000 (18:01 -0700)]
emacs: Add support for PGP/MIME verification/decryption

A new emacs configuration variable "notmuch-crypto-process-mime"
controls the processing of PGP/MIME signatures and encrypted parts.
When this is set true, notmuch-query will use the notmuch show
--decrypt flag to decrypt encrypted messages and/or calculate the
sigstatus of signed messages.  If sigstatus is available, notmuch-show
will place a specially color-coded header at the begining of the
signed message.

Also included is the ability to switch decryption/verification on/off
on the fly, which is bound to M-RET in notmuch-search-mode.

12 years agoAdd decryption of PGP/MIME-encrypted parts with --decrypt.
Jameson Graef Rollins [Thu, 26 May 2011 01:01:18 +0000 (18:01 -0700)]
Add decryption of PGP/MIME-encrypted parts with --decrypt.

This adds support for decrypting PGP/MIME-encrypted parts to
notmuch-show and notmuch-reply.  The --decrypt option implies
--verify.  Once decryption (and possibly signature verification) is
done, a new part_encstatus formatter is emitted, the part_sigstatus
formatter is emitted, and the entire multipart/encrypted part is
replaced by the contents of the encrypted part.

At the moment only a json part_encstatus formatting function is
available, even though decryption is done for all formats.  Emacs
support to follow.

12 years agoAdd signature verification of PGP/MIME-signed parts with --verify.
Jameson Graef Rollins [Thu, 26 May 2011 01:01:17 +0000 (18:01 -0700)]
Add signature verification of PGP/MIME-signed parts with --verify.

This is primarily for notmuch-show, although the functionality is
added to show-message.  Once signatures are processed a new
part_sigstatus formatter is emitted, and the entire multipart/signed
part is replaced with the contents of the signed part.

At the moment only a json part_sigstatus formatting function is
available.  Emacs support to follow.

The original work for this patch was done by

  Daniel Kahn Gillmor <dkg@fifthhorseman.net>

whose help with this functionality I greatly appreciate.

12 years agotest: add crypto tests for signature verification and decryption
Jameson Graef Rollins [Thu, 26 May 2011 01:01:16 +0000 (18:01 -0700)]
test: add crypto tests for signature verification and decryption

This adds a new "crypto" test script to the test suite to test
PGP/MIME signature verification and message decryption.  Included here
is a test GNUPGHOME with a test secret key (passwordless), and test
for:

  * signing/verification
  * signing/verification with full owner trust
  * verification with signer key unavailable
  * encryption/decryption
  * decryption failure with missing key
  * encryption/decryption + signing/verfifying
  * reply to encrypted message
  * verification of signature from revoked key

These tests are not expected to pass now, but will as crypto
functionality is included.

12 years agotest: add notmuch_show_sanitize_all function that is a little more aggressive.
Jameson Graef Rollins [Thu, 26 May 2011 01:01:15 +0000 (18:01 -0700)]
test: add notmuch_show_sanitize_all function that is a little more aggressive.

The old notmuch_show_sanitize function only scrubed part of the
filename.  This one scrubs the full filename, as well as the message
id.

12 years agotest: new test-lib function to test for equality between files
Jameson Graef Rollins [Thu, 26 May 2011 01:01:14 +0000 (18:01 -0700)]
test: new test-lib function to test for equality between files

We need to be able to test for the presence of a newline at the end of
output.  There's no good way to capture trailing newlines in bash, so
redirecting output to a file is the next best thing.  This new
function should be used when testing for output that is expected to
have trailing newlines.

The next commit will demonstrate the use of this.

12 years agoBreak up format->part function into part_start and part_content functions.
Jameson Graef Rollins [Thu, 26 May 2011 01:01:13 +0000 (18:01 -0700)]
Break up format->part function into part_start and part_content functions.

Future improvements (eg. crypto support) will require adding new part
header.  By breaking up the output of part headers from the output of
part content, we can easily out new part headers with new formatting
functions.

12 years agoUse empty strings instead of NULL in format_reply structure.
Jameson Graef Rollins [Thu, 26 May 2011 01:01:12 +0000 (18:01 -0700)]
Use empty strings instead of NULL in format_reply structure.

This keeps things consistent with notmuch-show, and prevents having to
check for the existence of the field pointer for simple string output
formats.

12 years agoIntegrate reply_part_content function into reply_part function.
Jameson Graef Rollins [Thu, 26 May 2011 01:01:11 +0000 (18:01 -0700)]
Integrate reply_part_content function into reply_part function.

After the last patch to eliminate some redundant code paths in
reply_part, the reply_part_content function was only being called
once.  Disolving the function and integrating its contents into the
reply_part function makes things a little simpler, and frees up some
name space that will be needed in the next patch.

12 years agoSimplify reply_part function to eliminate redundant code paths.
Jameson Graef Rollins [Thu, 26 May 2011 01:01:10 +0000 (18:01 -0700)]
Simplify reply_part function to eliminate redundant code paths.

This is the same logic but with less code.

12 years agotest: use `princ' instead of `message' calls in emacs tests
Dmitry Kurochkin [Tue, 10 May 2011 06:25:08 +0000 (10:25 +0400)]
test: use `princ' instead of `message' calls in emacs tests

The patch replaces all (message (buffer-string)) calls in emacs
tests with (princ (buffer-string)).  This avoids accidentally
interpreting '%' as format specifiers and makes code simpler
because we do not need to capture stderr.

Also, the patch works around an Emacs (23.3+1-1 on current Debian
Unstable) segfault in "Ensure that emacs doesn't drop results"
test.  Note: the segfault does not happen on every test run.
Though, it seems to be consistently reproducible if the test uses
300 messages instead of 30.  Hopefully, it is the crash described
in Emacs bug #8545 [1] which is already fixed.

[1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8545

12 years agoUpdate some more recent tests to use /usr/bin/env to find bash
Carl Worth [Fri, 27 May 2011 21:08:04 +0000 (14:08 -0700)]
Update some more recent tests to use /usr/bin/env to find bash

The recentl-applied patch had grown stale, so update the tests that had
been created since it was originally written.

12 years agotest: change "#!/bin/bash" to "#!/usr/bin/env bash" enhances portability
Joel Borggrén-Franck [Wed, 1 Dec 2010 20:27:52 +0000 (21:27 +0100)]
test: change "#!/bin/bash" to "#!/usr/bin/env bash" enhances portability

Change #!/bin/bash at start of tests to "#!/usr/bin/env bash". That way
systems running on bash < 4 can prepend bash >= 4 to path before
running the tests.

12 years agoFix check of sysconf return in get_name/username_from_passwd_file
Matthias Guedemann [Wed, 25 May 2011 12:27:55 +0000 (14:27 +0200)]
Fix check of sysconf return in get_name/username_from_passwd_file

Fix to check the value returned by sysconf(_SC_GETPW_R_SIZE_MAX)
before using the value.

This fixes a core dump on DragonFlyBSD where this function returns -1.

12 years agoemacs: Make the queries used in the all-tags section configurable
Daniel Schoepe [Wed, 25 May 2011 21:21:54 +0000 (23:21 +0200)]
emacs: Make the queries used in the all-tags section configurable

This patch adds a customization variable that controls what queries
are used to construct the all-tags section in notmuch-hello. It allows
the user to specify a function to construct the query given a tag or
a string that is used as a filter for each tag.
It also adds a variable to hide various tags from the all-tags section.

Signed-off-by: Daniel Schoepe <daniel.schoepe@googlemail.com>
12 years agotest: add test-lib.el file with `visible-buffer-string' function
Dmitry Kurochkin [Thu, 26 May 2011 16:27:58 +0000 (20:27 +0400)]
test: add test-lib.el file with `visible-buffer-string' function

The patch adds test-lib.el file for Emacs tests auxiliary stuff.
Currently, it implements two functions: `visible-buffer-string'
and `visible-buffer-substring'.  These are similar to standard
counterparts without "visible-" prefix but exclude invisible
text.  The functions are not used anywhere at the moment but
should be useful for testing hiding/showing in the Emacs
interface.

Edited-by: Carl Worth <cworth@cworth.org> Fixed "basic" test to ignore
new test-lib.el file.

12 years agoemacs: Add a customization allowing to always prompt for the "From" address when...
Thomas Jost [Thu, 26 May 2011 17:22:41 +0000 (19:22 +0200)]
emacs: Add a customization allowing to always prompt for the "From" address when composing a new message

12 years agoemacs: Allow the user to choose the "From" address when replying to a message
Thomas Jost [Thu, 26 May 2011 08:41:33 +0000 (10:41 +0200)]
emacs: Allow the user to choose the "From" address when replying to a message

When pressing C-u r, the user will be prompted for the identity to use.

12 years agoemacs: Allow the user to choose the "From" address when forwarding a message
Thomas Jost [Thu, 26 May 2011 08:41:32 +0000 (10:41 +0200)]
emacs: Allow the user to choose the "From" address when forwarding a message

When pressing C-u f, the user will be prompted for the identity to use.

12 years agoemacs: Allow the user to choose the "From" address when composing a new message
Thomas Jost [Thu, 26 May 2011 08:41:31 +0000 (10:41 +0200)]
emacs: Allow the user to choose the "From" address when composing a new message

When pressing C-u m, the user will be prompted for the identity to use.

12 years agoemacs: Helpers needed for the user to be able to choose the "From" address when compo...
Thomas Jost [Thu, 26 May 2011 08:41:30 +0000 (10:41 +0200)]
emacs: Helpers needed for the user to be able to choose the "From" address when composing a new message

This adds functions and variables needed for this feature to be implemented.
Once it's done, the user will be able to use a prefix argument (e.g. pressing
C-u m instead of m) and be able to select a From address.

By default the list of names/addresses to be used during completion will be
automatically generated by the settings in the notmuch configuration file. The
user can customize the notmuch-identities variable to provide an alternate list.

This is based on a previous patch by Carl Worth
(id:"87wrhfvk6a.fsf@yoom.home.cworth.org" and follow-ups).

12 years agoCarefully manage save/restore of point in `notmuch-wash-toggle-invisible-action'.
Dmitry Kurochkin [Tue, 24 May 2011 23:02:43 +0000 (03:02 +0400)]
Carefully manage save/restore of point in `notmuch-wash-toggle-invisible-action'.

Before the change, save-excursion was used to save the point.  But the
marker saved by save-excursion was inside a region that was deleted,
so that approach is unreliable, (leading to point jumping to a new
position past the button). This patch instead saves point in an
integer variable, and when restoring, carefully avoids moving point
past the button, (in case the new button label is shorter than the old
button label).

12 years agotest: add test for hiding/showing signature in notmuch-show view
Dmitry Kurochkin [Sun, 22 May 2011 18:57:55 +0000 (22:57 +0400)]
test: add test for hiding/showing signature in notmuch-show view

12 years agotest: fix expected output for emacs tests after the wash button label changes
Dmitry Kurochkin [Sun, 22 May 2011 18:57:54 +0000 (22:57 +0400)]
test: fix expected output for emacs tests after the wash button label changes

12 years agoUse different labels for wash buttons when text is visible or hidden.
Dmitry Kurochkin [Sun, 22 May 2011 18:57:53 +0000 (22:57 +0400)]
Use different labels for wash buttons when text is visible or hidden.

Before the change, citation and signature wash buttons used the
same label in both visible and hidden states.  Sometimes it is
very convenient when you can determine if the text is hidden or
shown without reading the context and/or clicking the button.
The patch makes it easy to see if the text is shown or hidden by
explicitly saying what the button does (shows or hides the text).

12 years agoemacs: Add an accessor function for emacs code to get at user.other_email
Carl Worth [Tue, 24 May 2011 21:26:20 +0000 (14:26 -0700)]
emacs: Add an accessor function for emacs code to get at user.other_email

This is like the other notmuch-config accessor functions except that it
converts the newline-separated string into an actual lisp list.

12 years agoemacs: add notmuch-before- and notmuch-after-tag-hook
Daniel Schoepe [Sun, 15 May 2011 15:48:58 +0000 (17:48 +0200)]
emacs: add notmuch-before- and notmuch-after-tag-hook

This patch adds hooks that are run before/after messages are tagged
From the emacs interface.  In order to implement this and to avoid
having hooks parse all the arguments to the notmuch binary again, I
created a `notmuch-tag' function that other modules should use instead
of running (notmuch-call-notmuch-process "tag" ...) directly.

12 years agopython: Update README to talkabout notmuch, not cnotmuch
Carl Worth [Tue, 24 May 2011 20:08:18 +0000 (13:08 -0700)]
python: Update README to talkabout notmuch, not cnotmuch

The old instructions were telling users to do "easy_install cnotmuch"
which installed some old, stale bindings. The new instructions should
be much more effective.

12 years agoman page: Eliminate two warnings
Carl Worth [Tue, 24 May 2011 19:34:25 +0000 (12:34 -0700)]
man page: Eliminate two warnings

Manually turn off both filling and justification for the one
exceedingly-long URL which was blowing groff's mind. Also, adjust the
position of 'text' to not be at the beginning of a line so it is not
mistaken for a macro.

12 years agonotmuch: Implement search-tags as an alias for "search --output=tags *"
Carl Worth [Tue, 24 May 2011 19:09:53 +0000 (12:09 -0700)]
notmuch: Implement search-tags as an alias for "search --output=tags *"

Ever since we added support for "notmuch search --output=tags" the
"notmuch search-tags" command has been redundant. The recent addition
of alias support makes it easy to drop the explicit search-tags
command in favor of a simple alias that runs "notmuch search
--output=tags *".

So there's no longer any documentation of the search-tags command, but
existing scripts will not break at all.

12 years agotest: Expand multipart test to cover "notmuch reply" as well
Carl Worth [Tue, 24 May 2011 17:56:38 +0000 (10:56 -0700)]
test: Expand multipart test to cover "notmuch reply" as well

This gives coverage for the segmentation fault in "notmuch reply" that
was just fixed with the previous commit.

12 years agonotmuch reply: Avoid segmentation fault when printing multiple parts
Carl Worth [Tue, 24 May 2011 17:52:38 +0000 (10:52 -0700)]
notmuch reply: Avoid segmentation fault when printing multiple parts

The code was previously trying to print a NULL string in this case, which
is obviously what we don't want to do.

12 years agotest: Expand multipart test to cover part output in all formats.
Jameson Graef Rollins [Mon, 23 May 2011 07:46:44 +0000 (00:46 -0700)]
test: Expand multipart test to cover part output in all formats.

The example multipart message is made a bit more complicated by adding
a message/rfc822 message, and the all parts are output and tested in
all output formats.

12 years agoemacs: update notmuch-show.el to use new part output
Jameson Graef Rollins [Mon, 23 May 2011 13:45:39 +0000 (06:45 -0700)]
emacs: update notmuch-show.el to use new part output

The command-line interface for extracting a single part from a message
recently changed from:

notmuch part --part=X
to:
notmuch show --format=raw --part=X

12 years agoFix handling of message/rfc822 parts
Jameson Graef Rollins [Mon, 23 May 2011 07:46:16 +0000 (00:46 -0700)]
Fix handling of message/rfc822 parts

Since message/rfc822 parts are really just a special kind of
multipart, we here normalize the handling of the two.  This will
provide access to sub-parts of message/rfc822 parts, which was
previously unavailable.

12 years agonotmuch show: Update documentation for default --format=raw for --part
Carl Worth [Tue, 24 May 2011 18:21:08 +0000 (11:21 -0700)]
notmuch show: Update documentation for default --format=raw for --part

We recently made the --part option to "notmuch show" trigger a default
format of "raw", (since the previous default of "text" is not often
useful with a single part---especially a non-text part).

Here, we update the documentation to match.

12 years agouse format=raw by default when requesting part with --part=
Jameson Graef Rollins [Mon, 23 May 2011 22:38:49 +0000 (15:38 -0700)]
use format=raw by default when requesting part with --part=

This makes part retrieval a little more intuitive, since generally one
will always want to retrieve parts in raw form.

12 years agothrow error if mbox format specified with --part
Jameson Graef Rollins [Mon, 23 May 2011 07:35:37 +0000 (00:35 -0700)]
throw error if mbox format specified with --part

These formats are incompatible, since mbox format requires full
messages.

12 years agonotmuch: Support "notmuch part" as an alias for "notmuch show --format=raw"
Carl Worth [Tue, 24 May 2011 19:00:27 +0000 (12:00 -0700)]
notmuch: Support "notmuch part" as an alias for "notmuch show --format=raw"

We unifed the "notmuch part" functionality into "notmuch show" where
the implementation is both simpler and more powerful. But there's no
good reason to break users of the old interface.

Add support for aliases, which are undocumented means of getting at
functionality through deprecated names. The first such alias is
"notmuch part" as implemented here.

12 years agoNew part output handling as option to notmuch-show.
Jameson Graef Rollins [Mon, 23 May 2011 22:31:32 +0000 (15:31 -0700)]
New part output handling as option to notmuch-show.

Outputting of single MIME parts is moved to an option of notmuch show,
instead of being handled in it's own sub-command.  The recent rework
of multipart mime allowed for this change but consolidating part
handling into a single recursive function (show_message_part) that
includes formatting.  This allows for far simpler handling single
output of a single part, including formatting.

12 years agoNormalize part counting and formatting in show_message_part function.
Jameson Graef Rollins [Mon, 23 May 2011 05:08:08 +0000 (22:08 -0700)]
Normalize part counting and formatting in show_message_part function.

Simplify the function by moving part counting and formatting outside
of conditionals, thereby eliminating redundant code.  This also wraps
message part output handling with proper part formatting.

12 years agorename do_show_raw to do_show_single, and create params.raw for raw message output
Jameson Graef Rollins [Mon, 23 May 2011 03:04:02 +0000 (20:04 -0700)]
rename do_show_raw to do_show_single, and create params.raw for raw message output

We rename here in order to make do_show_single into a generic function
for handling output of just a single message, or which format=raw is a
special case.  The raw case is handled by setting a new parameter,
params.raw, which is used to tell do_show_single to output a single
message as a raw file.

This is mostly in preparation for much improved part handling to
follow imminently.

12 years agoadd part_sep formatter to replace "first" argument to part format functions
Jameson Graef Rollins [Mon, 23 May 2011 02:56:53 +0000 (19:56 -0700)]
add part_sep formatter to replace "first" argument to part format functions

A new field "part_sep" is added to the notmuch_show_format structure,
to be used for part separation.  This is cleaner than the "first"
argument that was being passed around to the part arguments, and
allows the function that handles overall part output formatting
(show_message_part) to directly handle when outputting the separator.

12 years agocreate notmuch_show_params_t structure for holding parameters passed to show functions.
Jameson Graef Rollins [Fri, 20 May 2011 22:01:52 +0000 (15:01 -0700)]
create notmuch_show_params_t structure for holding parameters passed to show functions.

This simplifies the passing of arguments to the show functions.  This
will be very useful as we accumulate more parameters that will need to
be passed.  Currently only the entire_thread parameter is passed this
way.

12 years agotest: force deletion of test remnants
Jameson Graef Rollins [Sat, 7 May 2011 19:10:04 +0000 (12:10 -0700)]
test: force deletion of test remnants

This keeps the test from failing if only a subset of the remnants were
available for deletion, because e.g. only a subset of the tests were
run.

12 years agotest: allow specifying tests to run with NOTMUCH_TESTS env var
Jameson Graef Rollins [Sat, 7 May 2011 19:08:34 +0000 (12:08 -0700)]
test: allow specifying tests to run with NOTMUCH_TESTS env var

This is useful for just running a specific subset of tests, ie:

NOTMUCH_TESTS=crypto make test

12 years agoTODO: Add note for bug with message with References but no In-Reply-To
Carl Worth [Mon, 23 May 2011 21:53:52 +0000 (14:53 -0700)]
TODO: Add note for bug with message with References but no In-Reply-To

We recently noticed on the mailing list a case where a message wasn't
properly connected to its parent. We should fix that of course.

12 years agonotmuch part: Fix part numbering to match what's reported by "notmuch show"
Carl Worth [Mon, 23 May 2011 21:27:23 +0000 (14:27 -0700)]
notmuch part: Fix part numbering to match what's reported by "notmuch show"

Since commit c51d5b3cdb5ca0816816e88ca6f7136a24e74eee we are counting
multipart containers when emitting part numbers in the "notmuch show"
output. Unfortunately, "notmuch part" wasn't updated with the same
numbering, (and the test suite is inadequate to catch this).

Fix this by adding a similar part-numbering change to "notmuch part" here.

12 years agopass entire format structure to various show_message functions
Jameson Graef Rollins [Fri, 20 May 2011 18:45:33 +0000 (11:45 -0700)]
pass entire format structure to various show_message functions

Various show_message* functions require formatting functions, which
were previously being passed individually as arguments.  Since we will
need to be needing to passing in more formatting function in the
future (ie. for crypto support), we here modify things so that we just
pass in the entire format structure.  This will make things much
simpler down the line as we need to pass in new format functions.

We move the show_format structure into notmuch-client.c as
notmuch_show_format.  This also affects notmuch-reply.c, so we create
a mostly-empty format_reply to pass the reply_part function to
show_message_body.