Commit Graph

477 Commits

Author SHA1 Message Date
Jonas Bernoulli f31d1b065d Fix typos 2019-11-06 16:13:39 +01:00
Yuri D'Elia b609080d77 Process personal flag when adding new contacts 2019-08-16 13:06:12 +02:00
Yuri D'Elia 230df78780 Avoid wrong type/warning in comparison 2019-08-16 11:50:40 +02:00
Yuri D'Elia b71b60704b Update internal cache in set_personal_addresses 2019-08-16 11:44:35 +02:00
Dirk-Jan C. Binnema 74f9f78ec0 lib: Don't use Xapian::DatabaseNotFoundError, it's too new
Xapian::DatabaseNotFoundError only arrived with Xapian 1.4.10.
2019-08-03 11:06:50 +03:00
Dirk-Jan C. Binnema 63b556da6d mu-util: fix warning 2019-08-01 22:44:03 +03:00
Dirk-Jan C. Binnema fc0ea805f5 mu-msg-fields: Mark contact fields as phrase-enabled 2019-08-01 22:11:39 +03:00
Dirk-Jan C. Binnema a8752e28c3 mu-store.hh: add it; it was missing 2019-07-31 17:19:23 +03:00
Dirk-Jan C. Binnema be4860befe tests: update for lib/mu-store changes 2019-07-30 08:51:04 +03:00
Dirk-Jan C. Binnema 83d6484f86 lib/mu-store: rework implementation
* mu-store.h, mu-store-read.cc, mu-store-write.cc, mu-store-priv.hh have been reworked
   in mu-store.{cc,hh}, it the mix of c/c++ improved
 * update all the dependent modules
 * make it easier to upgrade an database in place (without user intervention)
 * remove the xbatch-size option
2019-07-30 08:51:04 +03:00
Dirk-Jan C. Binnema b7cda29b96 mu-runtime: include string
Was missing, and breaks compilation in some environments.
2019-07-18 16:17:04 +03:00
Dirk-Jan C. Binnema 632f383c38 mu: Default to XDG Base Directory Specification
Instead of using ~/.mu, use the XDG Base Directory Specification, typically:
  ~/.cache/xapian
  ~/.cache/mu.log
  ~/.cache/parts
  ~/.config/bookmarks

Update dependencies, documentation.
2019-07-13 16:00:28 +03:00
Dirk-Jan C. Binnema 69229a4228 mu: remove contacts-path leftovers
The contacts are now embedded in the xapian database, so we don't need
the contact-path anymore. Let's remove some leftovers.
2019-07-13 13:43:57 +03:00
Dirk-Jan C. Binnema 125176d397 mu/lib: merge mu-contacts.h => mu-contacts.hh 2019-07-13 13:43:57 +03:00
Dirk-Jan C. Binnema 8ec8ab5380 mu-contacts: remove newlines from addresses
Seems gmime passes them on; and it causes havoc with our contacts cache.

Bump database schema version to force an rebuild (since that's what's
required.)
2019-07-11 23:30:27 +03:00
Dirk-Jan C. Binnema 5440747ba4 mu: require glib >= 2.38; remove g_type_init calls
Minor cleanup.
2019-07-11 23:30:27 +03:00
djcb dc271f4721 mu-contacts: fix some compiler warnings 2019-05-25 10:39:40 +03:00
djcb 9edcae0203 update store, msg for new contacts-cache handling 2019-05-11 13:41:03 +03:00
djcb bd52902290 contacts: update test cases for updated contacts
Remove the old ones, add new ones.
2019-05-11 13:41:03 +03:00
djcb 8193cc3e4c contacts: rework: install in database
Rewrite the contacts-cache backend in c++

Store the contacts as metadata in the xapian database, rather than in a
separate file.

Update the Store to deal with this.
2019-05-11 13:41:03 +03:00
Evan Klitzke 0cc94468b3
Fix pedantic -Wparentheses warning emitted by gcc 9.0 2019-05-06 07:58:37 -07:00
djcb 6e8378ddcd mu: update crypto verify test 2019-03-24 11:54:12 +02:00
djcb bc891030f6 mu: fix utf-8 flatten 2019-03-24 11:43:51 +02:00
djcb da10f30adf utils: small optimization in utf8_flatten
In the common path, avoid building an unneeded std::string. This should
up in some profiles.
2019-03-23 17:00:25 +02:00
djcb 9bffb465bd mu: don't include text attachments as part of body
It's somewhat nice in some case, but not generally so; so let's not do
it.
2019-02-18 08:30:55 +02:00
Dirk-Jan C. Binnema d41242ff6c
Merge pull request #1359 from OnkelUlla/fix_compiler_warnings
Fix compiler warnings
2019-01-17 22:26:50 +02:00
Dirk-Jan C. Binnema 0903eaba79
Merge pull request #1284 from nicolasavru/limit-threading-set
Perform threading calculation on related set instead of entire result.
2019-01-13 22:53:45 +02:00
Ulrich Ölmann d37a961c8f parser: fix clang-7.0.1 warnings
Without this commit clang++-7.0.1 whines

