aboutsummaryrefslogtreecommitdiff
path: root/notmuch-reply.c
Commit message (Collapse)AuthorAge
* show: Convert format_headers_json to use sprinterAustin 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 formattersAustin 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 sprinterAustin Clements2012-08-03
|
* cli: add --body=true|false option to notmuch-show.cMark 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.cJameson 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 verificationJameson 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 argumentJameson Graef Rollins2012-06-10
| | | | This simplifies the interface considerably.
* cli: modify show and reply to use new crypto structJameson 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 addressJani 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()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 replyJani 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 codeAustin 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_closeJustus 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 walkAustin 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 styleAustin 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 partsAustin 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.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 creationAdam 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_tJani 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 callbackAustin 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.6Thomas 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 addressJani 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"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 functionsJani 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 parserJani 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"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.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 subcommandsDavid 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.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.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 ↵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]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().Dmitry Kurochkin2011-06-15
|
* Fix memory leak in guess_from_received_header().Dmitry Kurochkin2011-06-15
| | | | Mta variable was not free()d in one case.
* Fix double free in guess_from_received_header().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 defaultDaniel 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.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.
* Add signature verification of PGP/MIME-signed parts with --verify.Jameson Graef Rollins2011-05-27
| | | | | | | | | | | | | | | | 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.
* Break up format->part function into part_start and part_content functions.Jameson Graef Rollins2011-05-27
| | | | | | | 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.
* Use empty strings instead of NULL in format_reply structure.Jameson Graef Rollins2011-05-27
| | | | | | This keeps things consistent with notmuch-show, and prevents having to check for the existence of the field pointer for simple string output formats.
* Integrate reply_part_content function into reply_part function.Jameson Graef Rollins2011-05-27
| | | | | | | | 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.
* Simplify reply_part function to eliminate redundant code paths.Jameson Graef Rollins2011-05-27
| | | | This is the same logic but with less code.
* New part output handling as option to notmuch-show.Jameson Graef Rollins2011-05-23
| | | | | | | | | 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.
* add part_sep formatter to replace "first" argument to part format functionsJameson Graef Rollins2011-05-23
| | | | | | | | 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.
* pass entire format structure to various show_message functionsJameson Graef Rollins2011-05-20
| | | | | | | | | | | | | | 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.
* notmuch show: Properly nest MIME parts within mulipart partsCarl Worth2011-05-17
| | | | | | | | | | | | | | | | | | | | | | | Previously, notmuch show flattened all output, losing information about the nesting of the MIME hierarchy. Now, the output is properly nested, (both in the --format=text and --format=json output), so that clients can analyze the original MIME structure. Internally, this required splitting the final closing delimiter out of the various show_part functions and putting it into a new show_part_end function instead. Also, the show_part function now accepts a new "first" argument that is set not only for the first MIME part of a message, but also for each first MIME part within a series of multipart parts. This "first" argument controls the omission of a preceding comma when printing a part (for json). Many thanks to David Edmondson <dme@dme.org> for originally identifying the lack of nesting in the json output and submitting an early implementation of this feature. Thanks as well to Jameson Graef Rollins <jrollins@finestructure.net> for carefully shepherding David's patches through a remarkably long review process, patiently explaining them, and providing a cleaned up series that led to this final implementation. Jameson also provided the new emacs code here.
* notmuch: Eliminate some const-correctness warnings.Carl Worth2010-10-27
| | | | | | | | These were introduced as a side-effect of commit b9eac48c22f53f84ed1d9c1d8ca862a7b638c9ac (shame on me for doing side-effect commits like that!). For me, at least, compilation is now warning-free.
* Remove bcc header from notmuch reply.Jameson Rollins2010-10-27
| | | | | | | | | | | | | Notmuch reply should not be Bcc'ing the sender by default. This is not the appropriate way to save copies of sent mail (which should probably be handled by an Fcc header[*]) and it doesn't give the user the option to not be bcc'd. This is really something that should be handled by the reader UI. For instance, emacs message-mode can easily be configured to add Bcc's if the user wishes. [*] Carl Worth: The FCC header is now in place by default in the emacs user-interface (and tested in the test suite) so the Bcc is ready to be eliminated.
* Rename already used counter var iAneesh Kumar K.V2010-04-27
| | | | | | | i is already used in a for loop at this point, so using i here again broke notmuch-reply (it would just hang). Use j instead of i here. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Rearchitect From: header guessing code for repliesDirk Hohndel2010-04-26
| | | | | | | | | | | | | | | | | | | | | We want to be able to correctly guess the best From: header to use when replying to emails. This is what we are looking at now: 1 is one of the users' mail addresses in the To: or Cc: header 2 check for an Envelope-to: header 3 check for an X-Original-To: header 4 check for a (for <email@add.res>) clause in Received: headers 5 check for the domain part of known email addresses in the 'by' part of Received headers 6 fall back to the primary email address This patch changes the algorithm for steps 2-5 of this process. Prior to this patch we had a first attempt to implement only step 5 - but this broke in many email setups where mail delivery to the local machine added additional Received: lines. Steps 2-4 are new, step 5 now analyzes the concatenated Received: header (this was in the previous patch) to do this analysis. Signed-off-by: Dirk Hohndel <hohndel@infradead.org>