Commit graph

19 commits

Author SHA1 Message Date
J. Lewis Muir
d08af93c65 cli: change "setup" to "set up" where used as a verb
The word "setup" is a noun, not a verb.  Change occurrences of "setup"
where used as a verb to "set up".
2015-05-31 19:14:42 +02:00
Jani Nikula
19c09d870f cli/insert: add post-insert hook
The post-new hook might no longer be needed or run very often if
notmuch insert is being used. Therefore a post-insert hook is needed
(arguably pre-insert not so much, so don't add one). Also add the
--no-hooks option to skip hooks.
2014-10-28 19:19:30 +01:00
Jani Nikula
0bb1f26a26 cli: cast timeval fields to long for format
This hides platform differences between struct timeval field types.
2014-10-28 12:12:10 +01:00
Jani Nikula
dc20a0eedc cli/insert: require succesful message indexing for success status
Add --keep option to keep any remaining stuff in index or file. We
could distinguish between failures to index and failures to apply tags
or maildir sync, but for simplicity just have one.
2014-10-18 07:54:25 +02:00
Jani Nikula
5df46a3d9e cli/insert: add fail path to add_file_to_database
Handle failures gracefully in add_file_to_database, renamed simply
add_file while at it. Add keep option to not remove the message from
database if tagging or tag syncing to maildir flags fails. Expand the
function documentation to cover the changes.
2014-10-18 07:53:15 +02:00
Jani Nikula
0d597f6889 cli/insert: rehash file writing functions
Make the function calls make more sense as independent building blocks
of the big picture, with clear inputs and outputs. Split up
write_message into two. Improve function documentation. Cleanup and
clarify the error paths.
2014-09-24 20:29:58 +02:00
Jani Nikula
dcfcb4ba7b cli/insert: abstract temporary filename generation
This will clean up the usage. There's the slight functional change of
potentially ending up doing extra gethostname and getpid calls, but
this is neglible.
2014-09-24 20:28:42 +02:00
Jani Nikula
cd3d4e62d6 cli/insert: use a single recursive mkdir function
Combine make_directory() and make_directory_and_parents() into a
single recursive mkdir_recursive() function. Clarify the code and
improve error handling. Improve error messages. Switch to using the
new function in maildir_create_folder(). Constify talloc context.
2014-09-24 20:25:48 +02:00
Jani Nikula
eab18a61a9 cli/insert: clean up sync_dir
Clarify the code slightly, improve error messages. Apart from the
error message changes, no functional changes.
2014-09-24 20:22:21 +02:00
Jani Nikula
9324e04a82 cli/insert: rename file copy function
The copying has nothing to do with stdin, so call it copy_fd
instead. While at it, improve documentation and reverse the
parameters, as destination is traditionally the first parameter.
2014-09-24 20:20:19 +02:00
Jani Nikula
c878081127 cli/insert: move add_file_to_database to a better place
Move add_file_to_database around to keep the filesystem related
functions grouped together, improving readability. No functional
changes.
2014-09-24 20:20:12 +02:00
Jani Nikula
602ac49eac cli/insert: rename check_folder_name to is_valid_folder_name
An "is something" predicate conveys the meaning better. While at it,
improve the function documentation and error message. Besides the
error message change, no functional changes.
2014-09-24 20:20:02 +02:00
Peter Wang
ee3ccccd25 cli: refactor insert
Change insert_message into write_message and move its responsibilities
for indexing the message into the main function, to simplify the control
flow.
2014-09-16 20:18:50 +02:00
Jani Nikula
e8ec38c25a cli: make sure notmuch new and insert don't add invalid tags
Check new.tags configuration values before doing anything, and bail
out on invalid values.
2014-03-06 07:42:10 -04:00
Jani Nikula
c745377306 cli: clean up exit status code returned by the cli commands
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.
2014-01-18 14:45:26 -04:00
Jani Nikula
58dfc87721 insert: respect maildir.synchronize_flags
Don't synchronize maildir flags if the user doesn't want it.
2014-01-03 07:13:00 -04:00
Peter Wang
426558d37e insert: add --create-folder option
Allow the insert command to create the maildir folder
into which the new message should be delivered.
2013-07-04 00:05:11 -03:00
Peter Wang
51590d0f27 insert: add --folder option
Allow the new message to be inserted into a folder within the Maildir
hierarchy instead of the top-level folder.
2013-07-01 12:22:48 -03:00
Peter Wang
9439a1ec0c cli: add insert command
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.
2013-06-29 14:42:20 -03:00