aboutsummaryrefslogtreecommitdiff
path: root/notmuch-reply.c
AgeCommit message (Collapse)Author
2022-07-30CLI/reply: support --duplicate argumentDavid Bremner
We want the reply used to match that shown e.g. in the emacs interface. As a first step provide that functionality on the command line. Schema does not need updating as the duplicate key was already present (with a constant value of 1).
2022-07-30CLI/show: support --duplicate for structured outputDavid Bremner
This introduces a new mandatory key for message structures, namely "duplicate". Per convention in devel/schemata this does _not_ increase the format version. This means that clients are responsible for checking that it exists, and not crashing if it does not. The main functional change is teaching mime_node_open to understand a 'duplicate' argument. Support for --duplicate in notmuch-reply would make sense, but we defer it to a later commit.
2021-09-04CLI/{count, dump, reindex, reply, show}: enable sexp queriesDavid Bremner
The change in each case is to call notmuch_query_create_with_syntax, relying on the already inherited shared options. As a bonus we get improved error handling from the new query creation API. The remaining subcommand is 'tag', which is a bit trickier.
2021-09-04CLI: make variable n_requested_db_uuid file scope.David Bremner
It turns out that now that we pass an open database into the subcommands, it is easy to check any requested uuid against the database at the same time as we process the other shared arguments. This results in overall less boilerplate code, as well as making a CLI scope function and variable file scope in notmuch.c.
2021-08-29lib: consider all instances of Delivered-To headerHannu Hartikainen
When using notmuch-reply and guessing the From: address from Delivered-To headers, I had the wrong address chosen today. This was because the messages from the notmuch list contain these headers in this order: Delivered-To: hannu.hartikainen@gmail.com ... Delivered-To: hannu@hrtk.in In my .notmuch-config I have the following configuration: primary_email=hannu@hrtk.in other_email=hannu.hartikainen@gmail.com;... Before this change, notmuch-reply would guess From: @gmail.com because that is the first Delivered-To header present. After the change, the primary address is chosen as I would expect.
2021-04-06CLI: drop notmuch_config_t from subcommand interface.David Bremner
At this point it is unused in all subcommands.
2021-03-13cli: run uncrustifyuncrustify
This is the result of running $ uncrustify --replace --config devel/uncrustify.cfg *.c *.h in the top level source directory Line breaks were then adjusted manually to keep argc and argv together.
2021-02-06CLI/reply: convert to new config frameworkDavid Bremner
This is messier than some of the other conversions because the extensive use of 'config' as a talloc context.
2021-02-06CLI: add (unused) database argument to subcommands.David Bremner
This will allow transitioning individual subcommands to the new configuration framework. Eventually when they are all converted we can remove the notmuch_config_t * argument. For now, live with the parameter shadowing in some some subcommands; it will go away when they are converted.
2020-05-22cli/reply: Ignore PKCS#7 wrapper parts when replyingDaniel Kahn Gillmor
When composing a reply, no one wants to see this line in the proposed message: Non-text part: application/pkcs7-mime So we hide it, the same way we hide PGP/MIME cruft. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-06-14cli: run uncrustifyuncrustify
This is the result of running $ uncrustify --replace --config devel/uncrustify.cfg *.c *.h in the top level source directory
2019-05-29cli/reply: pull proposed subject line from the message, not the indexDaniel Kahn Gillmor
Protected subject lines were being emitted in reply when the cleartext of documents was indexed. create_reply_message() was pulling the subject line from the index, rather than pulling it from the GMimeMessage object that it already has on hand. This one-line fix to notmuch-reply.c solves that problem, and doesn't cause any additional tests to fail. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-29cli/show: emit payload subject instead of outside subjectDaniel Kahn Gillmor
Correctly fix the two outstanding tests so that the protected (hidden) subject is properly reported. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-03gmime-cleanup: pass NULL arguments explicitly where GMime 3.0 expects itDaniel Kahn Gillmor
Several GMime 2.6 functions sprouted a change in the argument order in GMime 3.0. We had a compatibility layer here to be able to handle compiling against both GMime 2.6 and 3.0. Now that we're using 3.0 only, rip out the compatibility layer for those functions with changed argument lists, and explicitly use the 3.0 argument lists. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-03gmime-cleanup: use GMime 3.0 function namesDaniel Kahn Gillmor
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-03gmime-cleanup: use GMime 3.0 data typesDaniel Kahn Gillmor
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-03gmime-cleanup: drop g_mime_2_6_unrefDaniel Kahn Gillmor
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-03gmime-cleanup: remove obsolete gpg_path configuration option and crypto contextsDaniel Kahn Gillmor
Note that we do keep ignoring the gpg_path configuration option, though, to avoid breakage of existing installations. It is ignored like any other unknown configuration option, but we at least document that it is ignored so that people who find it in their legacy configs can know that it's safe to drop. signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-03build: drop support for gmime-2.6David Bremner
GMime 3.0 is over 2 years old now, and 2.6 has been deprecated in notmuch for about 1.5 years. Comments and documentation no longer need to refer to GMime 2.6, so clean them all up. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-12-07reply: Include sender as recipient if they were the original recipientDavid Edmondson
When generating a reply message, if the user was the originator and only recipient of the original message, include the user as a recipient of the reply.
2017-12-29cli/reply: make --decrypt take a keywordDaniel Kahn Gillmor
This brings the --decrypt argument to "notmuch reply" into line with the other --decrypt arguments (in "show", "new", "insert", and "reindex"). This patch is really just about bringing consistency to the user interface. We also use the recommended form in the emacs MUA when replying, and update test T350 to match.
2017-12-08crypto: add --decrypt=nostash to avoid stashing session keysDaniel Kahn Gillmor
Here's the configuration choice for people who want a cleartext index, but don't want stashed session keys. Interestingly, this "nostash" decryption policy is actually the same policy that should be used by "notmuch show" and "notmuch reply", since they never modify the index or database when they are invoked with --decrypt. We take advantage of this parallel to tune the behavior of those programs so that we're not requesting session keys from GnuPG during "show" and "reply" that we would then otherwise just throw away.
2017-12-08cli/reply: use decryption policy "auto" by default.Daniel Kahn Gillmor
If the user doesn't specify --decrypt= at all, but a stashed session key is known to notmuch, when replying to an encrypted message, notmuch should just go ahead and decrypt. The user can disable this at the command line with --decrypt=false, though it's not clear why they would ever want to do that.
2017-12-08lib: convert notmuch decryption policy to an enumDaniel Kahn Gillmor
Future patches in this series will introduce new policies; this merely readies the way for them. We also convert --try-decrypt to a keyword argument instead of a boolean.
2017-10-12crypto: rename notmuch_crypto_t to _notmuch_crypto_tDaniel Kahn Gillmor
The notmuch_crypto_t struct isn't used externally, and we have no plans to explicitly export it. Prefix its name (and associated functions) with _ to make that intent clear.
2017-10-09cli: convert notmuch_bool_t to stdboolJani Nikula
C99 stdbool turned 18 this year. There really is no reason to use our own, except in the library interface for backward compatibility. Convert the cli and test binaries to stdbool.
2017-10-04cli: use designated initializers for opt descJani Nikula
Several changes at once, just to not have to change the same lines several times over: - Use designated initializers to initialize opt desc arrays. - Only initialize the needed fields. - Remove arg_id (short options) as unused. - Replace opt_type and output_var with several type safe output variables, where the output variable being non-NULL determines the type. Introduce checks to ensure only one is set. The downside is some waste of const space per argument; this could be saved by retaining opt_type and using a union, but that's still pretty verbose. - Fix some variables due to the type safety. Mostly a good thing, but leads to some enums being changed to ints. This is pedantically correct, but somewhat annoying. We could also cast, but that defeats the purpose a bit. - Terminate the opt desc arrays using {}. The output variable type safety and the ability to add new fields for just some output types or arguments are the big wins. For example, if we wanted to add a variable to set when the argument is present, we could do so for just the arguments that need it. Beauty is in the eye of the beholder, but I think this looks nice when defining the arguments, and reduces some of the verbosity we have there.
2017-08-16remove boolean "first" argument from format_part_sprinterDaniel Kahn Gillmor
This argument seems to be unused, and format_part_sprinter isn't required to meet any specific API so it seems cleaner and simpler to drop it.
2017-07-14config: deprecate/drop crypto.gpg_path under gmime 2.6/3.0Daniel Kahn Gillmor
gmime 3.0 no longer offers a means to set the path for gpg. Users can set $PATH anyway if they want to pick a differently-installed gpg (e.g. /usr/local/bin/gpg), so this isn't much of a reduction in functionality. The one main difference is for people who have tried to use "gpg2" to make use of gpg 2.1, but that isn't usefully co-installable anyway.
2017-07-14lib: paper over allocation differenceDavid Bremner
In gmime 3.0 this function is "transfer none", so no deallocation is needed (or permitted)
2017-07-14cli: replace use of g_mime_message_get_recipientsDavid Bremner
This function, and associated enum, have been renamed and generalized in gmime-3.0.
2017-07-14lib/cli: replace use of g_mime_message_get_senderDavid Bremner
This function changes semantics in gmime-3.0 so make a new function that provides the same functionality in both
2017-07-14cli: replace use of g_mime_message_get_reply_toDavid Bremner
This function changes signature in gmime 3.0, so we provide two new functions, one for each signature.
2017-07-14cli: replace use of g_mime_message_get_date_as_stringDavid Bremner
This function goes away in gmime-3.0. Also, the memory management is apparently error prone, witness the memory leak in notmuch-reply.
2017-06-25fix wrong printf formatting of signed/unsigned integersPiotr Trojanek
2017-05-30cli/reply: fix two memory leaks, document a thirdDavid Bremner
internet_address_list_to_string returns an allocated string, which needs to be freed with g_free. g_free can handle a NULL argument, so we follow the usage elsewhere of calling it unconditionally. The third leak we leave as it would require restructuring of add_recipients_from_message, and is fixed by later gmime-3.0 porting.
2017-05-30cli/reply: direct all output for text format to gmime streamDavid Bremner
Interleaving printfs with writes to the gmime stream worked when the gmime stream was backed by the FILE *stdout, but that is no longer the case. Create one stream and pass it into the two functions where needed, as well well as replacing printfs with g_mime_stream_printf.
2017-03-22lib: replace deprecated n_q_count_messages with status returning versionDavid Bremner
This function was deprecated in notmuch 0.21. We re-use the name for a status returning version, and deprecate the _st name. One or two remaining uses of the (removed) non-status returning version fixed at the same time
2017-03-22lib: replace deprecated n_q_search_messages with status returning versionDavid Bremner
This function was deprecated in notmuch 0.21. We re-use the name for a status returning version, and deprecate the _st name.
2017-03-10cli: do not initialize zero values with designated initializersJani Nikula
Let the language initialize defaults to zero when some values are initialized to non-zero values. No functional changes.
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.