Commit Graph

826 Commits

Author SHA1 Message Date
Dirk-Jan C. Binnema 673929f169 logger: with MU_LOG_STDOUTERR, write logs to console
For debugging
2022-03-13 07:49:31 +02:00
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