Commit Graph

975 Commits

Author SHA1 Message Date
Dirk-Jan C. Binnema 5b121352c2 utils: Handle failing g_date_time_new_...
Possibly, this caused a crashed under some scenarios (though couldn't reproduce).
2022-03-07 22:28:40 +02:00
Dirk-Jan C. Binnema 52c31afef1 contacts-cache: refactor personal check 2022-03-07 06:50:18 +02:00
Dirk-Jan C. Binnema 00d9fb121f utils: add rename has_flag into one_if in BITOPS 2022-03-07 06:50:18 +02:00
Dirk-Jan C. Binnema 04913d8ea9 tests: update for mu-message-fields 2022-03-07 06:50:18 +02:00
Dirk-Jan C. Binnema f576fc59b9 server: use mu-message-fields 2022-03-07 06:50:18 +02:00
Dirk-Jan C. Binnema a8654a616a lib/store: use mu-message-fields 2022-03-07 06:50:18 +02:00
Dirk-Jan C. Binnema 0df7a6959a lib/query,parser: update to use mu-message-fields 2022-03-04 00:06:31 +02:00
Dirk-Jan C. Binnema 7c185590e4 lib/mu-msg: update to use mu-message-fields
Remove mu-msg-fields.[ch] and update sources to use mu-message-fields.
2022-03-04 00:04:30 +02:00
Dirk-Jan C. Binnema c3ae3da0de lib: update mu-contact-{fields,contact,flags,priority}
Improve cohesion and tests.
2022-03-04 00:02:52 +02:00
Dirk-Jan C. Binnema 58af12add6 mu-message-field: Implement
Implement Mu::MessageField, which replace MuMsgField with something a bit more
modern.
2022-02-26 11:11:04 +02:00
Dirk-Jan C. Binnema 5417928c1e utils: add has_flag to MU_ENABLE_BITOPS 2022-02-26 10:09:31 +02:00
Dirk-Jan C. Binnema 38d08bad85 utils: add STR_V macro for printing string_view 2022-02-26 10:09:31 +02:00
Dirk-Jan C. Binnema 08534b31e6 mu-message-contacts: fix naming in tests 2022-02-26 09:38:17 +02:00
Dirk-Jan C. Binnema 1966dcb795 mu-server: turn off renaming for 'view' now
It seems to confuse mbsync, see issue #2214.
2022-02-25 23:05:36 +02:00
Dirk-Jan C. Binnema cfc68732e7 message-contact: remove control characters from names
I.e., issue #2216.
2022-02-25 23:05:36 +02:00
Dirk-Jan C. Binnema 285185aac7 lib: add unit tests for message priority / flags
We already had _compile-time_ tests; but for coverage it's useful to make those
available as runtime-tests, too.
2022-02-22 23:29:55 +02:00
Dirk-Jan C. Binnema 273f84483a utils: some more convenience for error/result 2022-02-22 23:07:30 +02:00
Dirk-Jan C. Binnema 4990792f02 utils: rework Mu::split
And add some tests, cleanups.
2022-02-22 23:07:30 +02:00
Dirk-Jan C. Binnema af87cde217 utils/mu-date: remove
Remove mu-date.[ch] and convert its last users to use time_to_string instead.
2022-02-22 23:07:29 +02:00
Dirk-Jan C. Binnema 0e117fd6ab utils: improve assert_equal macro
make it a macro so we get line numbers etc
2022-02-21 23:51:46 +02:00
Dirk-Jan C. Binnema ec826cd838 tests: update naming 2022-02-21 23:51:46 +02:00
Dirk-Jan C. Binnema 4eddf4e6ba update unit tests 2022-02-21 23:51:46 +02:00
Dirk-Jan C. Binnema 7822d2633e update contacts-cache users for MessageContact
Since contacts-cache now uses MessageContact, update its users
2022-02-21 23:51:46 +02:00
Dirk-Jan C. Binnema 4b9814be25 contacts-cache: Rework to use MessageContact
Replace the internal ContactInfo with MessageContact, so we can use the same
type throughout.
2022-02-21 23:51:46 +02:00
Dirk-Jan C. Binnema a82bd77d09 lib: rename contacts into contacts-cache
Plus dependents.
2022-02-21 23:22:42 +02:00
Dirk-Jan C. Binnema 39c45abc38 mu-store: use Mu::MessageContact
Use the new contact class. And a lot of whitespace cleanups.
2022-02-21 23:22:42 +02:00
Dirk-Jan C. Binnema 3aa053e158 mu-msg: use Mu::MessageContact
Use the new contact class
2022-02-21 23:22:42 +02:00
Dirk-Jan C. Binnema d436a47c1f lib: Implement Mu::MessageContact
Implement a new struct Mu::MessageContact to usurps some of the different types
for contact information.

Sprinkle some "modern C++" on it for convenience.
2022-02-21 23:22:42 +02:00
Dirk-Jan C. Binnema 69a465d849 mu-sexp: add some small conveniences 2022-02-20 14:08:53 +02:00
Dirk-Jan C. Binnema be2f91c0ad build: update autotools build 2022-02-19 19:32:02 +02:00
Dirk-Jan C. Binnema 1a13e4f0fd mu-message-priority: set namespace correctly 2022-02-19 19:16:49 +02:00
Dirk-Jan C. Binnema 8cea933a51 mu-store: take mu_util_get_hash
mu-store is the only user left, move the implementation there.
2022-02-19 19:09:25 +02:00
Dirk-Jan C. Binnema c0da564bba lib: fix clang compatibility / warnings 2022-02-18 10:49:56 +02:00
Dirk-Jan C. Binnema fe2b1693c1 lib/message-flags: update whitespace & clang++ appeasement 2022-02-18 07:12:56 +02:00
Dirk-Jan C. Binnema 80f947024a server: lock run_query
So the query-results don't outlive the lock.
2022-02-17 23:49:17 +02:00
Dirk-Jan C. Binnema 831d26052a store: expose the mutex so we can lock query-results
The QueryResults must not outlive the lock (when in a MT context), so expose for
clients (mu-server) to handle it.
2022-02-17 23:49:17 +02:00
Dirk-Jan C. Binnema 4eabf1a64a *: update for for mu-maildir changes
Update the dependencies.
2022-02-17 23:48:59 +02:00
Dirk-Jan C. Binnema abd2a4a8f1 lib: Update mu-maildir for modern times
Update the good-old mu-maildir to be a bit more... modern.
2022-02-17 23:48:59 +02:00
Dirk-Jan C. Binnema 1db70c05e6 utils/async-queue: appease helgrind
We used notify_one _outside_ the lock; that should be just fine... but helgrind
doesn't like it, so let's appease it.
2022-02-17 23:48:59 +02:00
Dirk-Jan C. Binnema f6f17d5d6b *: update code for Mu::MessageFlags
Migrate the code to use the new niceness
2022-02-17 23:48:59 +02:00
Dirk-Jan C. Binnema 473134a7b1 lib: replace MuFlags with Mu::MessageFlags
Modernize the ancient MuFlags code to C++17
2022-02-16 23:18:16 +02:00
Dirk-Jan C. Binnema c5538d5b14 utils: update optional & expected
Use the latest upstream versions.
2022-02-16 23:18:16 +02:00
Dirk-Jan C. Binnema bc44666d88 mu-str: Remove some dead code 2022-02-16 21:55:02 +02:00
Dirk-Jan C. Binnema dce924da9c mu-error: Better support for GError
Allow filling a GError from a Mu::Error
2022-02-16 21:55:02 +02:00
Dirk-Jan C. Binnema 80cbf7c75b utils: Improve Mu::Result
Ensure the Ok() and Err() actually work, and add support for Result<void>
2022-02-16 21:55:02 +02:00
Dirk-Jan C. Binnema 6ff1831200 utils: make MU_ENABLE_BITOPS more constexpr 2022-02-14 11:12:38 +02:00
Dirk-Jan C. Binnema 3086238b33 store: expose metadata()/set_metadata()
Allow for storing metadata in the database, and consider the cache.
2022-02-14 11:12:26 +02:00
Dirk-Jan C. Binnema 3820118246 store: rename "metadata" into "properties"
properties are the constant (for the duration) values for a store; metadata may
change, so reserve that name for that.
2022-02-14 11:12:26 +02:00
Dirk-Jan C. Binnema 23fc8bdba8 update code for Mu::MessagePriority
Update dependent code
2022-02-14 11:12:26 +02:00
Dirk-Jan C. Binnema 13bcc6eb5d lib: replace MuMsgPrio with Mu::MessagePriority
Rework good-old MuMsgPrio into Mu::MessagePriority, which looks a bit more like
modern C++.
2022-02-14 11:12:16 +02:00
Dirk-Jan C. Binnema a0ec982789 mu4e/server: honor rename-move for view-message, too
It's technically a 'move', so apply user preference.
2022-02-13 14:33:12 +02:00
Dirk-Jan C. Binnema 43c44cf6cd store: catch dtor exception 2022-02-07 22:34:49 +02:00
Dirk-Jan C. Binnema 18ddbe06e6 indexer: fix some threading issues with Progress
Make it a const object with atomic members.
2022-02-07 20:49:43 +02:00
Dirk-Jan C. Binnema a628f214a1 index: fix thread-sanitizer issue
Need a lock to access workers_;
2022-02-07 18:03:53 +02:00
Dirk-Jan C. Binnema e818e94d0e build: fix some scan-build warnings 2022-02-07 17:36:34 +02:00
Dirk-Jan C. Binnema 8493e8649d mu-utils: try g_autoptr/g_autofree
It's useful, but let's if it works for all targets.
2022-02-06 14:18:23 +02:00
Zero King d0a3ca3453 utils: validate string before g_utf8_next_char() 2022-02-06 14:18:23 +02:00
Dirk-Jan C. Binnema c3503ba663 server: flush the "indexing complete" message 2022-02-06 14:18:23 +02:00
Dirk-Jan C. Binnema 77bca5463f store: don't lock for_each_term
It's only called from the parser with a store, and when we _already_
hold the lock.
2022-02-05 08:44:43 +02:00
Dirk-Jan C. Binnema 4d0ecf7f85 server: make indexing asynchronous
Perform indexing in a background thread.
2022-02-03 23:04:18 +02:00
Dirk-Jan C. Binnema b6d7d142f6 server: support flushing the output
So we can get some progress output
2022-02-03 23:04:18 +02:00
Dirk-Jan C. Binnema 05393ba797 index: save/commit metadata after messages
Ensure the metadata (dirstamps) for messages are only written / committed _after_
the accompanying message have been written / committed.

This avoids missing updates when indexing gets terminated unexpectedly.
2022-02-03 23:04:18 +02:00
Dirk-Jan C. Binnema ebc9b88f80 store/query: update for new store/query api
Update to the new API.
2022-01-30 14:52:41 +02:00
Dirk-Jan C. Binnema 5fc8a8f83e store/query: access query only through store
Make Mu::Query only accessible through store, so we can lock the db for the
duration of a (full, multipass) query.
2022-01-30 14:52:41 +02:00
Dirk-Jan C. Binnema f035c801bb store: save contacts more often
Use the new Contacts::dirty() so serialize/save the contacts whenever we commit
a transaction.

And some cosmetics.
2022-01-15 15:12:38 +02:00
Dirk-Jan C. Binnema ca4651a891 mu-contacts: add dirty()
Maintain a "dirtiness" number, which increases with changes, and resets after
serialize().
2022-01-15 15:11:26 +02:00
Dirk-Jan C. Binnema dfe592ac4f mu-server: check for message readability
When querying, avoid showing any messages that do not exists on the file system.
2022-01-15 10:21:32 +02:00
Dirk-Jan C. Binnema 08dc66a525 mu-utils: Fix compiler warning 2022-01-14 17:10:16 +02:00
Dirk-Jan C. Binnema ec41585dab mu-msg-file: check for top-level s/mime
Update the content flags for top-level S/MIME encrypted & signed.
2022-01-09 11:36:39 +02:00
Dirk-Jan C. Binnema 4f02702510 store: add catch blocks for dirstamp/set_dirstamp 2021-12-18 15:22:52 +02:00
Dirk-Jan C. Binnema abd0abf5c8 mu-msg-file: don't insist on absolute path
Since we make it absolute anyway (g_canonicalize_file); this avoid an annoying
error when using mu view with a relative path.
2021-12-18 15:22:52 +02:00
Dirk-Jan C. Binnema 3001c7832d tests: add unit test for cjk handling
This test exposes some problem finding longer CJK strings; see: issue #1428.
The test does not _pass_ yet, so skip it for now.
2021-11-22 22:23:18 +02:00
Dirk-Jan C. Binnema 0ade4ecfa7 indexer: fix race condition
It was possible for the worker to stop before the work was even started; and
then we might wait forever for the queue to become empty.
2021-11-22 21:52:01 +02:00
Dirk-Jan C. Binnema f71c05805c build: Add some Xapian deps
Fixes: issue #2178.
2021-11-12 23:11:45 +02:00
Dirk-Jan C. Binnema e672f952a8 index: ignore .update when store is empty
This somewhat emulates the 1.4 behavior.
2021-11-11 21:58:23 +02:00
Dirk-Jan C. Binnema 503d7224e0 mu: update the index 'processed' -> 'checked'
The 'processed' statistic for indexing was more-or-less synonymous for
'updated'; let's change to something more useful, 'checked' which roughly means
the number of messages checked for updates (typically a cheap timestamp check).
2021-11-10 22:32:28 +02:00
Dirk-Jan C. Binnema c9e958d65c utils: add Mu::time_to_string
Helper function to format strings (a-la strftime).
2021-11-10 22:32:28 +02:00
Dirk-Jan C. Binnema 4c0d8572d8 store/indexer: move transaction handling to store
Move the transaction handling code inside Store, simplifying the indexer.
2021-11-09 22:43:11 +02:00
Dirk-Jan C. Binnema 48d3f9cfab tests: move to subdir, move to meson
De-clutter the source directories a bit. Ensure tests build with meson, and
remove from autotools in a few places (no need to do things twice).
2021-11-08 23:58:05 +02:00
Dirk-Jan C. Binnema 6bea54805f build: fix compiler warning
guile: some clang warning

and ensure we get the right Xapian in all places, and fileno is defined.
2021-11-05 09:02:24 +02:00
Dirk-Jan C. Binnema 1c851315ca build: ensure correct xapian.h is found 2021-11-03 22:13:49 +02:00
Dirk-Jan C. Binnema 8028f88a51 mu: rework xapian dependencies a bit
Reduce the places where we need to include Xapian, and add a few places where
the (meson build) didn't explicitly have a Xapian dep where needed.
2021-11-03 12:34:08 +02:00
Dirk-Jan C. Binnema 388f18a278 utils: add from_gchars
To copy into a std::string & free.
2021-11-02 22:24:17 +02:00
Dirk-Jan C. Binnema 4e6f2a3c26 mu: remove some unneeded code
Dead code, and replace mu_canonicalize_filename with g_canonicalize_filename.
2021-11-02 22:20:58 +02:00
Dirk-Jan C. Binnema 9a2fd441c5 mu-query: honor maxnum in threaded queries 2021-10-23 11:06:45 +03:00
Dirk-Jan C. Binnema f17995b113 lib/server: send query results in batches
Instead of one message (header) at a time, send batches of them; this allows for
much faster handling in mu4e.
2021-10-22 08:33:51 +03:00
Dirk-Jan C. Binnema e46347aa54 lib/index/scanner: tidy up a bit
Use strcmp instead of hand-optimized. Avoid tmp/ directories.
2021-10-22 08:33:51 +03:00
Dirk-Jan C. Binnema 428dddd74e lib/mu: fix a few leaks
Thanks to valgrind
2021-10-20 23:06:28 +03:00
Dirk-Jan C. Binnema 701ca75536 mu4e/server: split message / metadata
Split message and metadata, so we can use pristine (possibly pre-cached)
messages. Update dependencies.
2021-10-20 22:41:48 +03:00
Dirk-Jan C. Binnema 89014ecd06 index/store: simplify transaction handling
only have transactions for indexing, and make it opportunistic. All other ops do
not use transactions.
2021-10-20 20:14:25 +03:00
Dirk-Jan C. Binnema 3dd721d5a3 clang-format: update c/cc coding style
Update all cc code using .clang-format; please do so as well for future PRs
etc.; emacs has a handy 'clang-format' mode to make this automatic.

For comparing old changes with git blame, we can disregard this one using
--ignore-rev

(see https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame )
2021-10-20 12:26:16 +03:00
Dirk-Jan C. Binnema 3e4771ad1c mu-options: avoid clang warning 2021-10-18 22:32:46 +03:00
Dirk-Jan C. Binnema 49637dbc3a lib: replace CATCH_BLOCK macros with template magic 2021-10-18 21:52:37 +03:00
Dirk-Jan C. Binnema 672d0c7238 store: don't try to commit when there's no transaction
Avoids some error warning.
2021-10-16 11:15:19 +03:00
Dirk-Jan C. Binnema 1a449dd885 meson.build: Improve guile detection 2021-10-16 11:15:12 +03:00
Dirk-Jan C. Binnema 9bcebb5cf8 build: avoid some compiler warnings 2021-09-02 23:36:43 +03:00
Dirk-Jan C. Binnema 87ac89b082 index: rely less on dir tstamp when indexing
Let's use the _current time_ (time(NULL)) instead of the dir-tstamp for a maildir;
this avoids re-indexing mail where the mails have a newer time, but their
directory hasn't (e.g. 'touch')

Experimental, let see how this works.
2021-09-02 23:16:24 +03:00
Dirk-Jan C. Binnema e3080e39ab lib/mu-server: remove unneeded code
With the demise of the old mu4e-view, we can get rid of extract / verify.
2021-08-29 21:40:42 +03:00
Dirk-Jan C. Binnema b465c1f779 index: make lazy check less lazy
We got many reports where the 'lazy check' didn't work too well for
people... so make it a bit less lazy, so it'll just work for more
people.

In practice, never skip _directories_ unless they're leaf directories;
this avoids the mtime-does-not-bubble-up problem.
2021-08-12 17:56:00 +03:00
Dirk-Jan C. Binnema ab51f1553b thread-subject: make even laxer:
compare subject from the *last* plus any spaces.
2021-08-11 22:24:28 +03:00
Dirk-Jan C. Binnema 9a31225ef4 thread-subject: ignore '<prefix>:' when comparing
Should catch most cases.

Fixes: #2083.
2021-08-11 15:16:54 +03:00
Dirk-Jan C. Binnema b7844358d2 threads: recurse thread-subject check
Not only check for duplicate subjects in *siblings*, also recurse into
the children. This remove some clutter from deeply nested threads.

Fixes: #2078.
2021-08-10 22:10:39 +03:00
Dirk-Jan C. Binnema 16a2cffc11 utils: use _GNU_SOURCE for S_ISLINK on freebsd
Unbreak FreeBSD build.

Fixes: #2079.
2021-08-08 15:15:51 +03:00
Dirk-Jan C. Binnema e52683f0ed server: when marking-as-read, include duplicates
When marking a message a read, do the same for the duplicates; this
was the old behavior and the intention of the new behavior but didn't
quite work.

Fixes: #2071.
2021-08-04 23:55:41 +03:00
Dirk-Jan C. Binnema e26767b842 mu-server: mark _all_ messages with message-id as read
Not just the one we're viewing.
2021-08-03 22:17:56 +03:00
Dirk-Jan C. Binnema 78ef8ddcbb mu-store: fix warning schema mismatch message
Fixes: #2069.
2021-07-31 17:54:33 +03:00
Dirk-Jan C. Binnema fd9cc6bcc4 mu-store: improve database schema error
Tell user they should mu-init
2021-07-31 01:47:21 +03:00
Dirk-Jan C. Binnema 34fae2c072 mu-store: update whitespace 2021-07-31 01:45:22 +03:00
Dirk-Jan C. Binnema 1998505679 index: update removed value in progress report
Fixes: #2016
2021-07-29 23:26:40 +03:00
Dirk-Jan C. Binnema c8a2151cb9 mu: use g_strerror instead of strerror
Some #includes were missing for the latter (but only noticeable on some
systems - e.g., build breaks on Cygwin).

