aboutsummaryrefslogtreecommitdiff
path: root/notmuch-client.h
AgeCommit message (Collapse)Author
2022-11-05cli: add options --offset and --limit to notmuch showRobin Jarry
notmuch search does not output header values. However, when browsing through a large email corpus, it can be time saving to be able to paginate without running notmuch show for each message/thread. Add --offset and --limit options to notmuch show. This is inspired from commit 796b629c3b82 ("cli: add options --offset and --limit to notmuch search"). Update man page, shell completion and add a test case to ensure it works as expected. Cc: Tim Culverhouse <tim@timculverhouse.com> Cc: Tomi Ollila <tomi.ollila@iki.fi> Signed-off-by: Robin Jarry <robin@jarry.cc>
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.
2022-07-30CLI/show: initial support for --duplicate for (raw output only)David Bremner
Add command line argument --duplicate, analogous with that already supported for notmuch-search. Use of a seperate function for _get_filename is mainly a form of documentation at this point. md5sum is of course a weak hash, but it is good enough for this (non-adversarial) test suite use.
2022-01-18CLI: stash pointer to database in sprinter structsDavid Bremner
We already use an allocated (and presumably open) database as a talloc context. Keeping the pointer in the allocated struct will allow us to e.g. interrogate the configuration in a sprinter function without threading the database all the way through the various levels of function.
2021-10-23CLI: move indexopts variable out of shared options blockDavid Bremner
This reduces the amount of global state. Furthermore, index options can be set (in principle) in several ways, not just in the one function for processing indexing command line options.
2021-10-23cli: remove enum names from typedefsJani Nikula
There are some enum typedefs with the enum name: typedef enum _name_t { ... } name_t; We don't need or use the enum names _name_t for anything, and not all of the enum typedefs have them. We have the typedefs specifically to use the typedef name. Use the anonymous enum in the typedefs: typedef enum { ... } name_t;
2021-09-04CLI: move query syntax to shared optionDavid Bremner
This will allow easy addition of a query syntax option to other subcommands.
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-22CLI: define and use format version 5David Bremner
This is a bit of a cheat, since the format does not actually change. On the other hand it is fairly common to do something like this to shared libary SONAMEs when the ABI changes in some subtle way. It does rely on the format-version argument being early enough on the command line to generate a sensible error message.
2021-05-14CLI: centralize initialization in notmuch_client_initDavid Bremner
Initially make sure gmime_filter_reply initialization is thread-safe (assuming notmuch_client_init is only called once). For tidyness, also put talloc initialization in the new function.
2021-04-06CLI: rename notmuch_config_t to notmuch_conffile_tDavid Bremner
The name is a compromise between keeping function names from getting too long, and avoiding confusion with the newer notmuch_config library API. Try to make clear that the residual functionality is only about updating configuration files.
2021-04-06CLI: drop notmuch_config_t from subcommand interface.David Bremner
At this point it is unused in all subcommands.
2021-04-06CLI/config: remove calls to notmuch_config_open from top levelDavid Bremner
This will allow simplifying the subcommand interface. Change the internal API to notmuch_config_open to not tie it to the implementation of subcommands in notmuch.c. It also fixes a previously broken test, since notmuch_config_open does not understand the notion of the empty string as a config file name.
2021-03-27CLI/config: drop obsolete notmuch_config_get_*David Bremner
These are no longer used, replaced by notmuch_config_get.
2021-03-27CLI/config: migrate notmuch_config_open to new configDavid Bremner
notmuch_config_open will be preserved in the medium term for use by the commands that are manipulating the config file directly (config and setup)
2021-03-27CLI: load merged config at top levelDavid Bremner
This paves the way for the conversion of the remaining subcommands to the new configuration framework.
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: use configured hook directoryDavid Bremner
This enables support for hooks outside the database directory. It relies strongly on configuration information being usable between closing the database and destroying it.
2021-02-06cli/new: convert to new config frameworkDavid Bremner
In addition to the same type of changes as converting other subcommands, add the possibility of creating a database at the top level. It would probably make sense to use this for insert as well.
2021-02-06cli/config: add accessor for config file nameDavid Bremner
This is intended for use in temporary code transitioning to the new configuration system. The name is chosen to avoid cluttering the notmuch_config_* namespace further with non-library functions.
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.
2021-02-06CLI: generalize notmuch_config_mode_tDavid Bremner
The renaming and extra values will make sense when we start to convert subcommands to the new configuration framework. It will also avoid collisions with a new enum for configuration keys to be introduced in a future commit.
2020-04-13cli/dump: define GZPUTS and use it in notmuch-dumpDavid Bremner
Similarly to GZPRINTF, this is a drop in replacement that can be improved where needd.
2020-04-13cli/dump: define GZPRINTF macro and use it in place of gzprintfDavid Bremner
This will at least catch errors, and can be replaced with more sophisticated error handling where appropriate.
2020-04-13status: add print_status_gzbytesDavid Bremner
This is in the client code, rather than libnotmuch_util, because it prints to stderr. Also it in pretends to generate notmuch status codes.
2020-03-22mime-node: rename decrypted_child to unwrapped_childDaniel Kahn Gillmor
When walking the MIME tree, we might need to extract a new MIME object. Thus far, we've only done it when decrypting multipart/encrypted messages, but PKCS#7 (RFC 8551, S/MIME) has several other transformations that warrant a comparable form of unwrapping. Make this member re-usable for PKCS#7 unwrappings as well as multipart/encrypted decryptions. This change is just a naming change, it has no effect on function. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-09-01repair: set up codebase for repair functionalityDaniel Kahn Gillmor
This adds no functionality directly, but is a useful starting point for adding new repair functionality. 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-06-11append _unused to the expression defined using unused() macroTomi Ollila
This way if variables defined using unused() macro are actually used then code will not compile... - removed unused usage around one argc and one argv since those were used - changed one unused (char *argv[]) to unused (char **argv) to work with modified unused() macro definition
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-26cli: expose message-wide crypto status from mime-nodeDaniel Kahn Gillmor
The mime node context (a per-message context) gains a cryptographic status object, and the mime_node_t object itself can return a view on that status to an interested party. The status is not yet populated, and for now we can keep that view read-only, so that it can only be populated/modified during MIME tree traversal.
2019-05-03gmime-cleanup: drop all arguments unused in GMime 3Daniel Kahn Gillmor
This means dropping GMimeCryptoContext and notmuch_config arguments. All the argument changes are to internal functions, so this is not an API or ABI break. We also get to drop the #define for g_mime_3_unused. 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>
2018-05-26cli: add print_status_message()Daniel Kahn Gillmor
This function is a parallel to print_status_query() or print_status_database(). Thanks to David Bremner for the suggestion!
2017-12-08crypto: new decryption policy "auto"Daniel Kahn Gillmor
This new automatic decryption policy should make it possible to decrypt messages that we have stashed session keys for, without incurring a call to the user's asymmetric keys.
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-12-08indexopts: change _try_decrypt to _decrypt_policyDaniel Kahn Gillmor
This terminology makes it clearer what's going on at the API layer, and paves the way for future changesets that offer more nuanced decryption policy.
2017-10-21cli: set up shared command-line arguments for indexingDaniel Kahn Gillmor
We have an indexopts structure for manipulating indexing in different ways, but we also have three command-line invocations that can trigger indexing: new, insert, and reindex. This changeset prepares a common parser that these subcommands can share. Note: if the deprecated crypto.gpg_path configuration option is set to anything other than "gpg", we ignore it (and print a warning on stderr, if built against gmime < 3.0). At the moment, it's just --try-decrypt, but others will likely follow.
2017-10-20crypto: move into libnotmuch_utilDaniel Kahn Gillmor
This prepares us for using the crypto object in both libnotmuch and the client.
2017-10-12crypto: _notmuch_crypto_cleanup should return voidDaniel Kahn Gillmor
There's no chance that _notmuch_crypto_cleanup() will ever return anything other than 0, and no one ever checks its return value anyway. So make it return void instead of int.
2017-10-12crypto: drop pretense of notmuch_crypto_context_tDaniel Kahn Gillmor
notmuch_crypto_context_t was introduced (i think) as some sort of abstraction layer to make notmuch somewhat independent of GMime. But it isn't even useful for GMime 3.0 or later -- we can drop the pretense that it's some sort of abstraction in this case, and just call it what it is, GMimeCryptoContext, which is useful for building against older versions of GMime. This also renames _notmuch_crypto_get_context() to _notmuch_crypto_get_gmime_context().
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-08-01add "notmuch reindex" subcommandDaniel Kahn Gillmor
This new subcommand takes a set of search terms, and re-indexes the list of matching messages.
2017-07-15crypto: clean up unused definitions in gmime 3.0David Bremner
based on the same patch from dkg as the previous commit.
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-04cli: implement structured output version 4David Bremner
Since the error field is unused by the emacs front end, no changes are needed other than bumping the format version number. As it is, this is a bit overengineered, but it will reduce duplication when we support gmime 3.0
2017-05-30cli/show: use single stream for printf / gmime object outputDavid Bremner
This is again motivated by the need to transition away from GMimeStreamFile for output to stdout. format_part_mbox is left alone for now, as this cannot be mixed in with output using gmime object output.