|   CXX      parser.lo
| parser.cc:138:15: warning: braces around scalar initializer [-Wbraced-scalar-init]
|         return Tree({{Node::Type::Range},
|                      ^~~~~~~~~~~~~~~~~~~
2019-01-11 06:49:01 +01:00
Ulrich Ölmann 493a9efa7a mu, tests: fix gcc-8.2.0 warnings
Without this commit gcc-8.2.0 whines

|   CC       mu-msg-json.lo
| mu-msg-json.c: In function ‘get_temp_file_maybe’:
| mu-msg-json.c:254:14: warning: unused variable ‘tmpfile’ [-Wunused-variable]
|   char *tmp, *tmpfile;
|               ^~~~~~~
| mu-msg-json.c:254:8: warning: unused variable ‘tmp’ [-Wunused-variable]
|   char *tmp, *tmpfile;
|         ^~~
| mu-msg-json.c: In function ‘add_part_crypto’:
| mu-msg-json.c:276:21: warning: unused variable ‘s’ [-Wunused-variable]
|   char    *signers, *s;
|                      ^
| mu-msg-json.c:276:11: warning: unused variable ‘signers’ [-Wunused-variable]
|   char    *signers, *s;
|            ^~~~~~~
| mu-msg-json.c: In function ‘each_part’:
| mu-msg-json.c:332:14: warning: variable ‘cid’ set but not used [-Wunused-but-set-variable]
|   const char *cid;
|               ^~~

and

|   CC       test-mu-str.o
| test-mu-str.c: In function ‘test_mu_str_subject_normalize’:
| test-mu-str.c:282:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "test123", "test123" },
|      ^~~~~~~~~
| test-mu-str.c:282:16: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "test123", "test123" },
|                 ^~~~~~~~~
| test-mu-str.c:283:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "Re:test123", "test123" },
|      ^~~~~~~~~~~~
| test-mu-str.c:283:19: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "Re:test123", "test123" },
|                    ^~~~~~~~~
| test-mu-str.c:284:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "Re: Fwd: test123", "test123" },
|      ^~~~~~~~~~~~~~~~~~
| test-mu-str.c:284:25: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "Re: Fwd: test123", "test123" },
|                          ^~~~~~~~~
| test-mu-str.c:285:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "Re[3]: Fwd: test123", "test123" },
|      ^~~~~~~~~~~~~~~~~~~~~
| test-mu-str.c:285:28: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "Re[3]: Fwd: test123", "test123" },
|                             ^~~~~~~~~
| test-mu-str.c:286:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "operation: mindcrime", "operation: mindcrime" }, /*...*/
|      ^~~~~~~~~~~~~~~~~~~~~~
| test-mu-str.c:286:29: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "operation: mindcrime", "operation: mindcrime" }, /*...*/
|                              ^~~~~~~~~~~~~~~~~~~~~~
| test-mu-str.c:287:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "", "" }
|      ^~
| test-mu-str.c:287:9: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
|    { "", "" }
|          ^~
2019-01-11 06:48:51 +01:00
djcb 53c1b0a069 mu: make attachment test a bit looser
Consider all 'inline' text parts attachments too, unless they're
'text/plain' or something that looks like a signature.

It's a heuristic so we might get some new corner-cases.. let's see.
2018-12-30 18:46:43 +02:00
djcb 7b6bccd49a parser: avoid query parsing error
See #1261.
2018-11-11 13:15:08 +02:00
djcb a19b4ddb2d mu: implement mu_msg_to_json
Follows mu_msg_to_sexp, but instead uses json as the output format,
using json-glib.
2018-11-11 12:47:47 +02:00
djcb 93bd1b8ce7 mu: add soft dependency on json-glib
If it's available it will be used.
2018-11-11 12:12:36 +02:00
djcb 2aa299b3ac mu: add mu_msg_iter_is_(first|last)
This makes it a bit easier to process the output.
2018-11-11 12:11:06 +02:00
djcb e321d15c2a mu: fake reply-to for mailing-list posts
Some mailing lists do _not_ set reply-to, see e.g.,
   https://github.com/djcb/mu/pull/1278

In that case, use the 'List-Post' address instead, so the behavior is
the same (in mu4e) as for other mailing lists.
2018-11-04 12:31:32 +02:00
djcb 052a228be7 add optional support for building with asan 2018-11-04 12:31:32 +02:00
djcb aa70bf1920 Merge branch 'pr-1111'
Fix a bunch of conflicts, tests.
2018-08-18 10:29:40 +03:00
djcb aafeb82a6e mu: decode rfc-2047-encoded mailing lists
Fixes #1292.

