aboutsummaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAge
* Fix SEGV in _thread_cleanup_author if author ends with ', 'Dirk Hohndel2010-04-27
| | | | | | | | | | Admittedly, an author name ending in ',' guarantees this is spam, and indeed this was triggered by a spam email, but that doesn't mean we shouldn't handle this case correctly. We now check that there is actually a component of the name (presumably the first name) after the comma in the author name. Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
* lib: Increment library version to 1.1.0Carl Worth2010-04-27
| | | | For the addition of the new NOTMUCH_SORT_UNSORTED value.
* lib: Re-implement moving of thread authors.Carl Worth2010-04-27
| | | | | | | | | | | | | Just before releasing 0.3 we received reports of crashes that were bisected to the commit adding thread-author moving. Sure enough, valgrind pointed to buffer overruns in _thread_move_matched_author. Rather than trying to make sense of all the by strncpy, strchr, +1, and +2 of that code, I reimplemented thread-author ordering with a pair of hash tables and an array. Valgrind is at least happy now on the test cases it was complaining about previously.
* Make Received: header special in notmuch_message_file_get_headerDirk Hohndel2010-04-26
| | | | | | | | | | | | With this patch the Received: header becomes special in the way we treat headers - this is the only header for which we concatenate all the instances we find (instead of just returning the first one). This will be used in the From guessing code for replies as we need to be able to walk ALL of the Received: headers in a message to have a good chance to guess which mailbox this email was delivered to. Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
* Simple attempt to display author names in a friendlier wayDirk Hohndel2010-04-26
| | | | | | | | | | | | This patch only addresses the typical Outlook/Exchange case where we have "Last, First" <first.last@company.com> or "Last, First MI" <first.mi.last@company.com>. In the future we should be more fexible as to the formats we recognize, but for now we address this one as it is the Exchange default setting and therefore the most common one. Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
* Reorder displayed names of thread authorsDirk Hohndel2010-04-26
| | | | | | | | | | | | | | | | | | When displaying threads as result of a search it makes sense to list those authors first who match the search. The matching authors are separated from the non-matching ones with a '|' instead of a ',' Imagine the default "+inbox" query. Those mails in the thread that match the query are actually "new" (whatever that means). And some people seem to think that it would be much better to see those author names first. For example, imagine a long and drawn out thread that once was started by me; you have long read the older part of the thread and removed the inbox tag. Whenever a new email comes in on this thread, prior to this patch the author column in the search display will first show "Dirk Hohndel" - I think it should first show the actual author(s) of the new mail(s). Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
* Add authors member to messageDirk Hohndel2010-04-26
| | | | | | | message->authors contains the author's name (as we want to print it) get / set methods are declared in notmuch-private.h Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
* lib: Ensure notmuch_query_search_messages returns NULL on an exception.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 ↵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.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.
* lib: Audit calls to notmuch_message_get_header to handle NULL returnCarl Worth2010-04-24
| | | | | | | | | Sebastian Spaeth reported [*] a segfault within libnotmuch when running notmuch operations while an asyncronous offlineimap job had removed some files from the mail store. Avoid this by handling all cases where notmuch_message_get_header could return NULL. [*] See message id:87d3xqti3o.fsf@SSpaeth.de on notmuch@notmuchmail.org
* lib: Simplify code to set subject from matched message.Carl Worth2010-04-24
| | | | | Simply moving the code from _add_matched_message to a new _set_subject_from_message function.
* Revert "thread: Simplify code for assigning the subject."Carl Worth2010-04-22
| | | | | | | This reverts commit 36e4459a328b8449b3e9d510be81a332a9b35aaa. With the two previous reverts, this fixes the recent message-sorting regression, so the test suite now passes again.
* Revert "thread: Fix sort of search when constructing threads."Carl Worth2010-04-22
| | | | This reverts commit f43990ce134d838cdb2cdd5d0752a602e81cfdd9.
* Revert "thread: Removed unsed sort argument from _thread_add_matched_message"Carl Worth2010-04-22
| | | | This reverts commit 7fb56f9dc5d8e66f717f5e48ecbfbc11c8190182.
* thread: Removed unsed sort argument from _thread_add_matched_messageCarl Worth2010-04-21
| | | | | The reworked solution for naming a thread based on the subject of oldest/newest matching message no longer needs this argument.
* query.cc: allow to return query results unsortedSebastian 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>
* thread: Fix sort of search when constructing threads.Carl Worth2010-04-21
| | | | | | The thread-naming feature depends on the matched messages being passed down in a precise order, (the order of the top-level search). We fix the feature by passing that sort order down.
* thread: Simplify code for assigning the subject.Carl Worth2010-04-21
| | | | | | | | | We know that matched messages are always added in order, so we can always just grab the subject from the first message. This is the same approach that was used previously in _thread_add_message. That is, the recent feature of renaming a thread based on the subject of the "first" matched message is as simple as moving the subject assignment from _thread_add_message to _thread_add_matched_message.
* Name thread based on matching msgs instead of first msg.Jesse Rosenthal2010-04-21
| | | | | | | | | | | | | | | | | | | | | | At the moment all threads are named based on the name of the first message in the thread. However, this can cause problems if people either start new threads by replying-all (as unfortunately, many out there do) or change the subject of their mails to reflect a shift in a thread on a list. This patch names threads based on (a) matches for the query, and (b) the search order. If the search order is oldest-first (as in the default inbox) it chooses the oldest matching message as the subject. If the search order is newest-first it chooses the newest one. Reply prefixes ("Re: ", "Aw: ", "Sv: ", "Vs: ") are ignored (case-insensitively) so a Re: won't change the subject. Note that this adds a "sort" argument to _notmuch_thread_create and _thread_add_matched_message, so that when constructing the thread we can be aware of the sort order. Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
* lib: search_threads: Fix nested search to handle original search of "*"Carl Worth2010-04-15
| | | | | | | | | | | | | | When constructing a thread, we usually run a nested query to find all messages in the thread that match the original search string. However, we need to have special-case handling of an original search string of "*" now that that is a supported means of specifying all messages. The special-case ends up bein quite simple---we do less work, (just skipping the nested search since we know that all messages must match). I had been wanting to write this identical code to more efficiently handle "notmuch search thread:<foo>" which was previously running two identical searches. So that case is now more efficient as well.
* Makefile: Add library version information on OS X.Carl Worth2010-04-14
| | | | | | | This encodes the library version into the library, where the linking binary can pick it up, and the linker can even enforce mismatches in the minor release, (such as linking a binary against version 1.2 and then attempting to run it against version 1.1).
* Makefile: Fix library linking command for OS XCarl Worth2010-04-14
| | | | | | | | | I'm not sure which system Aaron used, but on the machine I have access to, (Darwin 8.11.0), the -shared and -dylib_install_name options are not recognized. Instead I use -dynamic_lib and -install_name as documented here: http://www.finkproject.org/doc/porting/shared.php
* Add infrastructure for building shared library on OS X.Aaron Ecay2010-04-14
| | | | | | | | This patch adds a configure check for OS X (actually Darwin), and sets up the Makefiles to build a proper shared library on that platform. Signed-off-by: Aaron Ecay <aaronecay@gmail.com>
* Makefile: Move compat sources from the client code to the library.Carl Worth2010-04-14
| | | | Since the library code needs these as well.
* Do not segfault on empty mime partsmartin f. krafft2010-04-13
| | | | | | | | | | | | | | | | | notmuch previously unconditionally checked mime parts for various properties, but not for NULL, which is the case if libgmime encounters an empty mime part. Upon encounter of an empty mime part, the following is printed to stderr (the second line due to my patch): (process:17197): gmime-CRITICAL **: g_mime_message_get_mime_part: assertion `GMIME_IS_MESSAGE (message)' failed Warning: Not indexing empty mime part. This is probably a bug that should get addressed in libgmime, but for not, my patch is an acceptable workaround. Signed-off-by: martin f. krafft <madduck@madduck.net>
* Fix typo in notmuch.h documentation regarding database open modesMichael 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: Remove condition regarding a NULL parent_thread_id.Carl Worth2010-04-12
| | | | | A recent change guaranteed that a message ID can never be resolved to a NULL thread ID, so we don't need this extra case.
* lib: Always add reference terms to the database.Carl Worth2010-04-12
| | | | | | | | Previously, we were only adding the reference terms for cases where the referenced message did not yet exist in the database. For thread presentation, it's useful to have the connection information provided by the references, even when the messages are present. So add this term unconditionally.
* lib: Document the metadata stored within the Xapian database.Carl Worth2010-04-12
| | | | | We are currently storing "version", "last_thread_id", and "thread_id_*" values so document how each of these are used.
* lib: Fix line-wrapping in _notmuch_database_link_message.Carl Worth2010-04-12
| | | | | | This function had some excessively long lines due to nested expressions. It's simple enough to un-nest these and have readable line lengths.
* lib: Fix internal documentation of _notmuch_database_link_messageCarl Worth2010-04-12
| | | | | | This function was recently modified, (to include a metadata lookup for a message's thread ID before looking for parent/child thread IDs), but the documentation wasn't updated. Fix that.
* lib: Simplify code flow in _resolve_message_id_to_thread_idCarl Worth2010-04-12
| | | | | | There are two primary cases in this function, (the message exists in the database or it does not). Previously the code for these two cases was split and intermingled with goto-spaghetti connections.
* lib: Fix internal documentation of _resolve_message_id_to_thread_idCarl Worth2010-04-12
| | | | | We no longer return NULL, but instead generate a new thread ID for messages that we haven't seen yet.
* Store thread ids for messages that we haven't seen yetJames Westby2010-04-12
| | | | | | | | | | | | | | | | This allows us to thread messages even when we receive them out of order, or never receive the root. The thread ids for messages that aren't present but are referred to are stored as metadata in the database and then retrieved if we ever get that message. When determining the thread id for a message we also check for this metadata so that we can thread descendants of a message together before we receive it. Edited by Carl Worth <cworth@cworth.org>: Split this portion of the commit from the earlier-applied portion adding test cases.
* lib: Handle "*" as a query string to match all messages.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).
* fix obvious cut and paste errorDirk Hohndel2010-04-06
| | | | | | the wrong variable is checked for success of an allocation Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
* fix notmuch_message_file_get_headerDirk Hohndel2010-04-06
| | | | | | | fix notmuch_message_file_get_header to always return the first instance of the header you are looking for Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
* Avoid needlessly linking final notmuch binary against libXapian.Carl Worth2010-04-06
| | | | | | The libnotmuch.so library already does, so we don't need to do it again. (Thanks to a Debian debhelper warning for pointing this out.)
* configure: Add support for a --includedir optionCarl Worth2010-04-06
| | | | Very similar to the existing --libdir option.
* Makefiles: Eliminate the useless quiet_* functions.Carl Worth2010-04-06
| | | | | | | | | | | | | | | | | | With the original quiet function, there's an actual purpose (hiding excessively long compiler command lines so that warnings and errors from the compiler can be seen). But with things like quiet_symlink there's nothing quieter. In fact "SYMLINK" is longer than "ln -sf". So all this is doing is hiding the actual command from the user for no real benefit. The only actual reason we implemented the quiet_* functions was to be able to neatly right-align the command name and left-align the arguments. Let's give up on that, and just left-align everything, simplifying the Makefiles considerably. Now, the only instances of a captialized command name in the output is if there's some actually shortening of the command itself.
* RELEASING: Add this file describing the steps to make a release.Carl Worth2010-04-05
| | | | | These steps might be changing a bit as we work on making the initial 0.1 release.
* Makefile.local: Automatically use makefile modeDavid Edmondson2010-04-03
| | | | | | | | | We add a magic line to the beginning of each Makefile.local file to help the editor know that it should use makefile mode for editing the file, (even though the filename isn't exactly "Makefile"). Edited-by: Carl Worth <cworth@cworth.org>: Expand treatment from emacs/Makefile.local to each instance of Makefile.local.
* Compile a static notmuch binary (but only install the shared version)Carl Worth2010-04-01
| | | | | | | | The idea here is to allow a new user of notmuch to be able to run notmuch immediately after compiling, (without having to install the shared library first). This also ensures that the test suite tests the locally compiled library, and not whatever installled version of the library the dynamic linker happens to find.
* Makefile: Create include directory when installing headersMichal Sojka2010-04-01
| | | | | | When I wanted to create a debian package from the current master, make install failed because of non-existent include directory. This patch fixes this minor issue.
* lib: Switch to a 3-part version number for the library interface.Carl Worth2010-04-01
| | | | | With a carefully documented description of how to increment the various version components.
* Makefiles: Make the install rules quiet like the compilation rules.Carl Worth2010-03-31
| | | | | The output from make is looking better all the time, (though the columns still aren't lined up).
* Move installation of library from top-level to lib/Makefile.localCarl Worth2010-03-31
| | | | | | We had a fairly ugly violation of modularity with the top-level Makefile.local isntalling everything, (even when the build commands for the library were down in lib/Makefile.local).
* Fix target dependencies for multiple jobsSaleem Abdulrasool2010-03-31
| | | | Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
* Build and link against notmuch shared library, install notmuch.hBen Gamari2010-03-31
| | | | Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>