So let's replace with something that works equally everywhere.

Fixes: #2060
2021-07-29 00:02:30 +03:00
Dirk-Jan C. Binnema 7fa80f77e9 index: don't assume very fast machine cfg drive
The scanner had a timeout for scanning, which doesn't work too well with
machine with rel. fast disks / rel. slow machines. Which I don't happen
to have!

Let's remove the timeout, should help with getting unwanted timeouts
which would cut short the indexing.
2021-07-28 17:04:39 +03:00
Nicolas Avrutin ee4bf5664a query: fix include-related.
mu-query.cc:
- make_related_enquire: don't include first query in qvec, we already have all
  thread IDs we need to query in thread_ds.
- run_related: always sort first query by date, explained by the comment.
- run_related: include qflags (in particular ascending vs descending) in
  leader_qflags.
- run_theaded: don't limit results to maxnum, that results in threads
  potentially being cut off.

mu-server.cc:
- output_sexp: don't limit results to maxnum so as to match the behaviour of
  mu find (and avoid cuttong off threads).

Fixes #1924 and #1911.
2021-07-11 16:23:39 -04:00
Dirk-Jan C. Binnema 619509eb56 query-results: remove GatherThreadIds
We can't really do that in the match-decider, since we get _all_ messages
there, not the <n>-limited.

