summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2012-01-02lib: call g_mime_init() from notmuch_database_open()Kazuo Teramoto
As reported in id:"CAEbOPGyuHnz4BPtDutnTPUHcP3eYcRCRkXhYoJR43RUMw671+g@mail.gmail.com" sometimes gmime tries to access a NULL pointer, e.g. g_mime_iconv_open() tries to access iconv_cache that is NULL if g_mime_init() is not called. This causes notmuch to segfault when calling gmime functions. Calling g_mime_init() initializes iconv_cache and others variables needed by gmime, making sure they are initialized when notmuch calls gmime functions.
2011-12-23Fix comments about what is stored in the databaseThomas Jost
Commit 567bcbc2 introduced two new values for each message (content of the "From" and "Subject" headers), but the comments about the database schema had not been updated accordingly.
2011-12-21notmuch: Quiet buildbot warnings.David Edmondson
Cast away the result of various *write functions. Provide a default value for some variables to avoid "use before set" warnings.
2011-12-06Merge branch 'release'David Bremner
Conflicts: NEWS Conflicts resolved by inserting the 0.10.2 stanza before 0.11
2011-12-04lib: call g_type_init from notmuch_database_openDavid Bremner
We want to make sure g_type_init is called before any GObject functionality is used.
2011-11-21tags_to_maildir_flags: Cleanup double assignementLouis Rilling
The for loop right after already does the job. Signed-off-by: Louis Rilling <l.rilling@av7.net>
2011-11-21lib: Kill last usage of C++ type boolLouis Rilling
Signed-off-by: Louis Rilling <l.rilling@av7.net>
2011-11-19Don't link libnotmuch if libutil isn't linked in properly.Tom Prince
For some reason, on my machine, the link is picking up /usr/lib/libutil.so instead of util/libutil.a. This causes there to be undefined symbols in libnotmuch, making it unuseable. This patch causes the link to fail instead.
2011-11-15lib: add function to get the number of threads matching a searchJani Nikula
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>
2011-11-14Store "from" and "subject" headers in the database.Austin Clements
This is a rebase and cleanup of Istvan Marko's patch from id:m3pqnj2j7a.fsf@zsu.kismala.com Search retrieves these headers for every message in the search results. Previously, this required opening and parsing every message file. Storing them directly in the database significantly reduces IO and computation, speeding up search by between 50% and 10X. Taking full advantage of this requires a database rebuild, but it will fall back to the old behavior for messages that do not have headers stored in the database.
2011-11-13Link libutil using filenmae, rather than using -l.Tom Prince
glibc includes a libutil, so if the wrong -L options get passed, we will pick up glibc's version, rather than our own.
2011-11-02lib/database.cc: use flush Xapian method instead of commitDavid Bremner
Apparently the method was renamed in Xapian 1.1.0 but the old method name will stay around for a while. It seems better to stick with the old name to make notmuch compile with older versions of Xapian, at least for now.
2011-10-30xutil.c: remove duplicate copies, create new library libutil.a to contain xutil.David Bremner
We keep the lib/xutil.c version. As a consequence, also factor out _internal_error and associated macros. It might be overkill to make a new file error_util.c for this, but _internal_error does not really belong in database.cc.
2011-10-24Prefix lib/notmuch.h and lib/gen-version-script.sh with $(srcdir)Amadeusz Żołnowski
lib/notmuch.h and lib/gen-version-script.sh couldn't have been found when building out of sources directory.
2011-10-04lib: bump SONAMEDavid Bremner
Based on discussions with amdragon, tschwinge, and others on IRC, I concluded that 1) symbol versioning was probably overkill for libnotmuch 2) It was also probably GNU ld specific 3) Most importantly, nobody could tell me on short notice how exactly it works. So since the change to the notmuch_database_find_message breaks the previous ABI, we need to bump the SONAME.
2011-10-04lib: make find_message{,by_filename) report errorsAli Polatel
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()
2011-10-04lib: destroy message object after message removalAli Polatel
notmuch_database_remove_message() must call notmuch_message_destroy() once it is done handling message removal.
2011-09-24lib: bump library minor version because of new symbols.David Bremner
This bump is because of the new symbols introduced by the atomicity patches.
2011-09-24lib: Improve notmuch_database_{add,remove}_message documentation.Austin Clements
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.
2011-09-24lib: Wrap notmuch_database_add_message in an atomic section.Austin Clements
Adding a message may involve changes to multiple database documents, and thus needs to be done in a transaction. This makes add_message (and, I think, the whole library) atomicity-safe: library callers only needs to use atomic sections if they needs atomicity across multiple library calls.
2011-09-24lib: Add an API to find a message by filename.Austin Clements
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.
2011-09-23lib: Remove message document directly after removing the last file name.Austin Clements
Previously, notmuch_database_remove_message would remove the message file name, sync the change to the message document, re-find the message document, and then delete it if there were no more file names. An interruption after sync'ing would result in a file-name-less, permanently un-removable zombie message that would produce errors and odd results in searches. We could wrap this in an atomic section, but it's much simpler to eliminate the round-about approach and just delete the message document instead of sync'ing it if we removed the last filename.
2011-09-23lib: Indicate if there are more filenames after removal.Austin Clements
Make _notmuch_message_remove_filename return NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID if the message has more filenames and fix callers to handle this.
2011-09-23lib: Add support for nested atomic sections.Austin Clements
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.
2011-09-23lib: Add notmuch_database_{begin,end}_atomic.Austin Clements
These operations translate into non-flushed Xapian transactions, allowing arbitrary groups of database operations to be performed atomically.
2011-09-12lib: Add missing status check in _notmuch_message_remove_filename.Austin Clements
Previously, this function would synchronize the folder list even if removing the file name failed. Now it returns immediately if removing the file name fails.
2011-09-05lib/gen-version-script.h: add getline and getdelim to notmuch.sym if neededDavid Bremner
If the configure script detects missing getline and/or getdelim symbols, then notmuch will use it's own versions. This patch, based on id:"87k49v12i5.fsf@pc44es141.cs.uni-magdeburg.de" by Matthias Guedemann, adds the symbols to notmuch.sym as well so they are properly exported from the library.
2011-09-05lib/gen-version-script.sh: replace --defined argument to nm with awkDavid Bremner
OpenBSD nm apparently doesn't support --defined. The awk condition is based on the assumption that all defined symbols have some hex number in the first column. Thanks to Matthias Guedemann reporting the problem, and an earlier version of this patch.
2011-08-21re-enable notmuch.sym generation using POSIX sedDavid Bremner
Unfortunately Robin Green's patch 52e4dedf9aa was lost when I created gen-version-script.sh. This merges his changes manually into that script. It turns out tabs seem not needed in version script files, so I simplified a bit and removed the printf. Thanks to Alexander Botero-Lowry for help and testing.
2011-07-20libnotmuch: only build symbols list after the modules are builtThomas Jost
If the notmuch.sym target does not explicitly depend on $(libnotmuch_modules), gen-version-script.sh may be run before all the .o files are created, for example when doing a parallel build on a machine with many cores.
2011-07-17Merge commit '0.6.1'David Bremner
Conflicts: lib/Makefile.local The conflicts are from three kinds of commits not merged into release: - typo fixes - removal of debug output - fix for CLEAN rule That were never merged into the release branch.
2011-07-16libnotmuch: export Xapian typeinfo symbolsDavid Bremner
The lack of such exporting seems to cause problems catching exceptions, as suggested by http://gcc.gnu.org/wiki/Visibility This manifested in the symbol-hiding test failing when notmuch was compile with gcc 4.4.5. On i386, this further manifested as notmuch new failing to run (crashing with an uncaught exception on first run).
2011-07-03Use POSIX sed invocationRobin Green
Fixes broken build on DragonFly BSD Signed-off-by: Robin Green <greenrd@greenrd.org>
2011-06-29Fix folder: coherence issueMark Anderson
Add removal of all ZXFOLDER terms to removal of all XFOLDER terms for each message filename removal. The existing filename-list reindexing will put all the needed terms back in. Test search-folder-coherence now passes. Signed-off-by:Mark Anderson <ma.skies@gmail.com> (cherry picked from commit 8a856e5c38b79359e4fbf9e27f58b1fe00c1e18a)
2011-06-29lib/Makefile.local: remove leftover debugging output.David Bremner
The removed "echo $(libnotmuch_modules)" was strictly for debugging. Thanks to Austin Clements for the hint.
2011-06-29Fix folder: coherence issueMark Anderson
Add removal of all ZXFOLDER terms to removal of all XFOLDER terms for each message filename removal. The existing filename-list reindexing will put all the needed terms back in. Test search-folder-coherence now passes. Signed-off-by:Mark Anderson <ma.skies@gmail.com>
2011-06-28libnotmuch: build symbols list without relying on gcc -aux-info.David Bremner
Carl reports "gcc -aux-info notmuch.aux lib/notmuch.h" does not generate notmuch.aux for him with Debian gcc 4.6.0-8. A small modification of the original sed regular expression allows us to work directly from lib/notmuch.h, rather than preprocessing with gcc. As with most such simple regex based "parsing", this is quite sensitive to the input format, and needs that each symbol to be exported from libnotmuch should - start with "notmuch_" - be the first non-whitespace token on the line - be followed by an open parenthesis. (Cherry-picked from 51b7ab69687, with conflicts resolved by db)
2011-06-28libnotmuch: build symbols list without relying on gcc -aux-info.David Bremner
Carl reports "gcc -aux-info notmuch.aux lib/notmuch.h" does not generate notmuch.aux for him with Debian gcc 4.6.0-8. A small modification of the original sed regular expression allows us to work directly from lib/notmuch.h, rather than preprocessing with gcc. As with most such simple regex based "parsing", this is quite sensitive to the input format, and needs that each symbol to be exported from libnotmuch should - start with "notmuch_" - be the first non-whitespace token on the line - be followed by an open parenthesis.
2011-06-28libnotmuch: fix typos in CLEAN setting, add fileDavid Bremner
- c0961e6 introduced a missing slash between $(dir)$(LIBNAME) and missing $(dir) in front of libnotmuch.a - cdf1c70a created a file $(dir)/notmuch.h.gch and neglected to add it to CLEAN
2011-06-23fix sum moar typos [comments in source code]Pieter Praet
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").
2011-06-23fix sum moar typos [build scripts, Makefiles]Pieter Praet
Various typo fixes in comments within the Makefile and other build scripts. Signed-off-by: Pieter Praet <pieter@praet.org> Edited-by: Carl Worth <cworth@cworth.org> Restricted to just build files.
2011-06-23libnotmuch: add linker script to declare only notmuch_* symbols as global.David Bremner
This is closely tied to gcc and particularly gnu ld, but I guess the shared library linking code would need to be adjusted to work on a non-gnu linker anyay. I had to make a few not-obviously related changes to the lib/Makefile.local to make this work: libnotmuch_modules is defined with := and used in place of $^ (cherry picked from commit 014bf85b1c06ff49be2bde5a26433d2cf376cf70)
2011-06-10Fix appending of Received headersStewart Smith
We're not properly concatenating the Received headers if we parse them while requesting a header that isn't Received. this fixes notmuch-reply address detection in a bunch of situations.
2011-06-03lib/message-file: plug three memleaks.Anton Khirnov
Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
2011-05-27tag signed/encrypted during notmuch newJameson Graef Rollins
This patch adds the tag "signed" to messages with any multipart/signed parts, and the tag "encrypted" to messages with any multipart/encrypted parts. This only occurs when messages are indexed during notmuch new, so a database rebuild is required to have old messages tagged.
2011-05-11Mark some structures in the library interface with visibility=default attribute.Carl Worth
As of gcc 4.6, there are new warnings from -Wattributes along the lines of: warning: ‘_notmuch_messages’ declared with greater visibility than the type of its field ‘_notmuch_messages::iterator’ [-Wattributes] To squelch these, we decorate all such containing structs with __attribute__((visibility("default"))). We take care to let only the C++ compiler see this, (since the C compiler would otherwise warn about ignored visibility attributes on types).
2011-05-11Remove some variables which were set but not used.Carl Worth
gcc (at least as of version 4.6.0) is kind enough to point these out to us, (when given -Wunused-but-set-variable explicitly or implicitly via -Wunused or -Wall). One of these cases was a legitimately unused variable. Two were simply variables (named ignored) we were assigning only to squelch a warning about unused function return values. I don't seem to be getting those warnings even without setting the ignored variable. And the gcc docs. say that the correct way to squelch that warning is with a cast to (void) anyway.
2011-03-21Fixup string list authorAustin Clements
2011-03-21Add the tag list to the unified message metadata pass.Austin Clements
Now each caller of notmuch_message_get_tags only gets a new iterator, instead of a whole new list. In principle this could cause problems with iterating while modifying tags, but through the magic of talloc references, we keep the old tag list alive even after the cache in the message object is invalidated. This reduces my index search from the 3.102 seconds before the unified metadata pass to 1.811 seconds (1.7X faster). Combined with the thread search optimization in b3caef1f0659dac8183441357c8fee500a940889, that makes this query 2.5X faster than when I started.
2011-03-21Add the file name list to the unified message metadata pass.Austin Clements
Even if the caller never uses the file names, there is little cost to simply fetching the file name terms. However, retrieving the full paths requires additional database work, so the expansion from terms to full paths is performed lazily. This also simplifies clearing the filename cache, since that's now handled by the generic metadata cache code. This further reduces my inbox search from 3.102 seconds before the unified metadata pass to 2.206 seconds (1.4X faster).