Note: does require rebuilding the mu database (--rebuild).
2018-08-14 22:38:27 +03:00
djcb 93c6ff1f85 mu: protect against overly long keys
We got some errors when some of the key values exceeded the Xapian
maximum; in particular the message-id.

So make all the key-methods check, and truncate the message-id if
necessary.
2018-08-14 21:57:33 +03:00
Nicolas Avrutin eb9bfbb1ca Perform threading calculation on related set instead of entire result.
The current threading algorithm is applied to the entire result of a query, even
if maxnum is specified, and then the result of the threading algorithm is
truncated to maxnum. The improves threading results by returning the entire
thread even when only a single message makes it into the top maxnum results.

This commit applies the threading algorithm to the related message set of the
maxnum-truncated query result instead of to the entire query result. For a given
set of messages, the set of messages which will share threads with any of the
original messages is exactly the related message sets. Put another way, either
any messages returned by the original query but removed by the maxnum truncation
will also be returned by the related message query, or they would not have been
needed anyway because they would not be members of any visible thread.

To maintain backward compatibility and allow threading to be used without
including related messages, the related message set is found for the threading
calculation, but any messages which would not have matched the original query
are then pruned, resulting in a superset of the truncated query, but a subset of
the untruncated query.

This does not improve (or degrade) the run time of a threading calculation when
maxnum is not set, but significant improves it when maxnum is set by making it
scale (roughly) linearly in terms of maxnum. On a maildir with ~200k messages
and maxnum set to 500 (the default), the run time of a threading calculation is
lowered from ~1m to ~0.1s.

Perform threading calculation on related set instead of entire result.

The current threading algorithm is applied to the entire result of a query, even
if maxnum is specified, and then the result of the threading algorithm is
truncated to maxnum. The improves threading results by returning the entire
thread even when only a single message makes it into the top maxnum results.

This commit applies the threading algorithm to the related message set of the
maxnum-truncated query result instead of to the entire query result. For a given
set of messages, the set of messages which will share threads with any of the
original messages is exactly the related message sets. Put another way, either
any messages returned by the original query but removed by the maxnum truncation
will also be returned by the related message query, or they would not have been
needed anyway because they would not be members of any visible thread.

To maintain backward compatibility and allow threading to be used without
including related messages, the related message set is found for the threading
calculation, but any messages which would not have matched the original query
are then pruned, resulting in a superset of the truncated query, but a subset of
the untruncated query.

This does not improve (or degrade) the run time of a threading calculation when
maxnum is not set, but significant improves it when maxnum is set by making it
scale (roughly) linearly in terms of maxnum. On a maildir with ~200k messages
and maxnum set to 500 (the default), the run time of a threading calculation is
lowered from ~1m to ~0.1s.
2018-07-09 02:41:22 -04:00
djcb 2d954e9647 mu: fix strncpy usage
Ensure the resulting strings are \0-terminated.
2018-06-11 09:18:27 +03:00
djcb 7a8d43dc5f only use OP_WILDCARD for xapian >= 1.3.3
It's not available for earlier versions.
2018-05-19 22:22:41 +03:00
djcb 6290e4ad9a query-parser: special-case wildcards
We were transforming wild-card searches into regular-expression
searches; while that works, it's also significantly slower.

So, instead, special-case wildcards, and use the Xapian machinery for
wildcard queries.
2018-05-19 11:20:58 +03:00
Marcelo Henrique Cerri 297120dc6c lib: add last_child flag to thread information
With that flag it's possible to reconstruct the entire thread tree
structure in mu4e.
2018-04-23 01:05:54 -03:00
djcb b4cc67d455 parser/tests: allow for DST change
e.g. 21d / 2w are subject to DST; update the tolerance.
2018-03-31 18:44:17 +03:00
djcb 0356af5c98 mu: avoid runtime warning 2018-03-31 13:17:06 +03:00
djcb ebbe3ea023 mu: _XOPEN_SOURCE: fix typo 2018-03-10 13:05:44 +02:00
djcb 6fe67b354d lib/parser: fix month days
In the olden days, we stored dates like e.g. 20180131121234, and do a
lexicographical check. With that, we could use e.g. upper-limits
201802312359 for "all dates in Feb 2018", even if Feb doesn't have 31
days.

However, nowadays we use time_t values, and g_date_time_new_local raises
errors for non-existent days; easiest fix is to massage things a bit; so
let's do that.

Fixes issue #1197.
2018-02-17 18:07:13 +02:00
djcb 15ba4699ab lib/parser: use g_vasprintf, _XOPEN_SOURCE
Attempt to restore building on Cygwin.
2018-02-11 12:02:53 +02:00
djcb 620912c62b mu: support 'raw' query (internally)
Allow for passing 'raw' queries to xapian, without any parsing.
2017-12-03 22:16:32 +02:00