And some whitespace changes.
2021-06-17 20:54:59 +03:00
Dirk-Jan C. Binnema 6caa9acb34 query-match-deciders: whitespace 2021-06-17 20:54:59 +03:00
Dirk-Jan C. Binnema 047c10453a query: gather related ids from mset, not match-decider
Since we only want the (smaller) set from the mset, not the (full) set
that the match-decider sees.
2021-06-04 00:54:28 +03:00
Dirk-Jan C. Binnema 473d3998ce mu: calculate thread subjects
Calculate the thread subject, that is, the subject of the (sub)thread _or_
empty if it's the same as the previous subject.

This is for the UI feature of _not_ showing the subject when it's just
repeating from the previous.
2021-05-04 17:34:47 +03:00
Dirk-Jan C. Binnema 8c9430a09a query: improve thread-date handling
And make it available in query_match, so we can expose it to elisp.
2021-05-02 23:30:32 +03:00
Dirk-Jan C. Binnema bed6058fdc mu-server: add thread-date as emacs timestamp
So we can more easily deal with it from elisp.
2021-05-02 23:30:32 +03:00
Dirk-Jan C. Binnema b8f8ffa967 mu-sexp: make lists printable
And some typo fixes
2021-05-02 23:30:32 +03:00
Dirk-Jan C. Binnema 38f7075daa mu-server: use orphan, not empty-parent
So we use only one term.
2021-05-02 23:30:32 +03:00
Nicolas Avrutin 8ccd8f5425 threads: fix flag handling of orphan children
Even if a container has no query_match, it may still have children that need to
have flags applied.

