summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Fix add_message and get_filename to strip/re-add the database path.Carl Worth2009-10-28
| | | | | We now store only a relative path inside the database so the database is not nicely relocatable.
* notmuch setup/new: Print progress once per second instead of after 1000 files.Carl Worth2009-10-28
| | | | | | With the recent addition of full-text indexing, printing only once per 1000 files just isn't often enough. The new timer-based approach will be reliable regardless of the speed of adding message.
* index: Don't bother indexing quoted portions of messages (and signatures).Carl Worth2009-10-28
| | | | | | | | | | | | | Our old notmuch-index-message.cc code had this, but I originally left it out when adding indexing back in. I was concerned primarily with mistakenly detecting signature markers and omitting important text, (for example, I often do long lines of "----" as section separators). But now I see that there's a performance benefit to skippint the quotations, (about 120 files/sec. instead of 95 files/sec.). I mitigated the bogus signature checking by recognizing nothing other than the all-time classic "-- ".
* notmuch_database_add_message: Sanity check the file as the first thingCarl Worth2009-10-28
| | | | | This avoids us wasting a bunch of time doing an expensive SHA-1 over a large file only to discover later that it doesn't even *look* like an email message.
* Tweak formatting of internal error messages.Carl Worth2009-10-28
| | | | | | Was neglecting to print the phrase "Internal error: " before, and for the duplicate message-ID error it's nice to actually see the duplicate IDs.
* index: Store "Full Name <user@example.com>" addressses in the databaseCarl Worth2009-10-28
| | | | | | | We put these is as a separate term so that they can be extracted. We don't actually need this for searching, since typing an email address in as a search term will already trigger a phrase search that does exactly what's wanted.
* Add full-text indexing using the GMime library for parsing.Carl Worth2009-10-28
| | | | | | | | | | | This is based on the old notmuch-index-message.cc from early in the history of notmuch, but considerably cleaned up now that we have some experience with Xapian and know just what we want to index, (rather than just blindly trying to index exactly what sup does). This does slow down notmuch_database_add_message a *lot*, but I've got some ideas for getting some time back.
* notmuch search: Clarify documentation of implicit Boolean operatorsCarl Worth2009-10-28
| | | | | | | | | The original documentation of implicit AND is what we want, but Xapian doesn't actually let us get that today. So be honest about what the user can actually expect. And let's hope the Xapian wizards give us the feature we want soon: http://trac.xapian.org/ticket/402
* TODO: A couple new items.Carl Worth2009-10-28
| | | | | It's time to put full-text indexing back, and we might want to experiment with optimization the original thread-stitching phase.
* TODO: Remove a couple of since-completed items.Carl Worth2009-10-28
| | | | | | | | | | | "notmuch tag" is implemented now and seems to work great (and fast). As for the race condition, as noted in the description we're removing it's not exposed directly in the API, but only in a client that allows for looping over search results and removing the inbox tag from all of them. But then, that's exactly what the "notmuch tag" command does. So, as discussed, we've now documented that command to highlight the issue. Problem resolved, (as well as we can).
* notmuch help: Review and augment all of the "notmuch help" documentation.Carl Worth2009-10-28
| | | | | | The big addition here is the first description of the syntax for the query strings for "notmuch search", (and, by reference, for "notmuch tag").
* notmuch help: Be less verbose by default and support detailed helpCarl Worth2009-10-28
| | | | | | | | | | | Putting all of our documentation into a single help message was getting a bit unwieldy. Now, the simple output of "notmuch help" is a reasonable reminder and a quick reference. Then we now support a new syntax of: "notmuch help <command>" for the more detailed help messages. This gives us freedom to put more detailed caveats, etc. into some sub-commands without worrying about the usage statement getting too long.
* notmuch tag: Fix crash when removing a tag that didn't existCarl Worth2009-10-27
| | | | | Xapian is trying to be useful by reporting that the specified term didn't exist, but this is one case where we just don't care. :-)
* Fix segfault in case of the database lock not being available.Carl Worth2009-10-27
| | | | | | We were nicely reporting the lock-aquisition failure, but then marching along trying to use the database object and just crashing badly. So don't do that.
* Update prefix so that "thread:" can be used in search strings.Carl Worth2009-10-27
| | | | | | | | | | | It's convenient to be able to do things like: notmuch tag -inbox thread:<thread-id> (even though this can run into a race condition as noted in TODO--the fix for the race is simply to not run "notmuch new" between reading a thread with the (not yet existent) "notmuch show" and removing its inbox tag with a command like the above). So we now allow such a thing.
* Add new "notmuch tag" command for adding/removing tags.Carl Worth2009-10-27
| | | | | | | | | | This uses the same search functionality as "notmuch search" so it should be quite powerful. And this global search might be quick enough to be used for "automatic" adding of tags to new messages. Of course, this will all be a lot more useful when we can search for actual text of messages and not just tags.
* notmuch_database_add_message: Do not return a message on failure.Carl Worth2009-10-27
| | | | | | | The recent, disastrous failure of "notmuch new" would have been avoided with this change. The new_command function was basically assuming that it would only get a message object on success so wasn't destroying the message in the other cases.
* notmuch_database_close: Explicitly flush the Xapian database.Carl Worth2009-10-27
| | | | | | | | | | This would have helped with the recent bug causing "notmuch new" to not record any results in the database. I'm not sure why the explicit flush would be required, (shouldn't the destructor always ensure that things flush?), but perhaps some outstanding references from the leak prevented that. In any case, an explicit flush on close() seems to make sense.
* Merge branch to fix broken "notmuch setup" and "notmuch new"Carl Worth2009-10-27
|\ | | | | | | | | | | | | I'm trying to stick to a habit of fixing previously-introduced bugs on side branches off of the commit that introduced the bug. The idea here is to make it easy to find the commits to cherry pick if bisecting in the future lands on one of the broken commits.
| * Fix "notmuch new" (bad performance, and no committing of results).Carl Worth2009-10-27
| | | | | | | | | | | | | | | | | | | | | | | | | | We were incorrectly only destroying messages in the case of successful addition to the database, and not in other cases, (such as failure due to FILE_NOT_EMAIL). I'm still not entirely sure why this was performing abysmally, (as in making an operation that should take a small fraction of a second take 10 seconds), nor why it was causing the database to entirely fail to get new results. But fortunately, this all seems to work now.
| * Unbreak the "notmuch setup" command.Carl Worth2009-10-27
| | | | | | | | | | | | | | | | | | The recent addition of support for automatically adding tags to new messages for "notmuch new" caused "notmuch setup" to segfault. The fix is simple, (just need to move a destroy function to inside a nearby if block). Did I mention recently we need to add a test suite?
* | TODO: Several more ideas that have come to mind, that I don't want to forget.Carl Worth2009-10-27
| | | | | | | | | | Some of these are simple little code cleanups, but it's nice to write them down rather than trying to remember them.
* | TODO: More notes on archive-thread and race conditions.Carl Worth2009-10-27
| | | | | | | | | | | | | | Interstingly, it's our simple "notmuch" client that's going to be the most difficult to fix. There's just not as much information preserved in the textual representation from "notmuch search" as there is in the objects returned from notmuch_query_search_threads.
* | TODO: Add "notmuch tag" and thoughts on avoiding races in archiving threads.Carl Worth2009-10-27
| | | | | | | | | | | | The archive-thread race condition doesn't even exist now because there's no command for modifying tags at the level of a thread (just individual messages).
* | 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++.