aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch.c
Commit message (Collapse)AuthorAge
* cli: fix notmuch help additional topicsGravatar Jani Nikula2014-03-27
| | | | The help for hooks was missing.
* cli: close config and do talloc report also on errorsGravatar Jani Nikula2014-01-18
| | | | Seems like the sensible thing to do.
* 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: Separate current and deprecated format versionGravatar Austin Clements2013-11-08
| | | | | | | | | | | Previously, the CLI would print a deprecation warning if a client requested any format version other than the current one. However, if we add fields that are backwards-compatible, but want clients to be able to depend on, we need to bump the version, but that doesn't make the older version deprecated. Hence, separate out the "minimum active" version and only print a warning for requests below this version number.
* notmuch-compact: Initial commit of CLIGravatar Ben Gamari2013-10-09
| | | | | | Introduce the user command exposing the new compaction facility. Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
* lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to g_mime_init()Gravatar Jani Nikula2013-09-14
| | | | | | | | | | | | | | As explained by Jeffrey Stedfast, the author of GMime, quoted in [1]: > Passing the GMIME_ENABLE_RFC2047_WORKAROUNDS flag to g_mime_init() > *should* solve the decoding problem mentioned in the thread. This > flag should be safe to pass into g_mime_init() without any bad side > effects and my unit tests do test that code-path. The thread being referred to is [2]. [1] id:87bo56viyo.fsf@nikula.org [2] id:08cb1dcd-c5db-4e33-8b09-7730cb3d59a2@gmail.com
* cli: add insert commandGravatar Peter Wang2013-06-29
| | | | | | | | | | | | The notmuch insert command reads a message from standard input, writes it to a Maildir folder, and then incorporates the message into the notmuch database. Essentially it moves the functionality of notmuch-deliver into notmuch. Though it could be used as an alternative to notmuch new, the reason I want this is to allow my notmuch frontend to add postponed or sent messages to the mail store and notmuch database, without resorting to another tool (e.g. notmuch-deliver) nor directly modifying the maildir.
* revert: Removed top level --stderr= optionGravatar Tomi Ollila2013-06-24
| | | | | | | While looked good on paper, its attempted use caused confusion, complexity, and potential for information leak when passed through wrapper scripts. For slimmer code and to lessen demand for maintenance/support the set of commits which added top level --stderr= option is now reverted.
* cli: Guard deprecated g_type_init callsGravatar Tomi Ollila2013-06-08
| | | | | | | g_type_init was deprecated in GLib 2.35.1. In order to compile cleanly, guard these with a suitable #if. (commit msg from https://bugs.freedesktop.org/attachment.cgi?id=73774 )
* cli: remove unused argument descriptionsGravatar Jani Nikula2013-05-31
| | | | | Clean up leftovers from help system rework. These are no longer needed. They are easy to resurrect and update if a need later arises.
* cli: add global option --stderr=FILEGravatar Tomi Ollila2013-05-29
| | | | | | | With this option all writes to stderr are redirected to the specified FILE (or to stdout on case FILE is '-'). This is immediately useful in emacs interface as some of its exec intefaces do not provide separation of stdout and stderr.
* cli: add top level --config=FILE optionGravatar Jani Nikula2013-03-08
| | | | Let the user specify the config file on the command line.
* 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.
* cli: plug main notmuch command into subcommand machineryGravatar Jani Nikula2013-03-07
| | | | | | This allows top level arguments to be added to notmuch in a way that doesn't require special handling for the plain notmuch command without a subcommand.
* cli: abstract subcommand finding into a new functionGravatar Jani Nikula2013-03-07
| | | | Clean up code.
* CLI: add simple error handling for talloc loggingGravatar David Bremner2013-02-08
| | | | | | This really should have been there before. I think it's better to do the actual operation and then possibly fail writing the memory log, but it would not be too hard to change it to abort earlier.
* CLI: convert top level argument parsing to use command-line-argumentsGravatar David Bremner2013-01-22
| | | | | This isn't really a win for conciseness yet, but will make it easier to add options.
* CLI: remove alias machinery, and "part", "search-tags" commandsGravatar David Bremner2013-01-22
| | | | | | The commands are long deprecated, so removal is probably overdue. The real motivation is to simplify argument handling for notmuch so that we can migrate to the common argument parsing framework.
* CLI: add talloc leak report, controlled by an environment variable.Gravatar David Bremner2012-12-30
| | | | | | | The argument handling in notmuch.c seems due for an overhaul, but until then use an environment variable to specify a location to write the talloc leak report to. This is only enabled for the (interesting) case where some notmuch subcommand is invoked.
* cli: Framework for structured output versioningGravatar Austin Clements2012-12-16
| | | | | | | | | | | | | | | | | | | | | Currently there is a period of pain whenever we make backward-incompatible changes to the structured output format, which discourages not only backward-incompatible improvements to the format, but also backwards-compatible additions that may not be "perfect". In the end, these problems limit experimentation and innovation. This series of patches introduces a way for CLI callers to request a specific format version on the command line and to determine if the CLI does not supported the requested version (and perhaps present a useful diagnostic to the user). Since the caller requests a format version, it's also possible for the CLI to support multiple incompatible versions simultaneously, unlike the alternate approach of including version information in the output. This patch lays the groundwork by introducing a versioning convention, standard exit codes, and a utility function to check the requested version and produce standardized diagnostic messages and exit statuses.
* cli: fix notmuch top level argument parsingGravatar Jani Nikula2012-12-04
| | | | | Use strcmp instead of STRNCMP_LITERAL, which matches the prefix instead of the whole argument.
* notmuch: replace built-in help with exec of manGravatar David Bremner2011-12-31
| | | | | | | | | | | "notmuch help" now relies on a working man installation, and a correct setting of MANPATH, for users that install in "unusual" places. This should probably noted in NEWS before shipping. There is still some small duplication of docs as the one line summaries are hard coded in the binary. This seems preferable to complicated script games, at least as long was we are using a presentation level markup like nroff.
* cli: add support for pre and post notmuch new hooksGravatar Jani Nikula2011-12-11
| | | | | | | | | | | | | | Run notmuch new pre and post hooks, named "pre-new" and "post-new", if present in the notmuch hooks directory. The hooks will be run before and after incorporating new messages to the database. Typical use cases for pre-new and post-new hooks are fetching or delivering new mail to the maildir, and custom tagging of the mail incorporated to the database. Also add command line option --no-hooks to notmuch new to bypass the hooks. Signed-off-by: Jani Nikula <jani@nikula.org>
* CLI: update call to notmuch_help_command for new calling conventions.Gravatar David Bremner2011-11-25
| | | | | | | | | When I changed the calling convention to pass in all but the zero-th argument to subcommands, I missed this one call, resulting in a segmentation fault. As a bonus, the syntax "notmuch --help foo" is now equivalent to "notmuch help foo".
* cli: add support for --output parameter in notmuch countGravatar Jani Nikula2011-11-15
| | | | | | | Add support for --output=messages (which remains the default) and --output=threads to notmuch count. Signed-off-by: Jani Nikula <jani@nikula.org>
* cli: add options --offset and --limit to notmuch searchGravatar Jani Nikula2011-11-15
| | | | | | | | | | | | | | | Add options --offset=[-]N and --limit=M to notmuch search to determine the first result and maximum number of results to display. Option --limit=M limits the maximum number of results to display to M. Option --offset=[-]N skips the first N results; with the leading '-' skip until the Nth result from the end. Note that --offset with a negative N for thread or summary output requires counting the number of matching threads in advance. Signed-off-by: Jani Nikula <jani@nikula.org>
* docs: Update news, man page, and online help for restore --accumulateGravatar David Bremner2011-10-23
| | | | | | As a side effect, reformat the NEWs entry for notmuch dump for consistency with the notmuch restore NEWS submitted by Thomas Schwinge.
* 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].
* docs: Update man page, NEWS and online help for new dump arguments.Gravatar David Bremner2011-10-16
| | | | | We mention in all three places that using the filename argument is deprecated.
* Add missing call to g_type_init()Gravatar Aaron Ecay2011-09-10
| | | | | | | | | The Glib docs state "Prior to any use of the type system, g_type_init() has to be called".[1] To not do so can lead to segfaults. The g_type system is currently used by various "filters" that operate on uuencoded text, message headers, etc. [1] http://developer.gnome.org/gobject/2.28/gobject-Type-Information.html#g-type-init
* fix sum moar typos [user-visible documentation in code]Gravatar Pieter Praet2011-06-23
| | | | | | | | | | | | Various typo fixes in documentation within the code that can be made available to the user, (emacs function help strings, "notmuch help" output, notmuch man page, etc.). Signed-off-by: Pieter Praet <pieter@praet.org> Edited-by: Carl Worth <cworth@cworth.org> Restricted to just documentation and fixed fix of "comman" to "common" rather than "command".
* 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.
* Add signature verification of PGP/MIME-signed parts with --verify.Gravatar 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.
* notmuch: Implement search-tags as an alias for "search --output=tags *"Gravatar Carl Worth2011-05-24
| | | | | | | | | | | Ever since we added support for "notmuch search --output=tags" the "notmuch search-tags" command has been redundant. The recent addition of alias support makes it easy to drop the explicit search-tags command in favor of a simple alias that runs "notmuch search --output=tags *". So there's no longer any documentation of the search-tags command, but existing scripts will not break at all.
* notmuch show: Update documentation for default --format=raw for --partGravatar Carl Worth2011-05-24
| | | | | | | | We recently made the --part option to "notmuch show" trigger a default format of "raw", (since the previous default of "text" is not often useful with a single part---especially a non-text part). Here, we update the documentation to match.
* notmuch: Support "notmuch part" as an alias for "notmuch show --format=raw"Gravatar Carl Worth2011-05-24
| | | | | | | | | | We unifed the "notmuch part" functionality into "notmuch show" where the implementation is both simpler and more powerful. But there's no good reason to break users of the old interface. Add support for aliases, which are undocumented means of getting at functionality through deprecated names. The first such alias is "notmuch part" as implemented here.
* New part output handling as option to notmuch-show.Gravatar 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.
* notmuch show: Properly nest MIME parts within mulipart partsGravatar Carl 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 search: Clean up some memory leaks during search loop.Gravatar Carl Worth2011-01-26
| | | | | | | | | | With talloc, we were already freeing all memory by the time we exited the loop, but that didn't help with excess use of memory inside the loop, (which was mostly from tallocing some objects with the incorrect parent). Thanks to Andrew Tridgell for sitting next to me and teaching me to use talloc_report_full to find these leaks.
* Add documentation for the recently added folder-based searching.Gravatar Carl Worth2011-01-15
| | | | Augmenting both the builtin help as well as the manual page.
* Rename "notmuch cat" to "notmuch show --format=raw"Gravatar Carl Worth2010-11-06
| | | | | | | | | This is part of an effort to avoid proliferation of excessive top-level notmuch commands. Also, "raw" better captures the functionality here, (as opposed to "cat" which is a fairly oblique reference to a bad Unix abbreviation whose metaphor doesn't work here since "notmuch cat" operates only on a single message and hence cannot "con'cat'enate" anything).
* Add 'cat' subcommandGravatar Michal Sojka2010-11-05
| | | | | | | | | | | | This command outputs a raw message matched by search term to the standard output. It allows MUAs to access the messages for piping, attachment manipulation, etc. by running notmuch cat rather then directly access the file. This will simplify the MUAs when they need to operate on a remote database. Edited-by: Carl Worth <cworth@cworth.org>: Remove trailing whitespace, add missing "test_done" to new test script to avoid "Unexpected exit" error.
* documentation: Add the "files" option to the synopsis of "search --output="Gravatar Carl Worth2010-10-28
| | | | | This was inadvertently left off when --output=files was recently added as a new option.
* notmuch search: Add a new "notmuch search --output=files"Gravatar Carl Worth2010-10-28
| | | | Yet another thing that will be extremely handy for scripts.
* notmuch search: Add a new --output=(summary|threads|messages|tags) option.Gravatar Carl Worth2010-10-28
| | | | | This can be handy for scripts which need to extract just a thread ID from a search term, for example.
* notmuch config: Allow for new "notmuch config set" in addition to getGravatar Carl Worth2010-10-27
| | | | | | It is now possible to set configuration items from the command-line in a manner quite similar to the support for querying configuration items.
* notmuch: Add a new "notmuch config" command for querying configuration.Gravatar Carl Worth2010-10-27
| | | | | So far, we implement only "notmuch config get". It won't be too much work from here to also implement "notmuch config set".
* notmuch show: Add documentation of --format=mboxGravatar Carl Worth2010-09-16
| | | | | Shame on me for adding a feature without documenting it at the same time.
* Fix help message for "show"Gravatar Jameson Rollins2010-04-21
| | | | | Help message for "show" mistakenly refers to '--output' instead of '--format'.