Commit graph

22 commits

Author SHA1 Message Date
Carl Worth
0e72d6a9ec notmuch_database_create: Document idea to (optionally) return a status
The current problem is that when this function fails the caller
doesn't get any information about what the particular failure
was, (something in the filesystem? or in Xapian?). We should fix
that.
2009-10-24 22:14:31 -07:00
Carl Worth
fd11c8e150 Re-order documentation a bit.
The notmuch_database_get_default_path function is unique in not
accepting a notmuch_database_t* (nor creating one). So list it
outside the other notmuch_database functions.
2009-10-23 15:17:16 -07:00
Carl Worth
03c40c2bb0 notmuch_message_get_filename: Improve documentation.
Fix a typo, and add clarifications about the lifetime and readonly
nature of the return value.
2009-10-23 15:12:03 -07:00
Carl Worth
b3cbcea8fd Add NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID
And document that notmuch_database_add_message can return this
value. This pushes the hard decision of what to do with duplicate
messages out to the user, but that's OK. (We weren't really doing
anything with these ourselves, and this way the user is at least
informed of the issue, rather than it just getting papered over
internally.)
2009-10-23 14:40:33 -07:00
Carl Worth
edd37e68a9 Clean up comments to not include spaces before tabs.
This were just unclean, (an invisble sort of uncleanliness, but still
there are liable to make for ugly diffs). Oh, wait, like this one!
But at least it's not sprinkled among code changes.
2009-10-23 14:37:09 -07:00
Carl Worth
5ebb21600e Clarify documentation and error string for NOTMUCH_STATUS_TAG_TOO_LONG
It's helpful to point out NOTMUCH_STATUS_TAG_MAX for users.
2009-10-23 14:36:38 -07:00
Carl Worth
68a10091d6 Add notmuch_database_set_timestamp and notmuch_database_get_timestamp
These will be very helpful to implement an efficient "notmuch new"
command which imports new mail messages that have appeared.
2009-10-23 14:31:01 -07:00
Carl Worth
ce5d782962 Fix notmuch_message_get_message_id to never return NULL.
With the recent improvements to the handling of message IDs we
"know" that a NULL message ID is impossible, (so we simply
abort if the impossible happens).
2009-10-23 06:04:57 -07:00
Carl Worth
868d3b3068 Add notmuch_message_get_filename
This is a new public function to find the filename of the original
email message for a message-object that was found in the database.

We may change this function in the future to support returning a
list of filenames, (for messages with duplicate message IDs).
2009-10-23 05:48:46 -07:00
Carl Worth
6a4992bc61 Generate message ID (using SHA1) when a mail message contains none.
This is important as we're using the message ID as the unique key
in our database. So previously, all messages with no message ID
would be treated as the same message---not good at all.
2009-10-22 15:31:56 -07:00
Carl Worth
302d54834d Add notmuch_status_to_string function.
Be kind and let the user print error messages, not just error
codes.
2009-10-21 16:12:53 -07:00
Carl Worth
defd216487 Add notmuch_message_add_tag and notmuch_message_remove_tag
With these two added, we now have enough functionality in the
library to implement "notmuch restore".
2009-10-21 15:56:33 -07:00
Carl Worth
a6b3f341dc notmuch_query_search: Clarify the documentation.
This is where we wanted to put the note to recommend the user
call notmuch_message_destroy if the lifetime of the message
is much shorter than the lifetime of the query. (Somehow this
had ended up in the documentation of notmuch_message_get_tags
before.)
2009-10-21 15:46:46 -07:00
Carl Worth
0383ae2a07 notmuch.h: Fix some copy-paste errors in the documentaton.
In several places we had "results" where "tags" was intended.
It actually read fine in some cases, but this is still better.
2009-10-21 15:45:34 -07:00
Carl Worth
6c5054ebee database: Add new notmuch_database_find_message
With this function, and the recently added support for
notmuch_message_get_thread_ids, we now recode the find_thread_ids
function to work just the way we expect a user of the public
notmuch API to work. Not too bad really.
2009-10-21 15:40:20 -07:00
Carl Worth
8ad4350fef Add notmuch_message_get_thread_ids function
Along with all of the notmuch_thread_ids_t iterator functions.
Using a consistent idiom seems better here rather than returning
a comma-separated string and forcing the user to parse it.
2009-10-21 15:23:08 -07:00
Carl Worth
6519aff957 query: Remove the magic NOTMUCH_QUERY_ALL
Using the address of a static char* was clever, but really
unnecessary. An empty string is much less magic, and even
easier to understand as the way to query everything from
the database.
2009-10-20 22:40:37 -07:00
Carl Worth
4ca1492f1b Add destroy functions for results, message, and tags.
None of these are strictly necessary, (everything was leak-free
without them), but notmuch_message_destroy can actually be useful
for when one query has many message results, but only one is needed
to be live at a time.

The destroy functions for results and tags are fairly gratuitous, as
there's unlikely to be any benefit from calling them. But they're all
easy to add, (all of these functions are just wrappers for talloc_free),
and we do so for consistency and completeness.
2009-10-20 22:24:59 -07:00
Carl Worth
466a7bbf62 Implement 'notmuch dump'.
This is a fairly big milestone for notmuch. It's our first command
to do anything besides building the index, so it proves we can
actually read valid results out from the index.

It also puts in place almost all of the API and infrastructure we
will need to allow searching of the database.

Finally, with this change we are now using talloc inside of notmuch
which is truly a delight to use. And now that I figured out how
to use C++ objects with talloc allocation, (it requires grotty
parts of C++ such as "placement new" and "explicit destructors"),
we are valgrind-clean for "notmuch dump", (as in "no leaks are
possible").
2009-10-20 21:21:39 -07:00
Carl Worth
55c8ee9a86 notmuch_database_create/open: Fix to handle NULL as documented.
When documenting these functions I described support for a
NOTMUCH_BASE environment variable to be consulted in the case
of a NULL path. Only, I had forgotten to actually write the
code.

This code exists now, with a new, exported function:

     notmuch_database_default_path
2009-10-20 09:58:40 -07:00
Carl Worth
ad784f38ce notmuch: Ignore files that don't look like email messages.
This is helpful for things like indexes that other mail programs
may have left around. It also means we can make the initial
instructions much easier, (the user need not worry about moving
away auxiliary files from some other email program).
2009-10-19 23:16:05 -07:00
Carl Worth
10c176ba0e notmuch: Start actually adding messages to the index.
This is the beginning of the notmuch library as well, with its
interface in notmuch.h. So far we've got create, open, close, and
add_message (all with a notmuch_database prefix).

The current add_message function has already been whittled down from
what we have in notmuch-index-message to add only references,
message-id, and thread-id to the index, (that is---just enough to do
thread-linkage but nothing for full-text searching).

The concept here is to do something quickly so that the user can get
some data into notmuch and start using it. (The most interesting stuff
is then thread-linkage and labels like inbox and unread.)  We can
defer the full-text indexing of the body of the messages for later,
(such as in the background while the user is reading mail).

The initial thread-stitching step is still slower than I would like.
We may have to stop using libgmime for this step as its overhead is
not worth it for the simple case of just parsing the message-id,
references, and in-reply-to headers.
2009-10-18 20:56:30 -07:00