mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 12:28:09 +01:00
Merge branch 'release'
Austin's termpos patches and Felipe's zlib.pc workaround
This commit is contained in:
commit
cc2722ba9e
6 changed files with 101 additions and 18 deletions
1
compat/.gitignore
vendored
Normal file
1
compat/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
zlib.pc
|
18
compat/gen_zlib_pc.c
Normal file
18
compat/gen_zlib_pc.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <stdio.h>
|
||||
#include <zlib.h>
|
||||
|
||||
static const char *template =
|
||||
"prefix=/usr\n"
|
||||
"exec_prefix=${prefix}\n"
|
||||
"libdir=${exec_prefix}/lib\n"
|
||||
"\n"
|
||||
"Name: zlib\n"
|
||||
"Description: zlib compression library\n"
|
||||
"Version: %s\n"
|
||||
"Libs: -lz\n";
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf(template, ZLIB_VERSION);
|
||||
return 0;
|
||||
}
|
9
configure
vendored
9
configure
vendored
|
@ -340,6 +340,15 @@ else
|
|||
errors=$((errors + 1))
|
||||
fi
|
||||
|
||||
if ! pkg-config --exists zlib; then
|
||||
${CC} ${zlib_cflags} -o compat/gen_zlib_pc \
|
||||
"$srcdir"/compat/gen_zlib_pc.c ${zlib_ldflags} > /dev/null 2>&1 &&
|
||||
compat/gen_zlib_pc > compat/zlib.pc &&
|
||||
PKG_CONFIG_PATH="$PKG_CONFIG_PATH":compat &&
|
||||
export PKG_CONFIG_PATH
|
||||
rm -f compat/gen_zlib_pc
|
||||
fi
|
||||
|
||||
printf "Checking for zlib (>= 1.2.5.2)... "
|
||||
have_zlib=0
|
||||
if pkg-config --atleast-version=1.2.5.2 zlib; then
|
||||
|
|
24
lib/index.cc
24
lib/index.cc
|
@ -231,26 +231,22 @@ _index_address_mailbox (notmuch_message_t *message,
|
|||
InternetAddress *address)
|
||||
{
|
||||
InternetAddressMailbox *mailbox = INTERNET_ADDRESS_MAILBOX (address);
|
||||
const char *name, *addr;
|
||||
const char *name, *addr, *combined;
|
||||
void *local = talloc_new (message);
|
||||
|
||||
name = internet_address_get_name (address);
|
||||
addr = internet_address_mailbox_get_addr (mailbox);
|
||||
|
||||
/* In the absence of a name, we'll strip the part before the @
|
||||
* from the address. */
|
||||
if (! name) {
|
||||
const char *at;
|
||||
/* Combine the name and address and index them as a phrase. */
|
||||
if (name && addr)
|
||||
combined = talloc_asprintf (local, "%s %s", name, addr);
|
||||
else if (name)
|
||||
combined = name;
|
||||
else
|
||||
combined = addr;
|
||||
|
||||
at = strchr (addr, '@');
|
||||
if (at)
|
||||
name = talloc_strndup (local, addr, at - addr);
|
||||
}
|
||||
|
||||
if (name)
|
||||
_notmuch_message_gen_terms (message, prefix_name, name);
|
||||
if (addr)
|
||||
_notmuch_message_gen_terms (message, prefix_name, addr);
|
||||
if (combined)
|
||||
_notmuch_message_gen_terms (message, prefix_name, combined);
|
||||
|
||||
talloc_free (local);
|
||||
}
|
||||
|
|
|
@ -1023,16 +1023,21 @@ _notmuch_message_gen_terms (notmuch_message_t *message,
|
|||
return NOTMUCH_PRIVATE_STATUS_NULL_POINTER;
|
||||
|
||||
term_gen->set_document (message->doc);
|
||||
term_gen->set_termpos (message->termpos);
|
||||
|
||||
if (prefix_name) {
|
||||
const char *prefix = _find_prefix (prefix_name);
|
||||
|
||||
term_gen->set_termpos (message->termpos);
|
||||
term_gen->index_text (text, 1, prefix);
|
||||
message->termpos = term_gen->get_termpos ();
|
||||
/* Create a gap between this an the next terms so they don't
|
||||
* appear to be a phrase. */
|
||||
message->termpos = term_gen->get_termpos () + 100;
|
||||
}
|
||||
|
||||
term_gen->set_termpos (message->termpos);
|
||||
term_gen->index_text (text);
|
||||
/* Create a term gap, as above. */
|
||||
message->termpos = term_gen->get_termpos () + 100;
|
||||
|
||||
return NOTMUCH_PRIVATE_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,15 @@ test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] searchbyfrom@example.
|
|||
|
||||
test_begin_subtest "Search by from: (name)"
|
||||
add_message '[subject]="search by from (name)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[from]="Search By From Name <test@example.com>"'
|
||||
output=$(notmuch search from:"Search By From Name" | notmuch_search_sanitize)
|
||||
output=$(notmuch search 'from:"Search By From Name"' | notmuch_search_sanitize)
|
||||
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)"
|
||||
|
||||
test_begin_subtest "Search by from: (name and address)"
|
||||
output=$(notmuch search 'from:"Search By From Name <test@example.com>"' | notmuch_search_sanitize)
|
||||
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)"
|
||||
|
||||
test_begin_subtest "Search by from: without prefix (name and address)"
|
||||
output=$(notmuch search '"Search By From Name <test@example.com>"' | notmuch_search_sanitize)
|
||||
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)"
|
||||
|
||||
test_begin_subtest "Search by to: (address)"
|
||||
|
@ -69,7 +77,15 @@ test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; s
|
|||
|
||||
test_begin_subtest "Search by to: (name)"
|
||||
add_message '[subject]="search by to (name)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[to]="Search By To Name <test@example.com>"'
|
||||
output=$(notmuch search to:"Search By To Name" | notmuch_search_sanitize)
|
||||
output=$(notmuch search 'to:"Search By To Name"' | notmuch_search_sanitize)
|
||||
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
|
||||
|
||||
test_begin_subtest "Search by to: (name and adress)"
|
||||
output=$(notmuch search 'to:"Search By To Name <test@example.com>"' | notmuch_search_sanitize)
|
||||
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
|
||||
|
||||
test_begin_subtest "Search by to: without prefix (name and adress)"
|
||||
output=$(notmuch search '"Search By To Name <test@example.com>"' | notmuch_search_sanitize)
|
||||
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
|
||||
|
||||
test_begin_subtest "Search by subject: (phrase)"
|
||||
|
@ -129,4 +145,42 @@ add_message '[subject]="utf8-message-body-subject"' '[date]="Sat, 01 Jan 2000 12
|
|||
output=$(notmuch search "bödý" | notmuch_search_sanitize)
|
||||
test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; utf8-message-body-subject (inbox unread)"
|
||||
|
||||
|
||||
cat <<EOF > ${MAIL_DIR}/termpos
|
||||
From: Source <source@example.com>
|
||||
To: Dest <dest@example.com>
|
||||
Subject: part overlap test
|
||||
Date: Sat, 01 January 2000 00:00:00 +0000
|
||||
Message-ID: <termpos>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/mixed; boundary="==-=="
|
||||
|
||||
--==-==
|
||||
Content-Type: text/plain
|
||||
|
||||
a b c
|
||||
|
||||
--==-==
|
||||
Content-Type: text/plain
|
||||
|
||||
x y z
|
||||
|
||||
--==-==--
|
||||
EOF
|
||||
notmuch new > /dev/null
|
||||
|
||||
test_begin_subtest "headers do not have adjacent term positions"
|
||||
# Regression test for a bug where term positions for non-prefixed
|
||||
# terms weren't updated
|
||||
output=$(notmuch search id:termpos and '"com dest"')
|
||||
test_expect_equal "$output" ""
|
||||
|
||||
test_begin_subtest "parts have non-overlapping term positions"
|
||||
output=$(notmuch search id:termpos and '"a y c"')
|
||||
test_expect_equal "$output" ""
|
||||
|
||||
test_begin_subtest "parts do not have adjacent term positions"
|
||||
output=$(notmuch search id:termpos and '"c x"')
|
||||
test_expect_equal "$output" ""
|
||||
|
||||
test_done
|
||||
|
|
Loading…
Reference in a new issue