This was broken by 6ff9829ce1.

Fixes: #1995
2021-05-02 14:27:11 -04:00
Derek Zhou dc6f76d74d seperate Mu::format and Mu::vformat 2021-04-22 18:32:38 +00:00
Dirk-Jan C. Binnema 750a9d1626 query: Better debug logging 2021-03-17 18:33:45 +02:00
Dirk-Jan C. Binnema 08890dee2d lib/sexp: Clean up contact name/email
Don't allow control characters.

Fixes: #1944.
2021-03-16 17:10:35 +02:00
Dirk-Jan C. Binnema f56aca7c23 lib/contacts: Use remove_ctrl
Use the new helper function rather than `wash'.
2021-03-16 17:09:37 +02:00
Dirk-Jan C. Binnema 15aca5e396 utils: cleanup whitespace 2021-03-16 17:07:39 +02:00
Dirk-Jan C. Binnema 725826231f utils: Add remove_ctrl
Add a helper function to remove control characters / multi-spaces, and a
test.
2021-03-16 16:51:01 +02:00
Dirk-Jan C. Binnema 6e9a60c385 mu: fix some compiler warnings
and whitespace.
2021-03-12 22:20:48 +02:00
Dirk-Jan C. Binnema 98abcf8e84 store: support in-memory database
For testing, this is faster / and doesn't pollute the file system.
2021-02-16 19:32:15 +02:00
Dirk-Jan C. Binnema 98a742e5e5 query: honor maxnum in threaded searches 2021-02-15 22:45:33 +02:00
Dirk-Jan C. Binnema 45655da948 mu-msg-file: calculate sha1 for messages
And use this to generate a message-id for messages that do not have one.
2021-02-15 22:29:38 +02:00
Dirk-Jan C. Binnema 108a33f16e query: avoid expected warning
Remove some debug leftover.
2021-02-15 21:43:47 +02:00
Dirk-Jan C. Binnema 579f841bdd query: filter out docs without query-matches
This avoid including unwanted messages in threaded results.
Also some cleanups.
2021-02-15 19:11:22 +02:00
Dirk-Jan C. Binnema bba8af8d51 mu-query: tweaks threaded/threaded querying 2021-02-13 00:48:07 +02:00
Dirk-Jan C. Binnema 50511a7460 mu-query: update deciders (avoid warning)
Don't report non-warning.
2021-02-12 23:48:02 +02:00
Dirk-Jan C. Binnema ffc809a01e query: improve thread-key-maker
For threading, we still get the _full_ set of messages (since the mset is
limited, but not the enquire); so no need to warn about docids we
haven't seen before.

Also, ensure the unwanted docids are sorted after the wanted ones.

Fixes: #1926.
2021-02-12 19:14:37 +02:00
Dirk-Jan C. Binnema 7a70942e67 build: experimental support for the meson build system 2021-02-12 00:49:35 +02:00
Dirk-Jan C. Binnema a3c6e74869 lib: replace some #define with constexpr
minor cleanup.
2021-02-11 18:54:25 +02:00
Dirk-Jan C. Binnema 936fd3f485 mu-query: sort "related" input by date
When doing 'related' searches, sort the initial (bounded) query results
by date, so we get the newest (or oldest)
2021-02-10 22:04:42 +02:00
Dirk-Jan C. Binnema 6ff9829ce1 lib: improve threaded sorting
Improve threaded sorting:
- rework the recursive algo (which should a crash noted earlier)
- sort by thread key (as in 1.5.7)

Fixes: #1923
Fixes: #1922
Fixes: #1911
Fixes: #1916
2021-02-10 12:35:19 +02:00
Dirk-Jan C. Binnema ba895bc65e mu-query-result: detect thread-subjects
Ongoing... try to determine the thread-subject, to be used in mu4e
later.
2021-01-29 22:44:45 +02:00
Dirk-Jan C. Binnema fdcbc5257d query-match-deciders: mark as leader / related
So we can use that as metadata later
2021-01-29 22:41:59 +02:00
Dirk-Jan C. Binnema ad86e2c4fc mu-contacts: cosmetic 2021-01-29 22:41:12 +02:00
Dirk-Jan C. Binnema 72fdfec3eb lib: clean up mu_msg_to_sexp API
move out the QueryMatch
2021-01-29 22:39:21 +02:00
Dirk-Jan C. Binnema e5a52e45fd mu-threads: improve sorting, duplicate handling
And add some more tests.
2021-01-27 22:28:58 +02:00
Dirk-Jan C. Binnema 7f70149c95 threads: don't assert on remove_child
Investigate this, seems to hit in the wild.
2021-01-25 21:44:02 +02:00
Dirk-Jan C. Binnema 3e64fdfb0f threads: avoid assert
The assert failure was spotted in the wild... we need to investigate,
but we can ignore it now to avoid SIGABRT.
2021-01-25 18:11:50 +02:00
Dirk-Jan C. Binnema 086999c2d1 query: in related/threaded mode, search all
In the related query, search _all_ messages, not just the amount asked;
this increases the chance of full threads.
2021-01-25 10:12:48 +02:00
Dirk-Jan C. Binnema cec25d3166 query: fix some typos 2021-01-25 10:11:46 +02:00
Dirk-Jan C. Binnema 01db0a4269
Merge pull request #1910 from rhgg2/contact-less-than-antisymmetric
Make order relation on contacts antisymmetric
2021-01-23 10:57:33 +02:00
Dirk-Jan C. Binnema 451fa65ffb build: fix compiler flags 2021-01-23 01:00:47 +02:00
Richard Garner f65bb4196c Make order relation on contacts antisymmetric 2021-01-23 09:07:35 +11:00
Dirk-Jan C. Binnema 3db19ce92b mu-msg-sexp: Improve list-post regexp
This should catch some more addresses.

Fixes: #1909.
2021-01-22 23:24:53 +02:00
Dirk-Jan C. Binnema 035a10ab49 remove obsolete threading tests 2021-01-22 23:24:53 +02:00
Dirk-Jan C. Binnema 98744c66f7 remove some dead code 2021-01-22 23:24:53 +02:00
Dirk-Jan C. Binnema 36684c9e97 mu: use sha-1 for fallback msgid
We were using a hash based on the path, but it's better to have
something that's constant even if the path chnages.
2021-01-22 22:53:35 +02:00
Dirk-Jan C. Binnema af386824f2 contacts: remove some dead code 2021-01-22 22:53:35 +02:00
Dirk-Jan C. Binnema fb34824232 contacts: only sort recent contacts by recency
Fixes: #1857
2021-01-22 22:51:33 +02:00
Dirk-Jan C. Binnema e282d80bc0 lib: Update for new querying machinery
Port to c++ and use new APIs.
2021-01-22 22:51:33 +02:00
Dirk-Jan C. Binnema 95dffb98a6 query: Rework querying/threading machinery
Rewrite the query machinery in c++:
- use an MSet decorator instead of the mu-msg-iter stuff
- use mu-query-decider to mark duplicates/unreadable/related messages
- use mu-query-threader to replace the older container/thread code

Algorithm did not substantially change, but the implementation details
did.
2021-01-20 14:09:04 +02:00
Dirk-Jan C. Binnema a3865d6ba9 index: wait with cleanup until work-queue is empty 2021-01-15 21:07:38 +02:00
Dirk-Jan C. Binnema 0ebf456612 lib: comment out some future unit test
Don't break the build!
2020-12-05 12:20:19 +02:00
Dirk-Jan C. Binnema ecafe54c99 parser: restore most unit tests 2020-12-05 11:42:54 +02:00
Dirk-Jan C. Binnema 3010e614a3 parser: using correct field for regexp expansion
Fixes: #1848
2020-12-05 11:42:54 +02:00
Dirk-Jan C. Binnema d0e357c150 utils: Improve option/result types
And add the beginnings of unit tests.
2020-11-28 10:46:38 +02:00
Dirk-Jan C. Binnema 4b6d9a0ce8 utils: add RAII stopwatch
For benchmarking
2020-11-28 10:46:38 +02:00
Evan Klitzke bd2fe50a74
use readdir(3) instead of deprecated readdir_r(3) in mu-maildir.c 2020-11-15 12:46:59 -08:00
Dirk-Jan C. Binnema 7d6475758c scripts: using GUILE_BINARY from configure
I.e., do not hard-code guile-2.2, it may be guile-3.0 instead.
2020-11-15 17:20:52 +02:00
Dirk-Jan C. Binnema c8b507f826 mu: remove obsolete MU_FEATURE_CRYPTO 2020-11-15 17:20:52 +02:00
Dirk-Jan C. Binnema 3f4e0cff62 mu-indexer: clean up state management 2020-11-15 17:20:52 +02:00
Dirk-Jan C. Binnema 558add3843 mu-msg: cosmetic 2020-11-15 17:20:52 +02:00
Dirk-Jan C. Binnema 702a1d8452 utils: add Result / Option types
Add some Rust-style Result/Option types, based on TartanLlama's
expected, optional classes.

There's std::optional of course, but we can't depend on C++17 yet.
2020-11-15 17:20:52 +02:00
Dirk-Jan C. Binnema a1d1619bda use c++ for some more sources
Do a (superficial) port to c++ of some of the c sources. Update
deps. Fix a few compiler warnings.
2020-11-07 14:11:59 +02:00
Dirk-Jan C. Binnema f7452761cb index: improve error handling 2020-11-07 11:43:11 +02:00
Dirk-Jan C. Binnema 26c1b9b6ad lib: remove unused json conversion
We no longer use the glib-json based impl.
2020-11-07 11:43:11 +02:00
Dirk-Jan C. Binnema c7a874b8d6 lib: convert threader/container to c++
Did change the code much, but it's now compiled as c++
2020-11-07 11:43:11 +02:00
Dirk-Jan C. Binnema ed4a640c39 lib/query: refactor & rework
- Move the lib/query/ stuff up a level into lib/
- Associate directly with the Query object
- Rework the Query object to be C++ rather than mixed with C
- Update all dependencies, tests
2020-11-04 23:35:30 +02:00
Dirk-Jan C. Binnema 2135844e1b fix some compiler warnings 2020-11-01 14:25:25 +02:00
Dirk-Jan C. Binnema 6b8ccff572 guile: avoid need for muldef 2020-11-01 14:04:15 +02:00
Dirk-Jan C. Binnema 72d9dba7cc lib/maildir: log when move-source still exists
Instead of raising an error... it *seems* this could happen with some mail
sync programs.
2020-11-01 14:04:15 +02:00
Dirk-Jan C. Binnema 812b5c3e65 server: improve help output 2020-11-01 14:04:15 +02:00
Dirk-Jan C. Binnema 69b157a346 lib: improve error handling, cleanups 2020-10-31 09:46:13 +02:00
Dirk-Jan C. Binnema aea64c4a08 mu/lib: refactor mu(-cmd)-server code
Split off the parsing/handling code from the mu command server into
mu-server, and only leave the external interface (the mu4e repl) in
mu-cmd-server.
2020-10-31 09:46:13 +02:00
Dirk-Jan C. Binnema d2aa1f91b0 mu: support json output directly
Allow for dumping json directly from the Sexp structures, so we don't
need any external libs (i.e. json-glib) anymore.
2020-10-26 18:39:56 +02:00
Dirk-Jan C. Binnema c223f858b7 mu4e: Add some extra logging to the mu-maildir 2020-10-22 20:16:41 +03:00
Dirk-Jan C. Binnema 2eb8fc82ad lib: fix 'personal' handling in contacts 2020-10-18 11:58:32 +03:00
Dirk-Jan C. Binnema dbff5671dd lib: support 'personal' regexp, move to mu-contacts
Move the determination of "personal" to MuContacts; add support for
regexps (POSIX-basic, in //)
2020-10-17 10:36:25 +03:00
Dirk-Jan C. Binnema 5cd6226ebd
Merge pull request #1813 from juanjosegarciaripoll/fix-renaming-separator
mu_maildir_get_new_path() did not use the right flags separator
2020-10-16 21:35:35 +03:00
Juan Jose Garcia-Ripoll fbad4760a4 Emacs did not use tabs in indenting mu-maildir.c 2020-10-16 19:34:55 +02:00
Juan Jose Garcia-Ripoll dd14ba64dd Fixed indentation and name / type conventions to match original 2020-10-16 19:22:52 +02:00
Dirk-Jan C. Binnema 9995d28927 mu: indexer: update dirstamp with statbuf st_mtime 2020-10-14 00:09:32 +03:00
Juan Jose Garcia-Ripoll e47c1f4f28 mu_maildir_get_new_path() did not use the right flags separator when creating new file names. 2020-10-10 18:20:16 +02:00
Juan Jose Garcia-Ripoll c885df06a1 Use g_stat() instead of stat() with GStatBuf 2020-10-02 09:51:33 +02:00
Dirk-Jan C. Binnema a4d6302dab mu-sexp: use std::vector instead of std::deque
Using deque gives compilation errors when compiling on
MacOS/clang (where it defaults to libc++ rather than gcc's libstdc++)

```
 #include <deque>
 struct Foo { std::deque<Foo> foos; };
 int  main() { Foo foo; }
