aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* | notmuch restore: Fix to remove all tags before adding tags.Carl Worth2009-10-26
| | | | | | | | | | | | | | | | | | | | | | | | This means that the restore operation will now properly pick up the removal of tags indicated by the tag just not being present in the dump file. We added a few new public functions in order to support this: notmuch_message_freeze notmuch_message_remove_all_tags notmuch_message_thaw
* | notmuch restore: Don't bother printing tag values.Carl Worth2009-10-26
|/ | | | | The code was just a little messy here with three parallel conditions testing for message == NULL.
* add_message: Add an optional parameter for getting the just-added message.Carl Worth2009-10-26
| | | | | We use this to implement the addition of "inbox" and "unread" tags for all messages added by "notmuch new".
* Fix incorrect name of _notmuch_thread_get_subject.Carl Worth2009-10-26
| | | | | | Somehow this naming with an underscore crept in, (but only in the private header, so notmuch.c was compiling with no prototype). Fix to be the notmuch_thread_get_subject originally intended.
* Add public notmuch_thread_get_subjectCarl Worth2009-10-26
| | | | | And use this in "notmuch search" to display subject line as well as thread ID.
* Remove all calls to g_strdup_printfCarl Worth2009-10-26
| | | | | | Replacing them with calls to talloc_asprintf if possible, otherwise to asprintf (with it's painful error-handling leaving the pointer undefined).
* Add notmuch_thread_get_tagsCarl Worth2009-10-26
| | | | | And augment "notmuch search" to print tag values as well as thread ID values. This tool is almost usable now.
* tags: Replace sort() and reset() with prepare_iterator().Carl Worth2009-10-26
| | | | | | The previous functions were always called together, so we might as well just have one function for this. Also, the reset() name was poor, and prepare_iterator() is much more descriptive.
* Fix memory leak in notmuch_thread_results_tCarl Worth2009-10-26
| | | | | If we were using a talloc-based resizing array then this wouldn't have happened. Of course, thanks to valgrind for catching this.
* tags: Re-implement tags iterator to avoid having C++ in the interfaceCarl Worth2009-10-26
| | | | | | | We want to be able to iterate over tags stored in various ways, so the previous TermIterator-based tags object just wasn't general enough. The new interface is nice and simple, and involves only C datatypes.
* notmuch restore: Fix leak of FILE* object.Carl Worth2009-10-26
| | | | | Apparently, I didn't copy enough of the "notmuch dump" implementation since it didn't have a similar leak.
* Hide away the details of the implementation of notmuch_tags_t.Carl Worth2009-10-26
| | | | | | We will soon be wanting multiple different implementations of notmuch_tags_t iterators, so we need to keep the actual structure as an implementation detail inside of tags.cc.
* Move terms and tags code to a new tags.cc file.Carl Worth2009-10-26
| | | | | | | We want to start using this from both message.cc and thread.cc so we need it in a place we can share the code. This also requires a new notmuch-private-cxx.h header file for interfaces that include C++-specific datatypes (such as Xapian::Document).
* results_get: Fix to return NULL if past the end of the resultsCarl Worth2009-10-26
| | | | | | We had documented both notmuch_thread_results_get and notmuch_message_results_get to return NULL if (! has_more) but we hadn't actually implemented that. Fix.
* Add TODO file.Carl Worth2009-10-25
| | | | | I've been maintaining this for a while now, so I might as well start tracking it with revision control as well.
* Add an initial implementation of a notmuch_thread_t object.Carl Worth2009-10-25
| | | | | | | | | | | | | | | | | | | We've now got a new notmuch_query_search_threads and a notmuch_threads_result_t iterator. The thread object itself doesn't do much yet, (just allows one to get the thread_id), but that's at least enough to see that "notmuch search" is actually doing something now, (since it has been converted to print thread IDs instead of message IDs). And maybe that's all we need. Getting the messages belonging to a thread is as simple as a notmuch_query_search_messages with a string of "thread:<thread-id>". Though it would be convenient to add notmuch_thread_get_messages which could use the existing notmuch_message_results_t iterator. Now we just need an implementation of "notmuch show" and we'll have something somewhat usable.
* Rename notmuch_query_search to notmuch_query_search_messagesCarl Worth2009-10-25
| | | | | | | | | | Along with renaming notmuch_results_t to notmuch_message_results_t. The new type is quite a mouthful, but I don't expect it to be used much other than the for-loop idiom in the documentation, (which does at least fit nicely within 80 columns). This is all in preparation for the addition of a new notmuch_query_search_threads of course.
* Drop dead function add_term.Carl Worth2009-10-25
| | | | | | | Even with the recent warnings work, gcc didn't tell me about a static function that I'm not calling? Apparently I get "defined but not used" in C files, but not C++ files. That's bogus, and yet one more reason for me to push the C++ to a minimal lower layer.
* Fix missing xapian-flags when generating dependencies.Carl Worth2009-10-25
| | | | | | I didn't notice this because `xapian-config -cxxflags` gives empty output on my system. But for someone with the xapian library installed in some non-standard location this would be important.
* Drop unused variable.Carl Worth2009-10-25
| | | | | | | | I didn't end up adding any of the warnings options that aren't allowed for C++, (such as -Wold-style-definition, -Wnested-externs, -Werror-implicit-function-declaration, -Wstrict-prototypes, -Wmissing-prototypes, or -Wbad-function-cast). So for now we can drop the separate C and C++ variables for warnings.
* Add -Wswitch-enum and fix warnings.Carl Worth2009-10-25
| | | | | | Having to enumerate all the enum values at every switch is annoying, but this warning actually found a bug, (missing support for NOTMUCH_STATUS_OUT_OF_MEMORY in notmuch_status_to_string).
* Add -Wmising-declarations and fix warnings.Carl Worth2009-10-25
| | | | Wow, lots of missing 'static' on internal functions.
* Add -Wwrite-strings and fix warnings.Carl Worth2009-10-25
| | | | Need to be const-clean when handling string literals.
* Re-enable the warning for unused parameters.Carl Worth2009-10-25
| | | | | It's easy enough to squelch the warning with an __attribute__ ((unused)) and it might just catch something for us in the future.
* Add -Wextra and fix warnings.Carl Worth2009-10-25
| | | | | | | | When adding -Wextra we also add -Wno-ununsed-parameters since that function means well enough, but is really annoying in practice. So the warnings we fix here are basically all comparsions between signed and unsigned values.
* Rework Makefile just a bit to enable adding flags for more compiler warningsCarl Worth2009-10-25
| | | | | | We have to carefully separate the C and C++ flags here since a bunch of the warnings options for gcc are valid for compiling C, but not for C++.
* _notmuch_database_linke_message: Fix error-status propagation.Carl Worth2009-10-25
| | | | | | The _notmuch_database_link_message_to_parents function was void in an earlier draft. Now, ensure that we don't miss any error return value from it.
* Change database to store only a single thread ID per message.Carl Worth2009-10-25
| | | | | | | | | | | | Instead of supporting multiple thread IDs, we now merge together thread IDs if one message is ever found to belong to more than one thread. This allows for constructing complete threads when, for example, a child message doesn't include a complete list of References headers back to the beginning of the thread. It also simplifies dealing with mapping a message ID to a thread ID which is now a simple get_thread_id just like get_message_id, (and no longer an iterator-based thing like get_tags).
* link_message: Remove dead code.Carl Worth2009-10-25
| | | | | | We dropped the THREAD_ID value from the database a while back, but here is code that's carefully computing that value and then never doing anything with it. Delete, delete, delete.
* add_message: Pull the thread-stitching portion out into new ↵Carl Worth2009-10-25
| | | | | | | | _notmuch_database_link_message The function was getting too long-winded before. Add since I'm about to change how we handle the thread linking, it's convenient to have it in an isolated function.
* Add an INTERNAL_ERROR macro and use it for all internal errors.Carl Worth2009-10-25
| | | | | | We were previously just doing fprintf;exit at each point, but I wanted to add file and line-number details to all messages, so it makes sense to use a single macro for that.
* add_message: Propagate error status from notmuch_message_create_for_message_idCarl Worth2009-10-25
| | | | What a great feeling to remove an XXX comment.
* notmuch dump: Eliminate extra space in error message.Carl Worth2009-10-25
| | | | Little details can make big impressions.
* Move read-only-archive hint from "notmuch setup" to "notmuch new"Carl Worth2009-10-25
| | | | | | | | | | The "notmuch setup" output was getting overwhelmingly verbose. Also, some people might not have a lot of mail, so might never need this optimization. It's much better to move the hint to the time when the user could actually benefit from it, (it's easy to detect that "notmuch new" took more than 1 second, and we know if there are any read-only directories there or not).
* Add comment documenting our current database schema.Carl Worth2009-10-25
| | | | | I've got schemes to change this schema somewhat dramatically, so I want a place to be able to record and review those changes.
* Drop the storage of thread ID(s) in a value.Carl Worth2009-10-25
| | | | | | Now that we are iterating over the thread terms instead, we can drop this redundant storage (which should shrink our database a tiny bit).
* Convert notmuch_thread_ids_t to notmuch_terms_tCarl Worth2009-10-25
| | | | | | Aside from increased code sharing, the benefit here is that now thread_ids iterates over the terms of a message rather than the thread_id value. So we'll now be able to drop that value.
* Implement notmuch_tags_t on top of new notmuch_terms_tCarl Worth2009-10-25
| | | | | | | The generic notmuch_terms_t iterator should provide support for notmuch_thread_ids_t when we switch as well, (And it would be interesting to see if we could reasonably make this support a PostingIterator too. Time will tell.)
* Shuffle the value numbers around in the database.Carl Worth2009-10-24
| | | | | | | | | | | | | | | | | | | | First, it's nice that for now we don't have any users yet, so we can make incompatible changes to the database layout like this without causing trouble. ;-) There are a few reasons for this change. First, we now use value 0 uniformly as a timestamp for both mail and timestamp documents, (which lets us cleanup an ugly and fragile bare 0 in the add_value and get_value calls in the timestamp code). Second, I want to drop the thread value entirely, so putting it at the end of the list means we can drop it as compatible change in the future. (I almost want to drop the message-ID value too, but it's nice to be able to sort on it to get diff-able output from "notmuch dump".) But the thread value we never use as a value, (we would never sort on it, for example). And it's totally redundant with the thread terms we store already. So expect it to disappear soon.
* Invent our own prefix values.Carl Worth2009-10-24
| | | | | | | | | | | We're now dropping all pretense of keeping the database directly compatible with sup's current xapian backend. (But perhaps someone might write a new nothmuch backend for sup in the future.) In coming up with the prefix values here, I tried to follow the conventions of http://xapian.org/docs/omega/termprefixes.html as closely as makes sense, (with some domain translation from "web" to "email archive").
* Split BOOLEAN_PREFIX into INTERNAL and EXTERNAL subsets.Carl Worth2009-10-24
| | | | | | | | | | | | | The idea here is that only some of the prefix names (such as "id" and "tag") actually make sense in external user-supplied query strings. Other things like "type" are internal implementation details of how we store things in the database. So internal machinery will add those terms to the database and we don't need to support them in the string itself. With this, we can now simply loop over the external prefix values to let the quiery parser know about them. So as we add prefixes in the future, we'll only need to add them to this list.
* Change all occurrences of "msgid" to "id".Carl Worth2009-10-24
| | | | What's good for the user is good for the internals.
* Add bash-completion script for notmuch.Carl Worth2009-10-24
| | | | | | It's not much of a script, (we don't have that many commands after all), but it's the kind of thing that's nice to have and gives the tool a slightly more polished feel.
* Add the magic to allow searches such as "tag:inbox".Carl Worth2009-10-24
| | | | | | | | | | | The key for this is call add_boolean_prefix on the QueryParser object. That tells the query parser to take something like "tag:inbox" and transform it into the "Linbox" term and do what it needs to do to make this term a requirement of the search. We're starting to have a real system here. Also, I didn't want to expose the ugly name of "msgid" to the user, so we add a prefix name of simply "id" instead.
* Use _find_prefix instead of hard-coded term in notmuch_query_searchCarl Worth2009-10-24
| | | | | | I'm planning to change prefix values soon, which would break code like this. So eliminate the fragility by going through our existing _find_prefix function.
* Fix bit-twiddling brain damage in notmuch_query_searchCarl Worth2009-10-24
| | | | | | | | | Here's the big bug that was preventing any searches from working at all like desired. I did the work to carefully pick out exactly the flags that I wanted, and then I threw it away by trying to combine them with & instead of | (so just passing 0 for flags instead). Much better now.
* Add debugging code for examining query strings.Carl Worth2009-10-24
| | | | | | | | | | | It's nice that Xapian provides a little function to print a textual representation of the entire query tree. So now, if you compile like so: make CFLAGS=-DDEBUG_QUERY then you get a nice output of the query string received by the query module, and the final query actually being sent to Xapian.
* Add a preliminary "notmuch search" command.Carl Worth2009-10-24
| | | | | | | | | | | | | This isn't behaving at all like it's documented yet, (for example, it's returning message IDs not thread IDs[*]). In fact, the output code is just a copy of the body of "notmuch dump", so all you get for now is message ID and tags. But this should at least be enough to start exercising the query functionality, (which is currently very buggy). [*] I'll want to convert the databse to store thread documents before fixing that.
* notmuch_database_create: Document idea to (optionally) return a statusCarl Worth2009-10-24
| | | | | | | 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.
* notmuch setup/new: Propagate failure from notmuch_database_set_timestampCarl Worth2009-10-24
| | | | | | | | | | With some recent testing, the timestamp was failing, (overflowing the term limit), and reporting an error, but the top-level notmuch command was still returning a success return value. I think it's high time to add a test suite, (and the code base is small enough that if we add it now it shouldn't be *too* hard to shoot for a very high coverage percentage).