summaryrefslogtreecommitdiff
path: root/notmuch-reply.c
AgeCommit message (Collapse)Author
2016-09-17cli/reply: only pass gmime message to add recipients to reply messageJani Nikula
The notmuch message is no longer needed. Simplify.
2016-09-17cli/reply: pass gmime message to Reply-To: redundancy detectionJani Nikula
Use gmime message instead of notmuch message in Reply-To: redundancy detection. This allows us to easily iterate over all recipient email addresses accurately, instead of just scanning for strings in the relevant message headers. This improves the accuracy of the detection in many ways. This also makes the notmuch message parameter to get_sender() unused. This will be cleaned up in a follow-up patch to not make too many changes here at once.
2016-09-17cli/reply: do not parse Reply-To: header into internet address list twiceJani Nikula
Avoid parsing Reply-To: header into internet address list twice. Move the parsing outside of reply_to_header_is_redundant(), and pass the parsed internet address list in as parameter. This also avoids leaking the memory of one copy of the internet address list.
2016-09-17cli/reply: return internet address list from get header funcsJani Nikula
Pass in GMimeMessage to simplify To/Cc/Bcc headers. We'll eventually remove the notmuch message passing altogether, but keep both for now to not make too big changes at once. Getting the headers from GMimeMessage using GMime functions fixes the error on duplicate Cc headers reported by Daniel Kahn Gillmor <dkg@fifthhorseman.net> in id:87d1ngv95p.fsf@alice.fifthhorseman.net. Get rid of an intermediate function. The small annoyance is the ownership differences in the address lists.
2016-09-17cli/reply: check for NULL list first in scan_address_list()Jani Nikula
Support passing NULL list later on. Also use it to simplify the recursion.
2016-09-17cli/reply: use dedicated functions for reply to mappingJani Nikula
The main motivation here is to move the special casing around reply-to/from handling into a function of its own, clarifying the main logic.
2016-09-17cli/reply: reduce the reply format abstractionsJani Nikula
Now that we've made the various reply formats quite similar to each other, there's no point in keeping the abstractions. They are now close enough to be put in one function. For now, a mime node will be uselessly created for the headers-only case, but this is insignificant, and may change in the future.
2016-09-17cli/reply: reuse create_reply_message() also for headers-only formatJani Nikula
Add an option for "limited" headers for the (slightly misleadingly named) headers-only format. There should be no functional changes.
2016-09-17cli/reply: make references header creation easier to followJani Nikula
Just use strdup when original references is not available, instead of trying to cram everything into a monster asprintf. There should be no functional changes.
2016-09-17cli/reply: reorganize create_reply_message()Jani Nikula
Again, in preparation for later unification, reorganize create_reply_message() to be more similar to the headers-only format reply code in notmuch_reply_format_headers_only(). Due to "pretty" header ordering, there should be no change in output. There should be no functional changes.
2016-09-17cli/reply: unify reply format functionsJani Nikula
Prepare for further future unification by making the code similar. The only functional change is that errors in mime_node_open() also break execution in default reply format.
2016-09-17cli/reply: reuse show_reply_headers() in headers-only formatJani Nikula
Align the code with default format reply. There should be no changes in output.
2016-09-17cli/reply: push notmuch reply format abstraction lower in the stackJani Nikula
There's quite a bit of duplication, and some consequent deviation, between the various notmuch reply format code paths. Perform the query and message iteration in common code, and make the format specific functions operate on single messages. There should be no functional changes.
2016-06-05Use https instead of http where possibleDaniel Kahn Gillmor
Many of the external links found in the notmuch source can be resolved using https instead of http. This changeset addresses as many as i could find, without touching the e-mail corpus or expected outputs found in tests.
2016-06-05update link to Chip Rosenthal article about reply-to mungingDaniel Kahn Gillmor
The original link is currently returning an internal server error :(
2016-05-19cli: tell how many messages were precisely matched when expected 1 matchTomi Ollila
In case of notmuch reply and notmuch show --part=N it is required that search terms match to one message. If match count was != 1, error message "Error: search term did not match precisely one message" was too vague to explain what happened. By appending (matched <num> messages) to the error message it makes the problem more understandable (e.g when <num> is '0' user reckons the query had a typo in it).
2016-03-14doc/reply: Clarify how reply-to header is handledMichal Sojka
Current documentation and comments in the code do not correspond to the actual code and tests in the test suite ("Un-munging Reply-To" in T230-reply-to-sender.sh). Fix it.
2015-11-19cli: content disposition values are not case-sensitiveJani Nikula
Per RFC 2183, the values for Content-Disposition values are not case-sensitive. While at it, use the gmime function for getting at the disposition string instead of referencing the field directly. This fixes attachment display and quoting in notmuch show and reply, respectively.
2015-10-05cli: update to use new count APIDavid Bremner
Essentially replace each call to notmuch_count_* with the corresponding _st call, followed by print_status_query.
2015-09-23cli: convert remainder of CLI to n_q_search_{messages,threads}_stDavid Bremner
I think it would be no real problem to cut and paste the gdb based error message test from count to the other clients modified here, but I'm not currently convinced it's worth the trouble since the code path being tested is almost the the same, and the tests are relatively heavyweight.
2015-08-14cli: add global option "--uuid"David Bremner
The function notmuch_exit_if_unmatched_db_uuid is split from notmuch_process_shared_options because it needs an open notmuch database. There are two exceptional cases in uuid handling. 1) notmuch config and notmuch setup don't currently open the database, so it doesn't make sense to check the UUID. 2) notmuch compact opens the database inside the library, so we either need to open the database just to check uuid, or change the API.
2015-06-01cli: define shared options, use for --help and --versionDavid Bremner
Unfortunately it seems trickier to support --config globally The non-trivial changes are in notmuch.c; most of the other changes consists of blindly inserting two lines into every subcommand.
2015-03-11CLI: make gpg binary used by libgmime configurable.David Bremner
Previously we set up a way for the top level notmuch command to choose which gpg binary was invoked by libgmime. In this commit we add the (mostly boilerplate) code to allow the notmuch-config command to read and write this path, and use it in the appropriate struct. Update tests for new default variable
2015-03-09CLI: set up infrastructure to make path to gpg configurable.David Bremner
GMIME takes a path to gpg, but we hardcode that path. In this commit we set up argument passing and option storage to allow this path to specified in the top level notmuch command.
2014-03-25cli: sanitize the received header before scanning for repliesJani Nikula
This makes the from guessing agnostic to header folding by spaces or tabs.
2014-03-09cli: refactor reply from guessingJani Nikula
The guess_from_received_header() function had grown quite big. Chop it up into smaller functions. No functional changes.
2014-01-18cli: clean up exit status code returned by the cli commandsJani Nikula
Apart from the status codes for format mismatches, the non-zero exit status codes have been arbitrary. Make the cli consistently return either EXIT_SUCCESS or EXIT_FAILURE.
2013-08-27cli: add --include-html option to notmuch showJohn Lenz
For my client, the largest bottleneck for displaying large threads is exporting each html part individually since by default notmuch will not show the json parts. For large threads there can be quite a few parts and each must be exported and decoded one by one. Also, I then have to deal with all the crazy charsets which I can do through a library but is a pain. Therefore, this patch adds an --include-html option that causes the text/html parts to be included as part of the output of show. diff man/man1/notmuch-show.1
2013-08-17reply: Use RFC 2822/MIME wholly for text format templateAustin Clements
Previously, reply's default text format used an odd mix of RFC 2045 MIME encoding for the reply template's body and some made-up RFC 2822-like UTF-8 format for the headers. The intent was to present the headers to the user in a nice, un-encoded format, but this assumed that whatever ultimately sent the email would RFC 2047-encode the headers, while at the same time the body was already RFC 2045 encoded, so it assumed that whatever sent the email would *not* re-encode the body. This can be fixed by either producing a fully decoded UTF-8 reply template, or a fully encoded MIME-compliant RFC 2822 message. This patch does the latter because it is a) Well-defined by RFC 2822 and MIME (while any UTF-8 format would be ad hoc). b) Ready to be piped to sendmail. The point of the text format is to be minimal, so a user should be able to pop up the template in whatever editor they want, edit it, and push it to sendmail. c) Consistent with frontend capabilities. If a frontend has the smarts to RFC 2047 encode the headers before sending the mail, it probably has the smarts to RFC 2047 decode them before presenting the template to a user for editing. Also, as far as I know, nothing automated consumes the reply text format, so changing this should not cause serious problems. (And if anything does still consume this format, it probably gets these encoding issues wrong anyway.)
2013-08-17reply: Remove extraneous space from generated ReferencesAustin Clements
Previously, the References header code seemed to assume notmuch_message_get_header would return NULL if the header was not present, but it actually returns "". As a result of this, it was inserting an unnecessary space when concatenating an empty or missing original references header with the new reference. This shows up in only two tests because the text reply format later passes the whole reply template through g_mime_filter_headers, which has the side effect of stripping out this extra space.
2013-08-13reply: Document the reason for g_mime_filter_headersAustin Clements
Given how long it took me to figure out why we pass the reply headers through g_mime_filter_headers, it's worth a comment.
2013-03-08cli: move config open/close to main() from subcommandsJani Nikula
This allows specifying config file as a top level argument to notmuch, and generally makes it possible to override config file options in main(), without having to touch the subcommands. If the config file does not exist, one will be created for the notmuch main command and setup and help subcommands. Help is special in this regard; the config is created just to avoid errors about missing config, but it will not be saved. This also makes notmuch config the talloc context for subcommands.
2013-03-07cli: config: make notmuch_config_open() "is new" parameter input onlyJani Nikula
We now have a notmuch_config_is_new() function to query whether a config was created or not. Change the notmuch_config_open() is_new parameter into boolean create_new to determine whether the function should create a new config if one doesn't exist. This reduces the complexity of the API.
2012-12-16reply: Support --format-versionAustin Clements
2012-12-08Use the S-Expression structured printer in notmuch-show, notmuch-reply and notmuch-search.Peter Feigl
This patch uses the new S-Expression printer in the notmuch CLI (show, search and reply). You can now use --format=sexp for any of them.
2012-12-08Rename the -json printer functions in notmuch-reply and notmuch-show to generic -sprinter functions.Peter Feigl
All the structured output functions in notmuch-reply and notmuch-show are renamed to a generic name (as they do not contain any json-specific code anyway). This patch is a preparation to actually using the new S-Expression sprinter in notmuch-reply and notmuch-show.
2012-08-12reply: Convert JSON format to use sprinterAustin Clements
Almost all of reply was already being formatted using the sprinter. This patch converts the top-level dictionary to use the sprinter interface.
2012-08-03show: Convert format_headers_json to use sprinterAustin Clements
This no longer requires a talloc context (not that it really did before since it didn't return anything), so we remove its context argument.
2012-08-03show: Feed the sprinter down to part formattersAustin Clements
There are several levels of function calls between where we create the sprinter and the call to the part formatter in show_message. This feeds the sprinter through all of them and into the part formatters.
2012-08-03reply: Create a JSON sprinterAustin Clements
2012-07-24cli: add --body=true|false option to notmuch-show.cMark Walters
This option allows the caller to suppress the output of the bodies of the messages. Currently this is only implemented for format=json. This is used by notmuch-pick.el (although not needed) because it gives a speed-up of at least a factor of a two (and in some cases a speed up of more than a factor of 8); moreover it reduces the memory usage in emacs hugely.
2012-06-10cli: use new notmuch_crypto_get_context in mime-node.cJameson Graef Rollins
This has the affect of lazily creating the crypto contexts only when needed. This removes code duplication from notmuch-show and notmuch-reply, and should speed up these functions considerably if the crypto flags are provided but the messages don't have any cryptographic parts.
2012-06-10cli: new crypto verify flag to handle verificationJameson Graef Rollins
Use this flag rather than depend on the existence of an initialized gpgctx, to determine whether we should verify a multipart/signed. We will be moving to create the ctx lazily, so we don't want to depend on it being previously initialized if it's not needed.
2012-06-10cli: modify mime_node_open to take new crypto struct as argumentJameson Graef Rollins
This simplifies the interface considerably.
2012-06-10cli: modify show and reply to use new crypto structJameson Graef Rollins
notmuch_show_params_t is modified to use the new notmuch_crypto_t, and notmuch-show and notmuch-reply are modified accordingly.
2012-05-24cli: also use Delivered-To header to figure out the reply from addressJani Nikula
Add another fallback header Delivered-To for guessing the user's from address for notmuch reply before using the Received headers. Apparently some MTAs use Delivered-To instead of X-Original-To (which already exists as a fallback). Reported-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Signed-off-by: Jani Nikula <jani@nikula.org>
2012-05-23cli: clean up user address matching code in guess_from_received_header()Jani Nikula
Get rid of user address matching code duplication in guess_from_received_header() by using the new address matching helpers. No functional changes. Signed-off-by: Jani Nikula <jani@nikula.org>
2012-05-23cli: add user address matching helpers for notmuch replyJani Nikula
Add a multi-purpose address_match() function for matching strings against user's configured primary and other email addresses. Add thin wrappers user_address_in_string() and string_in_user_address() for ease of use, and also convert existing address_is_users() to wrapper for the same. No functional changes. Signed-off-by: Jani Nikula <jani@nikula.org>
2012-05-05lib/cli: Make notmuch_database_open return a status codeAustin Clements
It has been a long-standing issue that notmuch_database_open doesn't return any indication of why it failed. This patch changes its prototype to return a notmuch_status_t and set an out-argument to the database itself, like other functions that return both a status and an object. In the interest of atomicity, this also updates every use in the CLI so that notmuch still compiles. Since this patch does not update the bindings, the Python bindings test fails.
2012-04-28Use notmuch_database_destroy instead of notmuch_database_closeJustus Winter
Adapt the notmuch binaries source to the notmuch_database_close split. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>