```

So, let's use a vector instead; this is a drop-in replacement here, but
unfortunately in some future code...
2020-08-15 10:39:14 +03:00
Dirk-Jan C. Binnema 3691e28316 build: attempt to avoid some libc++ problems
Seems there are problems compiling mu with XCode 11.6 (see build tests);
apparently because of libc++ being different from libstdc++.

clang++ builds works fine as long as we're using libstdc++.
2020-07-26 11:56:25 +03:00
Jonas Bernoulli b711ad9151 Fix typos 2020-07-25 16:46:47 +02:00
Dirk-Jan C. Binnema 148c906d8a fix compilation error / clang warnings 2020-07-25 11:26:08 +03:00
Dirk-Jan C. Binnema 6cea9fcd71 mu-msg-sexp: Use list for list-post property
And some small cleanups.
2020-07-13 21:59:46 +03:00
Dirk-Jan C. Binnema 2588aaeb9e
Merge pull request #1759 from damon-kwok/fixed-missing-includes
[MSYS2] Added missing include files
2020-07-13 21:50:15 +03:00
Dirk-Jan C. Binnema 19c1c6cfd4 lib/mu-msg: Update for Sexp changes 2020-07-13 21:43:59 +03:00
Dirk-Jan C. Binnema 31dd4e2104 utils/sexp: Clean up API and implementation
Also update the tests and command-parser.
2020-07-13 21:43:59 +03:00
damon-kwok 689fd60181 Added missing include files 2020-07-13 15:02:18 +08:00
Alex Bennée f40178fe8a lib/index: fix deadlock when mu4e-index-cleanup is nil (#1749)
If the user has wants to postpone clean-up we shouldn't lock the
indexer waiting for something that will never happen. Clear the flag
event though we are actually skipping cleanup.
2020-07-06 20:49:04 +01:00
Todd Carson 73603c97e2 Don't declare mu_str_size_s() with the const attribute.
When this function is declared const or pure, clang at -O1 or higher optimizes
away the call to mu_str_size_s() inside mu_str_size(), so that it ignores its
argument and returns whatever is in mu_str_size_s()'s static buffer.

Found when test-mu-str failed while testing an update of mu in OpenBSD's ports tree.
2020-07-01 00:16:19 +09:00
Dirk-Jan C. Binnema 556b898e4d lib: Remove unused file 2020-06-28 13:23:56 +03:00
Dirk-Jan C. Binnema c8eff488ba cosmetics 2020-06-27 17:07:00 +03:00
Dirk-Jan C. Binnema 4617935d80 store: Update for the new indexer
Update some APIs so we can use it with the new indexer.

Remove some now-obsolete C APIs.
2020-06-27 17:07:00 +03:00
Dirk-Jan C. Binnema 4e6bd7dfdf lib/index: Implement new indexer
Implement a new message indexer consisting of a single-threaded scanner
and a multi-threaded indexer.

This allows for a number of optimizations as well as background
indexing, though this initial version should be behave similar to the
old indexer.
2020-06-27 17:07:00 +03:00
Dirk-Jan C. Binnema f416ad4249 utils: Add async-queue
Like GAsyncQueue, but for c++
2020-06-27 17:07:00 +03:00
Dirk-Jan C. Binnema 1b056f4c51 utils: Add Mu::canonicalize_filename
We need it for unit-tests
2020-06-27 17:07:00 +03:00
Dirk-Jan C. Binnema 6061898c2b utils: Clean up duration helpers 2020-06-27 17:07:00 +03:00
Dirk-Jan C. Binnema 5922cd9fa2 lib/mu-msg: benchmark message creation 2020-06-26 19:26:45 +03:00
Dirk-Jan C. Binnema 73f4c49364 utils: add async-queue, ansio-printer
Add an async-queue (rougly, GAsyncQueue but in c++ using a deque)

Add an ANSI color printer.
2020-06-26 19:21:04 +03:00
Dirk-Jan C. Binnema 9762b1bc3b utils/command-parser: Make property key ":" prefix explicit
Avoid a bit of 'magic' so we can catch missing ':' in property :keys
easier.
2020-06-13 16:56:41 +03:00
Dirk-Jan C. Binnema 981c781425 store: add bit more debug-logging 2020-06-13 16:56:41 +03:00
Dirk-Jan C. Binnema cf2e4f1dcd lib/mu-msg: cosmetic 2020-06-13 16:56:41 +03:00
Dirk-Jan C. Binnema fe6582c6d6 lib: implement mu_store_update 2020-06-13 16:56:41 +03:00
Dirk-Jan C. Binnema a9fab4abcc mu: convert command-line tools to c++ 2020-06-13 16:56:41 +03:00
Dirk-Jan C. Binnema 6a7449c7e3 mu-msg-sexp: correctly mask date/time bits
Typo fix.
2020-06-10 21:50:23 +03:00
Dirk-Jan C. Binnema 2f8850ea86 utils/sexp: add a bit more convenience 2020-06-09 19:52:03 +03:00
Dirk-Jan C. Binnema b10b243b54 lib/utils: update unit test 2020-06-07 18:11:41 +03:00
Dirk-Jan C. Binnema 452f62f5c0 lib: update msg->sexp to use programmatic s-expressions
Use the new mu-sexp capabilities.
2020-06-06 14:27:25 +03:00
Dirk-Jan C. Binnema 3afdc08d50 lib/utils: build s-expression programmatically building
Allow for programmatically buildings sexps, rather that using raw
strings.
2020-06-06 14:27:25 +03:00
Dirk-Jan C. Binnema 4dd764d9e8 lib/utils: add mu-logger.{cc,hh}
They were missing.

Fixes #1713.
2020-05-30 18:33:27 +03:00
Dirk-Jan C. Binnema 3e233cba9a rework logging system
reimplement the old mu-log.[ch] into mu-logging.{cc,hh}

If available (and using an appropriately equipped glib), log to the
systemd journal

Only g_criticals have stderr output, all the other g_* go to the log
file / journal.
2020-05-30 13:29:44 +03:00
Dirk-Jan C. Binnema 0a49cead33 build: don't require glib 2.58 for g_canonicalize_file
GLib version is probably still a bit too new, so simply lift the
function needed.

Fixes: #1712.
2020-05-28 00:37:29 +03:00
Dirk-Jan C. Binnema 8bfcb7430b lib/mu-msg-file: Use canonical path instead of real path
For the new symlink-support, it's better to use the *canonical* path than
the *realpath(3)* for files, so removing a symlinked maildir will work as
expected.
2020-05-27 18:55:18 +03:00
Dirk-Jan C. Binnema fdac81e023 lib: follow symlinks in maildirs
Until now, mu would _not_ follow symlinks; with these changes, we do.

There were some complications with that ~10 years ago, but I forgot the
details. So let's re-enable. At least one thing is in place now: moving
between file systems.

Fixes #1489
Fixes #1628 (technically, this came with slightly earlier commit)
2020-05-26 19:22:41 +03:00
Dirk-Jan C. Binnema 015fae7b1a guile: fix readline linking
For now, simply link muguile against readline; hopefully, we can make
this transitive.
2020-05-26 00:41:46 +03:00
Dirk-Jan C. Binnema 7e49f83c9f mu-maildir: attempt to allow moving to different fs
Add an EXDEV fallback for moving a file to a different filesystem.
2020-05-25 21:40:02 +03:00
Dirk-Jan C. Binnema f67b551460 mu-maildir: avoid unnecessarily moving new-name files
When calling mu_maildir_move_message with the new_name
options (workaround for mbsync's), do the src=target check *without* first
creating that new name.

This avoids some unnecessary moves.
2020-05-25 21:26:00 +03:00
Dirk-Jan C. Binnema 286225be8f
Merge pull request #1705 from nickg/windows-file-sep
Allow ';' as a Maildir flags seperator
2020-05-25 20:52:30 +03:00
Dirk-Jan C. Binnema b60cfc7df2 mu-server: restore readline-support
Restore readline support for `mu server' (but _only_ when readline is
found and when in tty mode)
2020-05-25 18:34:42 +03:00
Nick Gasson f8fcb55f91 Allow ';' as a Maildir flags seperator
Isync uses this by default on Windows where ':' is an invalid character
in file names. Also try to preserve the existing separator character
when generating a new file name.
2020-05-23 09:21:57 +08:00
Dirk-Jan C. Binnema 35db0f5906 mu-contacts: cosmetic 2020-05-17 14:53:18 +03:00
Dirk-Jan C. Binnema 53b553124c
Merge pull request #1663 from czan/master
mu: always sort descending within threads
2020-05-17 14:45:39 +03:00
Jonas Bernoulli 564d892701 Fix typos 2020-05-12 23:56:55 +02:00
Dirk-Jan C. Binnema f44f81b751 mu: don't verify signatures when it's not needed
We were verifying signatures when this was not needed; it seems that
gpgme is a bit slow (?), and on some people's machine the extra
verification made opening messages slow (with the non-gnus view esp.)
2020-05-05 21:25:36 +03:00
Kristian Rietveld c3032bd672 mu-store: enlarge buffer for strftime
On Debian 9 random memory was printed with the original buffer size
and valgrind complained about the use of uninitialized memory.
2020-05-01 20:47:45 +02:00
Dirk-Jan C. Binnema 7c3673b3de mu: do a full index when the database is empty
I.e., do _not_ honor .noupdate in that case.
2020-04-29 20:27:49 +03:00
Carlo Zancanaro 928dc5e0fc mu: always sort descending within threads 2020-04-29 10:55:19 +10:00
Dirk-Jan C. Binnema 06d3deb4cc guile: path updates for 2.2 2020-04-20 00:01:07 +03:00
Dominik Schrempf ccbd81f6ef ~/.mu -> ~/.cache/mu 2020-04-19 13:02:48 +02:00
Dirk-Jan C. Binnema a4fded5edd mu: ensure some struct members are initialized 2020-03-31 21:19:03 +03:00
Dirk-Jan C. Binnema 46ae663937 mu4e: use faster count queries, document differences
Use faster queries for counting read/unread messages; document why the
results might differ from what you get doing a normal search.
2020-03-15 01:23:01 +02:00
Dirk-Jan C. Binnema 49883806f6 store: remove unused code, use batchsize 2020-03-02 23:19:34 +02:00
Dirk-Jan C. Binnema a76720af42 make OP_WILDCARD non-conditional
Since we require Xapian 1.4 anyway, there's no need to make OP_WILDCARD
conditional.
2020-03-02 23:02:17 +02:00
damon-kwok 56b434347e error fix for gcc 9.x 2020-02-29 20:40:22 +08:00
Dirk-Jan C. Binnema 07e4a28deb man: remove max-msg-size from index man-page
We still keep in the code, as there are some future plans to handle it
there in a different way.

Fixes #1591.
2020-02-26 19:31:24 +02:00
Dirk-Jan C. Binnema 934adae70a lib: use same allocator when copying MuMsgPartSigStatusReport
Fixes a sigabrt when freeing later.
2020-02-23 15:20:01 +02:00