aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/notmuch.h
Commit message (Collapse)AuthorAge
* lib: Make notmuch_database_get_directory return NULL if the directory is not ↵Gravatar Austin Clements2012-05-23
| | | | | | | | | | | | | | | found Using the new support from _notmuch_directory_create, this makes notmuch_database_get_directory a read-only operation that simply returns the directory object if it exists or NULL otherwise. This also means that notmuch_database_get_directory can work on read-only databases. This change breaks the directory mtime workaround in notmuch-new.c by fixing the exact issue it was working around. This permits mtime update races to prevent scans of changed directories, which non-deterministically breaks a few tests. The next patch fixes this.
* lib/cli: Make notmuch_database_get_directory return a status codeGravatar Austin Clements2012-05-15
| | | | | | | | | | | | | | Previously, notmuch_database_get_directory had no way to indicate how it had failed. This changes its prototype to return a status code and set an out-argument to the retrieved directory, like similar functions in the library API. This does *not* change its currently broken behavior of creating directory objects when they don't exist, but it does document it and paves the way for fixing this. Also, it can now check for a read-only database and return NOTMUCH_STATUS_READ_ONLY_DATABASE instead of crashing. In the interest of atomicity, this also updates calls from the CLI so that notmuch still compiles.
* lib/cli: Make notmuch_database_create return a status codeGravatar Austin Clements2012-05-05
| | | | | | | | This is the notmuch_database_create equivalent of the previous change. In this case, there were places where errors were not being propagated correctly in notmuch_database_create or in calls to it. These have been fixed, using the new status value.
* lib/cli: Make notmuch_database_open return a status codeGravatar Austin Clements2012-05-05
| | | | | | | | | | | | It has been a long-standing issue that notmuch_database_open doesn't return any indication of why it failed. This patch changes its prototype to return a notmuch_status_t and set an out-argument to the database itself, like other functions that return both a status and an object. In the interest of atomicity, this also updates every use in the CLI so that notmuch still compiles. Since this patch does not update the bindings, the Python bindings test fails.
* Split notmuch_database_close into two functionsGravatar Justus Winter2012-04-28
| | | | | | | | | | | | | | | | | | Formerly notmuch_database_close closed the xapian database and destroyed the talloc structure associated with the notmuch database object. Split notmuch_database_close into notmuch_database_close and notmuch_database_destroy. This makes it possible for long running programs to close the xapian database and thus release the lock associated with it without destroying the data structures obtained from it. This also makes the api more consistent since every other data structure has a destructor function. The comments in notmuch.h are a courtesy of Austin Clements. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* lib: change default for notmuch_query_set_omit_excludedGravatar Mark Walters2012-04-07
|
* lib: Add the exclude flag to notmuch_query_search_threadsGravatar Mark Walters2012-03-02
| | | | | | | | | | | Add the NOTMUCH_MESSAGE_FLAG_EXCLUDED flag to notmuch_query_search_threads. Implemented by inspecting the tags directly in _notmuch_thread_create/_thread_add_message rather than as a Xapian query for speed reasons. Note notmuch_thread_get_matched_messages now returns the number of non-excluded matching messages. This API is not totally desirable but fixing it means breaking binary compatibility so we delay that.
* lib: Make notmuch_query_search_messages set the exclude flagGravatar Mark Walters2012-03-02
| | | | | | | | | | Add a flag NOTMUCH_MESSAGE_FLAG_EXCLUDED which is set by notmuch_query_search_messages for excluded messages. Also add an option omit_excluded_messages to the search that we do not want the excludes at all. This exclude flag will be added to notmuch_query_search threads in the next patch.
* lib: Add support for automatically excluding tags from queriesGravatar Austin Clements2012-01-16
| | | | | | This is useful for tags like "deleted" and "spam" that people generally want to exclude from query results. These exclusions will be overridden if a tag is explicitly mentioned in a query.
* lib: add function to get the number of threads matching a searchGravatar Jani Nikula2011-11-15
| | | | | | | | | Add function notmuch_query_count_threads() to get the number of threads matching a search. This is done by performing a search and figuring out the number of unique thread IDs in the matching messages, a significantly heavier operation than notmuch_query_count_messages(). Signed-off-by: Jani Nikula <jani@nikula.org>
* lib: make find_message{,by_filename) report errorsGravatar Ali Polatel2011-10-04
| | | | | | | | | | | | | | | | Previously, the functions notmuch_database_find_message() and notmuch_database_find_message_by_filename() functions did not properly report error condition to the library user. For more information, read the thread on the notmuch mailing list starting with my mail "id:871uv2unfd.fsf@gmail.com" Make these functions accept a pointer to 'notmuch_message_t' as argument and return notmuch_status_t which may be used to check for any error condition. restore: Modify for the new notmuch_database_find_message() new: Modify for the new notmuch_database_find_message_by_filename()
* lib: Improve notmuch_database_{add,remove}_message documentation.Gravatar Austin Clements2011-09-24
| | | | | | | | State up front that these functions may add a filename to an existing message or remove only a filename (and not the message), respectively. Previously, this key information was buried in return value documentation or in "notes", which made it seem secondary to these functions' semantics.
* lib: Add an API to find a message by filename.Gravatar Austin Clements2011-09-24
| | | | | | | | | notmuch_database_find_message_by_filename is mostly stolen from notmuch_database_remove_message, so this patch also vastly simplfies the latter using the former. This API is also useful in its own right and will be used in a later patch for eager maildir flag synchronization.
* lib: Add support for nested atomic sections.Gravatar Austin Clements2011-09-23
| | | | | | | notmuch_database_t now keeps a nesting count and we only start a transaction or commit for the outermost atomic section. Introduces a new error, NOTMUCH_STATUS_UNBALANCED_ATOMIC.
* lib: Add notmuch_database_{begin,end}_atomic.Gravatar Austin Clements2011-09-23
| | | | | | These operations translate into non-flushed Xapian transactions, allowing arbitrary groups of database operations to be performed atomically.
* fix sum moar typos [comments in source code]Gravatar Pieter Praet2011-06-23
| | | | | | | | | | Various typo fixes in comments within the source code. Signed-off-by: Pieter Praet <pieter@praet.org> Edited-by: Carl Worth <cworth@cworth.org> Restricted to just source-code comments, (and fixed fix of "descriptios" to "descriptors" rather than "descriptions").
* tags_to_maildir_flags: Fix to preserve existing, unsupported flagsGravatar Carl Worth2010-11-11
| | | | | | This is to prevent notmuch from destroying any information the user has encoded as flags in the maildir filename. Tests are also added to the test suite to verify the documented behavior.
* notmuch_message_tags_to_maildir_flags: Do nothing outside of "new" and "cur"Gravatar Carl Worth2010-11-11
| | | | | | | | | | | Some people use notmuch with non-maildir files, (for example, email messages in MH format, or else cool things like using sluk[*] to suck down feeds into a format that notmuch can index). To better support uses like that, don't do any renaming for files that are not in a directory named either "new" or "cur". [*] https://github.com/krl/sluk/
* lib: Be honest in the documentation of the maildir functionsGravatar Carl Worth2010-11-11
| | | | | | | | | | I had originally hoped for better semantics, such as doing nothing in non-maildir directories, and preserving unknown maildir flags that happen to be present. We could still do those things, of course, but for now, remove them from the documentation since the implementation does not do these things yet.
* lib: Document that absence of maildir flags can also remove/add tagsGravatar Carl Worth2010-11-11
| | | | | | | | | | | | | | | Previously the documentation of notmuch_message_maildir_flags_to_tags suggested that the presence of a flag would cause tags to be added, (or in the case of "unread", removed). But the case of absent maildir flags was not explicitly described. What we actually want, is that for supported flags, the absence of the flag in all messages causes the corresponding tag to be removed, (or in the case of "unread", added). So document that explicitly. This is the case recently added to the test suite as a failing test, (so we'll need to do bug fixing before the documentation is honest here).
* lib: Add new, public notmuch_message_get_filenamesGravatar Carl Worth2010-11-11
| | | | | | | | | | | | | | | | | | This augments the existing notmuch_message_get_filename by allowing the caller access to all filenames in the case of multiple files for a single message. To support this, we split the iterator (notmuch_filenames_t) away from the list storage (notmuch_filename_list_t) where previously these were a single object (notmuch_filenames_t). Then, whenever the user asks for a file or filename, the message object lazily creates a complete notmuch_filename_list_t and then: For notmuch_message_get_filename, returns the first filename in the list. For notmuch_message_get_filenames, creates and returns a new iterator for the filename list.
* lib: Remove the notion of TAGS_INVALIDGravatar Carl Worth2010-11-11
| | | | | | | | This rather ugly hack was recently obviated by the removal of the notmuch_database_set_maildir_sync function. Now, clients must make explicit calls to do any syncrhonization between maildir flags and tags. So the library no longer needs to worry about doing inconsistent synchronization while a message is only partially added.
* lib: Rework interface for maildir_flags synchronizationGravatar Carl Worth2010-11-11
| | | | | | | | | | | | | Instead of having an API for setting a library-wide flag for synchronization (notmuch_database_set_maildir_sync) we instead implement maildir synchronization with two new library functions: notmuch_message_maildir_flags_to_tags and notmuch_message_tags_to_maildir_flags These functions are nicely documented here, (though the implementation does not quite match the documentation yet---as plainly evidenced by the current results of the test suite).
* Make maildir synchronization configurableGravatar Michal Sojka2010-11-10
| | | | | | | This adds group [maildir] and key 'synchronize_flags' to the configuration file. Its value enables (true) or diables (false) the synchronization between notmuch tags and maildir flags. By default, the synchronization is disabled.
* Maildir synchronizationGravatar Michal Sojka2010-11-10
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows bi-directional synchronization between maildir flags and certain tags. The flag-to-tag mapping is defined by flag2tag array. The synchronization works this way: 1) Whenever notmuch new is executed, the following happens: o New messages are tagged with configured new_tags. o For new or renamed messages with maildir info present in the file name, the tags defined in flag2tag are either added or removed depending on the flags from the file name. 2) Whenever notmuch tag (or notmuch restore) is executed, a new set of flags based on the tags is constructed for every message and a new file name is prepared based on the old file name but with the new flags. If the flags differs and the old message was in 'new' directory then this is replaced with 'cur' in the new file name. If the new and old file names differ, the file is renamed and notmuch database is updated accordingly. The rename happens before the database is updated. In case of crash between rename and database update, the next run of notmuch new brings the database in sync with the mail store again.
* lib: Return added message even if it already was in the databaseGravatar Michal Sojka2010-11-10
|
* lib: Add two functions: notmuch_query_get_query_string and _get_sortGravatar Carl Worth2010-10-28
| | | | | It can be handy to be able to query these settings from an existing query object.
* lib: Fix notmuch_query_search_threads to return NULL on any Xapian exception.Gravatar Carl Worth2010-10-22
| | | | | | Previously, if the underlying search_messages hit an exception and returned NULL, this function would ignore that and return a non-NULL, (but empty) threads object. Fix this to properly propagate the error.
* lib: Ensure notmuch_query_search_messages returns NULL on an exception.Gravatar Carl Worth2010-04-24
| | | | | Previously, this function may have segfaulted immediately after reporting the exception.
* lib: Document that notmuch_query_count_messages may return 0 if an exception ↵Gravatar Carl Worth2010-04-24
| | | | | | occurs This isn't a behavioral change---just a calrification in the documentation.
* lib: Audit all notmuch_database call for Xapian exception handling.Gravatar Carl Worth2010-04-24
| | | | | | Our current approach is for top-level entry poitns in the library to have try/catch blocks that catch any Xapian exception and print a message. Add a few missing blocks and fix up the documentation.
* query.cc: allow to return query results unsortedGravatar Sebastian Spaeth2010-04-21
| | | | | | | | | | | Previously, we always sorted the returned results by some string value, (newest-to-oldest by default), however in some cases (as when applying tags to a search result) we are not interested in any special order. This introduces a NOTMUCH_SORT_UNSORTED value that does just that. It is not used at the moment anywhere in the code. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Fix typo in notmuch.h documentation regarding database open modesGravatar Michael Forney2010-04-13
| | | | | | | | | | Reviewed-by: Carl Worth <cworth@cworth.org>: The original proposal for having different open modes used the name WRITABLE. I didn't like that name, (easy to misspell as WRITEABLE even for native English speakers). So we renamed it to READ_WRITE immediately, but apparently some of the documentation held the old name for a while.
* lib: Handle "*" as a query string to match all messages.Gravatar Carl Worth2010-04-09
| | | | | | This seems like a generally useful thing to support, (but the previous support through an empty string was not convenient for some users, (such as the command-line client).
* Clarify documentation of notmuch_database_add_message.Gravatar Carl Worth2010-03-31
| | | | | | For the case of adding a file that already exist, (with the same filename). In this case, nothing will happen to the database, but that wasn't clear before.
* Fix a few documentation typos in notmuch.hGravatar Fernando Carrijo2010-03-09
| | | | | | Fix a few documentation typos in notmuch.h Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
* Update documentation of notmuch_query_createGravatar Fernando Carrijo2010-03-09
| | | | | | | | | | | Commit cd467caf renamed notmuch_query_search to notmuch_query_search_messages. Commit 1ba3d46f created notmuch_query_search_threads. We better keep the docs of notmuch_query_create consistent with those changes. Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br> Edited-by: Carl Worth to explicitly list the full name of each function being referenced.
* lib: Document what move_to_next does at the end of the list.Gravatar Carl Worth2010-03-09
| | | | | Explicitly mention that there's an invalid position after the last item in the list.
* lib: Rename iterator functions to prepare for reverse iteration.Gravatar Carl Worth2010-03-09
| | | | | | | | We rename 'has_more' to 'valid' so that it can function whether iterating in a forward or reverse direction. We also rename 'advance' to 'move_to_next' to setup parallel naming with the proposed functions 'move_to_first', 'move_to_last', and 'move_to_previous'.
* notmuch.h: Fix a couple of typos in the documentation.Gravatar Carl Worth2010-02-05
| | | | | Obviously, the spell-checker isn't able to catch every mistake I make.
* notmuch new: Print upgrade progress report as a percentage.Gravatar Carl Worth2010-01-09
| | | | | | | | | | | | Previously we were printing a number of messages upgraded so far. The original motivation for this was to accurately reflect the fact that there are two passes, (so each message is processed twice and it's not accurate to represent with a single count). But as it turns out, the second pass takes zero time (relatively speaking) so we're still not accounting for it. If nothing else, the percentage-based reporting makes for a cleaner API for the progress_notify function.
* lib: Implement versioning in the database and provide upgrade function.Gravatar Carl Worth2010-01-07
| | | | | | | | | | | | | | | | | | | | | | | | The recent support for renames in the database is our first time (since notmuch has had more than a single user) that we have a database format change. To support smooth upgrades we now encode a database format version number in the Xapian metadata. Going forward notmuch will emit a warning if used to read from a database with a newer version than it natively supports, and will refuse to write to a database with a newer version. The library also provides functions to query the database format version: notmuch_database_get_version to ask if notmuch wants a newer version than that: notmuch_database_needs_upgrade and a function to actually perform that upgrade: notmuch_database_upgrade
* Prefer READ_ONLY consistently over READONLY.Gravatar Carl Worth2010-01-07
| | | | | | Previously we had NOTMUCH_DATABASE_MODE_READ_ONLY but NOTMUCH_STATUS_READONLY_DATABASE which was ugly and confusing. Rename the latter to NOTMUCH_STATUS_READ_ONLY_DATABASE for consistency.
* lib: Consolidate checks for read-only database.Gravatar Carl Worth2010-01-07
| | | | | | | | | | | Previously, many checks were deep in the library just before a cast operation. These have now been replaced with internal errors and new checks have instead been added at the beginning of all top-levelentry points requiring a read-write database. The new checks now also use a single function for checking and printing the error message. This will give us a convenient location to extend the check, (such as based on database version as well).
* lib: Treat NULL as a valid (and empty) notmuch_filenames_t iterator.Gravatar Carl Worth2010-01-06
| | | | | This will be convenient to avoid some special-casing in higher-level code.
* lib: Indicate whether notmuch_database_remove_message removed anything.Gravatar Carl Worth2010-01-06
| | | | | | | | Similar to the return value of notmuch_database_add_message, we now enhance the return value of notmuch_database_remove_message to indicate whether the message document was entirely removed (SUCCESS) or whether only this filename was removed and the document exists under other filenamed (DUPLICATE_MESSAGE_ID).
* lib: Update documentation of notmuch_database_add_message.Gravatar Carl Worth2010-01-06
| | | | | | | Previously, adding a filename with the same message ID as an existing message would do nothing. But we recently fixed this to instead add the new filename to the existing message document. So update the documentation to match now.
* Add missing comment for NOTMUCH_STATUS_READONLY_DATABASE.Gravatar Carl Worth2010-01-06
| | | | And adjust the string representation of the same to match.
* Revamp the proposed directory-tracking API slightly.Gravatar Carl Worth2010-01-06
| | | | | | | | This commit contains my changes to the API proposed by Keith. Nothing is dramatically different. There are minor things like changing notmuch_files_t to notmuch_filenames_t and then various things needed for completeness as noticed while implementing this, (such as notmuch_directory_destroy and notmuch_directory_set_mtime).
* Prototypes for directory trackingGravatar Keith Packard2010-01-06
| | | | | There's no functionality here yet---just a sketch of what the interface could look like.