aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-reply.c
Commit message (Collapse)AuthorAge
* cli: sanitize the received header before scanning for repliesGravatar Jani Nikula2014-03-25
| | | | | This makes the from guessing agnostic to header folding by spaces or tabs.
* cli: refactor reply from guessingGravatar Jani Nikula2014-03-09
| | | | | | | The guess_from_received_header() function had grown quite big. Chop it up into smaller functions. No functional changes.
* cli: clean up exit status code returned by the cli commandsGravatar Jani Nikula2014-01-18
| | | | | | 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.
* cli: add --include-html option to notmuch showGravatar John Lenz2013-08-27
| | | | | | | | | | | | | | 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
* reply: Use RFC 2822/MIME wholly for text format templateGravatar Austin Clements2013-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* reply: Remove extraneous space from generated ReferencesGravatar Austin Clements2013-08-17
| | | | | | | | | | | | 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.
* reply: Document the reason for g_mime_filter_headersGravatar Austin Clements2013-08-13
| | | | | 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.
* cli: move config open/close to main() from subcommandsGravatar Jani Nikula2013-03-08
| | | | | | | | | | | | | 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.
* cli: config: make notmuch_config_open() "is new" parameter input onlyGravatar Jani Nikula2013-03-07
| | | | | | | | 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.
* reply: Support --format-versionGravatar Austin Clements2012-12-16
|
* Use the S-Expression structured printer in notmuch-show, notmuch-reply and ↵Gravatar Peter Feigl2012-12-08
| | | | | | | notmuch-search. 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.
* Rename the -json printer functions in notmuch-reply and notmuch-show to ↵Gravatar Peter Feigl2012-12-08
| | | | | | | | | generic -sprinter functions. 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.
* reply: Convert JSON format to use sprinterGravatar Austin Clements2012-08-12
| | | | | | Almost all of reply was already being formatted using the sprinter. This patch converts the top-level dictionary to use the sprinter interface.
* show: Convert format_headers_json to use sprinterGravatar Austin Clements2012-08-03
| | | | | | 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.
* show: Feed the sprinter down to part formattersGravatar Austin Clements2012-08-03
| | | | | | 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.
* reply: Create a JSON sprinterGravatar Austin Clements2012-08-03
|
* cli: add --body=true|false option to notmuch-show.cGravatar Mark Walters2012-07-24
| | | | | | | | | | 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.
* cli: use new notmuch_crypto_get_context in mime-node.cGravatar Jameson Graef Rollins2012-06-10
| | | | | | | | 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.
* cli: new crypto verify flag to handle verificationGravatar Jameson Graef Rollins2012-06-10
| | | | | | | 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.
* cli: modify mime_node_open to take new crypto struct as argumentGravatar Jameson Graef Rollins2012-06-10
| | | | This simplifies the interface considerably.
* cli: modify show and reply to use new crypto structGravatar Jameson Graef Rollins2012-06-10
| | | | | notmuch_show_params_t is modified to use the new notmuch_crypto_t, and notmuch-show and notmuch-reply are modified accordingly.
* cli: also use Delivered-To header to figure out the reply from addressGravatar Jani Nikula2012-05-24
| | | | | | | | | | 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>
* cli: clean up user address matching code in guess_from_received_header()Gravatar Jani Nikula2012-05-23
| | | | | | | | | | 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>
* cli: add user address matching helpers for notmuch replyGravatar Jani Nikula2012-05-23
| | | | | | | | | | | | 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>
* lib/cli: Make notmuch_database_open return a status codeGravatar Austin Clements2012-05-05
| | | | | | | | | | | | 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.
* Use notmuch_database_destroy instead of notmuch_database_closeGravatar Justus Winter2012-04-28
| | | | | | Adapt the notmuch binaries source to the notmuch_database_close split. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* reply: Move reply citation printing to the recursive MIME walkGravatar Austin Clements2012-03-31
| | | | | | | | | This makes more logical sense, since it makes the recursive printer responsible for the entire reply body and lets it start at the root of the MIME tree instead of the first child. (We could move reply header creation in there, too, but if we ever support proper reply to multiple messages, we'll want just one set of reply headers computed from the entire message set and many bodies.)
* reply: Convert default reply format to self-recursive styleGravatar Austin Clements2012-03-31
| | | | | This re-arranges the default reply formatter code to use the mime_node_t abstraction. There are no semantic changes.
* show/reply: Unify the code that extracts text partsGravatar Austin Clements2012-03-31
| | | | | | | | | Previously, show and reply had separate implementations of decoding and printing text parts. Now both use show's implementation, which was more complete. Show's implementation has been extended with an option to add reply quoting to the extracted part (this is implemented as a named flag to avoid naked booleans, even though it's the only flag it can take).
* reply: Add a JSON reply format.Gravatar Adam Wolfe Gordon2012-03-19
| | | | | | | | This new JSON format for replies includes headers generated for a reply message as well as the headers of the original message. Using this data, a client can intelligently create a reply. For example, the emacs client will be able to create replies with quoted HTML parts by parsing the HTML parts.
* reply: Factor out reply creationGravatar Adam Wolfe Gordon2012-03-19
| | | | | Factor out the creation of a reply message based on an original message so it can be shared by different reply formats.
* cli: use notmuch_bool_t for boolean fields in notmuch_show_params_tGravatar Jani Nikula2012-02-12
| | | | | | | Use notmuch_bool_t instead of int for entire_thread, raw, and decrypt boolean fields in notmuch_show_params_t. No functional changes. Signed-off-by: Jani Nikula <jani@nikula.org>
* show: Introduce mime_node formatter callbackGravatar Austin Clements2012-01-25
| | | | | | | | | This callback is the gateway to the new mime_node_t-based formatters. This maintains backwards compatibility so the formatters can be transitioned one at a time. Once all formatters are converted, the formatter structure can be reduced to only message_set_{start,sep,end} and part, most of show_message can be deleted, and all of show-message.c can be deleted.
* Add compatibility with gmime 2.6Gravatar Thomas Jost2012-01-21
| | | | | | | | | | | | | | There are lots of API changes in gmime 2.6 crypto handling. By adding preprocessor directives, it is however possible to add gmime 2.6 compatibility while preserving compatibility with gmime 2.4 too. This is mostly based on id:"8762i8hrb9.fsf@bookbinder.fernseed.info". This was tested against both gmime 2.6.4 and 2.4.31. With gmime 2.4.31, the crypto tests all work fine (as expected). With gmime 2.6.4, one crypto test is currently broken (signature verification with signer key unavailable), most likely because of a bug in gmime which will hopefully be fixed in a future version.
* cli: pick the user's address in a group list as from addressGravatar Jani Nikula2012-01-16
| | | | | | | Messages received to a group list were not replied to using the from address in the list. Fix it. Signed-off-by: Jani Nikula <jani@nikula.org>
* cli: add support for replying just to the sender in "notmuch reply"Gravatar Jani Nikula2012-01-14
| | | | | | | | | | | | Add new option --reply-to=(all|sender) to "notmuch reply" to select whether to reply to all (sender and all recipients), or just sender. Reply to all remains the default. Credits to Mark Walters <markwalters1009@gmail.com> for his similar earlier work where I picked up the basic idea of handling reply-to-sender in add_recipients_from_message(). All bugs are mine, though. Signed-off-by: Jani Nikula <jani@nikula.org>
* cli: slightly refactor "notmuch reply" address scanning functionsGravatar Jani Nikula2012-01-14
| | | | | | | | | | | | Slightly refactor "notmuch reply" recipient and user from address scanning functions in preparation for reply-to-sender feature. Add support for not adding recipients at all (just scan for user from address), and returning the number of recipients added. No externally visible functional changes. Signed-off-by: Jani Nikula <jani@nikula.org>
* cli: convert "notmuch reply" to use the new argument parserGravatar Jani Nikula2012-01-09
| | | | | | | Use the new notmuch argument parser to handle arguments in "notmuch reply". There should be no functional changes. Signed-off-by: Jani Nikula <jani@nikula.org>
* cli: fix use of uninitialized variable in "notmuch reply"Gravatar Jani Nikula2012-01-09
| | | | | | | | | | | notmuch_show_params_t params is only initialized partially in notmuch_reply_command(). The only field that is used uninitialized is params.decrypt. It is usually non-zero, making "notmuch reply" on encrypted messages work by coincidence. Initialize params properly, and set params.decrypt as needed. Signed-off-by: Jani Nikula <jani@nikula.org>
* show: Pass notmuch_message_t instead of path to show_message_body.Gravatar Austin Clements2011-12-25
| | | | | In addition to simplifying the code, we'll need the notmuch_message_t* in show_message_body shortly.
* cli: change argument parsing convention for subcommandsGravatar David Bremner2011-10-22
| | | | | | | | | previously we deleted the subcommand name from argv before passing to the subcommand. In this version, the deletion is done in the actual subcommands. Although this causes some duplication of code, it allows us to be more flexible about how we parse command line arguments in the subcommand, including possibly using off-the-shelf routines like getopt_long that expect the name of the command in argv[0].
* Ignore "application/pgp-*" parts in reply.Gravatar Jameson Graef Rollins2011-10-06
| | | | | The quoted text doesn't need to mention that the message being replied to had these crufty parts.
* Fix notmuch-reply to not output "Non-text part:" lines for non-leafnode parts.Gravatar Jameson Graef Rollins2011-10-06
| | | | These lines are just cruft in this case, and can be removed.
* Improve handling of message/rfc822 parts by adding a new header_message_part ↵Gravatar Jameson Graef Rollins2011-09-05
| | | | | | | | | function to the formating structure. This new function takes a GMimeMessage as input, and outputs the formatted headers. This allows for message/rfc822 parts to be formatted on output in a similar way to full messages (see previous patch that overhauls the multipart test for more info).
* fix sum moar typos [comments in source code]Gravatar Pieter Praet2011-06-23
| | | | | | | | | | Various typo fixes in comments within the source code. Signed-off-by: Pieter Praet <pieter@praet.org> Edited-by: Carl Worth <cworth@cworth.org> Restricted to just source-code comments, (and fixed fix of "descriptios" to "descriptors" rather than "descriptions").
* Fix indentation in guess_from_received_header().Gravatar Dmitry Kurochkin2011-06-15
|
* Fix memory leak in guess_from_received_header().Gravatar Dmitry Kurochkin2011-06-15
| | | | Mta variable was not free()d in one case.
* Fix double free in guess_from_received_header().Gravatar Dmitry Kurochkin2011-06-15
| | | | | | Before the change, the last loop in guess_from_received_header() did not reset domain and tld variables to NULL. This leads to double free error in some cases and possibly other bugs.
* Use stock GMimeSession by defaultGravatar Daniel Kahn Gillmor2011-06-03
| | | | | | | | | | | | 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.
* Add decryption of PGP/MIME-encrypted parts with --decrypt.Gravatar Jameson Graef Rollins2011-05-27
| | | | | | | | | | | | | 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.