Commit Graph

958 Commits

Author SHA1 Message Date
Dirk-Jan C. Binnema ee4b3bda2d message: support 'personal' flag for messages
Add a new flag 'personal' for a message, which means that at least one of the
contact fields is personal.
2022-05-05 01:38:25 +03:00
Dirk-Jan C. Binnema a4f39819ee message/document: allow updating flags
Some flags (such as 'personal') can only be set just before storing; so allow
for update the flags.
2022-05-05 01:38:25 +03:00
Dirk-Jan C. Binnema fea596ae3b message/field: cache the message's sexp
Keep it in the store; much faster than generating on the fly.
2022-05-05 01:38:25 +03:00
Dirk-Jan C. Binnema 263e122a13 contacts: expose contact type
Instead of the Field::Id, keep a specific Contact::Type so we can distinguish
Sender, ReplyTo as well.

Update dependents.

Some cleanup.
2022-05-05 01:38:25 +03:00
Dirk-Jan C. Binnema 91d2a37379 query-results: Use mu-document as backend
So the mu-specific serialization/deserialization gets handled correctly
2022-05-05 01:38:25 +03:00
Dirk-Jan C. Binnema a864616110 mu: add "modified" fields
Add a new "modified" field for checking the last modification time of the
message.
2022-05-05 01:38:25 +03:00
Dirk-Jan C. Binnema 9e0173f387 store: set XAPIAN_FLUSH_THRESHOLD above internal commit
Don't auto-flush more often than the internal handling.
2022-05-05 01:38:25 +03:00
Dirk-Jan C. Binnema 8f9d1e5e60 mu: add fields/flags commands
Useful information for devising queries.

Directly generated from the source. Add manpages, too.
2022-05-05 01:38:25 +03:00
Dirk-Jan C. Binnema 30e7b5d9ec lib: move 3rd party code to thirdparty; add tabulate.hpp
Move 3rd-party code to their own dir, and add the nice tabulate.hpp
2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema a4317d3264 mu-query-matches: remove dead code 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 967e855f6b message: add docid param to sexp 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema fccd961712 server: update mu4e server for new Message 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 629006681a message: update unit tests 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 525fef479a store: update to use Message; big cleanup
Remove much of the message processing from the store
2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 459f6db476 query: update query subsys to use Message 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 95710edff4 parser: use the new number (de)serialization
Use the new lexnums, and the update parsing
2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 55113c6d5c message: improve API; improve extract_tags 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 9a8741f0dd message:document/fields: update and tie down
Update many of the field flags; remove obsolete ones.

Ensure they are handled correctly in mu-document
2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema b7a30c0a36 utils: update date/size parsing, factor out format
And update tests
2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 4b9c663ded mu-maildir: rework mu_maildir_from_path
Take a 'root' parameter
2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 3ac3ce7828 error: Add some more error codes 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema a8a3a0c3bf message: implement update-after-move
Allow for in-place updating of a moved document; i.e., without re-parsing
2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema a548cac2d0 message: refactor file handling, add ::mtime() 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema f0bfb38ff2 message: add move constructor 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 4a135e70fb server: update (mu4e) server to use Mu::Message 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 9e9e16a7ec lib/tests: rework in terms of Mu::Message 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 9b8353fc37 lib: update Store & QueryResults in terms of Mu::Message 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema 4b2812d25f maildir: improve naming in mu_maildir_move_message 2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema de07df77d3 lib: remove the old mu-msg* code
Replaced by Mu::Message & friends
2022-04-30 10:40:45 +03:00
Dirk-Jan C. Binnema bb6d271a23 contacts-cache: handle 'personal' mail for groups
When passing a vec of _all_ contacts for some message, mark _all_ of them as
personal if at least _one_ is a personal address.
2022-04-30 09:02:13 +03:00
Dirk-Jan C. Binnema d0619b1db2 server: workaround for broken message-id
We cannot really _search_ for the broken message-id, but we can still view it.

Should help for issue #2232.
2022-04-19 00:04:01 +03:00
Dirk-Jan C. Binnema 1ff161d91b utils: add mu-option.cc
Was missing.
2022-04-18 22:54:33 +03:00
Dirk-Jan C. Binnema 9c853acfa3 build: bump version 1.7.13
And some small tweaks, cleanups
2022-04-18 22:40:46 +03:00
Dirk-Jan C. Binnema 15decf6327 mu-utils: avoid compiler warning 2022-04-18 22:26:13 +03:00
Dirk-Jan C. Binnema 4ac66baccc mu-result: add assert_valid_result
Useful for unit tests
2022-04-18 22:26:04 +03:00
Dirk-Jan C. Binnema 17d2926cd0 message: improve support for decryption
Found a small leak:
  https://github.com/jstedfast/gmime/pull/124/commits
2022-04-18 22:26:04 +03:00
Dirk-Jan C. Binnema 7c51bc68d4 option: rename to to_string_opt and to_string_view_opt
to_option_string -> to_string_opt
to_string_view   -> to_string_view_opt
2022-04-18 22:04:33 +03:00
Dirk-Jan C. Binnema 4f9c154d1a utils: add deletable_unique_ptr 2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema de8dd048e8 message: add basic support for encrypted parts 2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema 72c0f82b41 message: improve attachment,encrypted part detection 2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema 478ef67fc6 flags: rename flags_to_string -> to_string
For consistency.
2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema ad0e9b7514 test-mu-message: improve signature check test
Still not very good though...
2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema 43c71c7698 error: Add crypto error code 2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema 09e175e9b5 message: part: better handle internal mime-object 2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema 8ede2a8354 message: better deal with test messages
Allow for specifying path / maildir for tests messages

Improve fake_msg_id
2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema 00c7fc897d message: move tests to test-mu-message.cc 2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema 4e65cac631 message: mime-object: extend support for crypto 2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema 187c3da408 contact: implement to_string
Make it easy to get a string for a sequence of contacts.
2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema 97c1725461 message: implement conversion to sexp
Like mu-msg-sexp, but for Mu::Message
2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema e9fdf7f01d utils: add extra check for #2230 2022-04-16 16:20:38 +03:00
Dirk-Jan C. Binnema acbcbc0b43 utils: include unistd.h 2022-04-14 23:04:42 +03:00
Dirk-Jan C. Binnema a7e6d57286 utils: add TempDir RAII class
For tests
2022-04-14 17:06:33 +03:00
Dirk-Jan C. Binnema 92a8122b93 message: Add Makefile.am
For the autotools build.
2022-04-06 20:21:02 +03:00
Dirk-Jan C. Binnema 99b06a97de message: extend unit test 2022-03-28 23:26:23 +03:00
Dirk-Jan C. Binnema 297930261a msg-sexp: fix adding contacts
std::array doesn't check its size...
2022-03-28 23:04:12 +03:00
Dirk-Jan C. Binnema ab3dd3de58 mime-object: add support for MimeMessagePart 2022-03-28 22:53:05 +03:00
Dirk-Jan C. Binnema 55489cc0d1 mu-error: make fill_g_error const
And add some more error codes.
2022-03-28 22:53:05 +03:00
Dirk-Jan C. Binnema dc2be0b442 utils: add seq_some 2022-03-28 22:53:05 +03:00
Dirk-Jan C. Binnema a93685b09b server: fix typo 2022-03-28 22:53:05 +03:00
Dirk-Jan C. Binnema 3810964a38 message: make maildir optional 2022-03-28 22:38:37 +03:00
Dirk-Jan C. Binnema da8eee0e69 message: support cooked/raw filenames
Supported a "cooked" mode for attachment filenames, which gets rid of any
unacceptable characters. Add "raw_filename" to get the filename as specified in
the part.

Update tests.
2022-03-28 22:35:45 +03:00
Dirk-Jan C. Binnema 9f062ae482 message/flags: add flags_from_path
Borrow from mu-maildir, to which we cannot link.
2022-03-28 22:35:45 +03:00
Dirk-Jan C. Binnema 27ebfb3b3c lib+guile: use Mu::Option, not std::optional
We need the extensions, and/or let's use _one_ optional implementation everywhere.
2022-03-28 08:58:04 +03:00
Dirk-Jan C. Binnema 5a28cdfba4 message: some fixes for github ci build 2022-03-26 20:30:42 +02:00
Dirk-Jan C. Binnema de80b557e8 meson: build updates 2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema 03993b93b2 autotools: build updates
Ensure things build with autotools, too.
2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema 37988b5a26 message: update implementation
Add more of the Message class (and various helpers), which are to replace all
the `mu-msg-*` code.

Add more tests.
2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema 55402622b9 result: add Err which takes a GError
Convenience
2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema 8ed09a9a82 store: cosmetics 2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema f7c84006d7 many: update for lib/message updates
Adapt to the new names / directory. Big commit, but mostly just very boring renaming.
2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema 4c4fb1759f message: move to lib/message, update naming
Basically, move/rename lib/mu-message* to lib/mu-*.

Add the beginnings of a Message class.
2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema 7774261526 test-query: improve logging 2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema 33dbcbb25f mu-error: fix typo 2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema ede99aff83 message: add document, xapian wrapper
Add Message::Document, which does the translation from/to message & xapian document.
2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema 3646345442 contacts-cache: add helper for adding multiple contacts 2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema f0475f5e87 message: flags: fix typo 2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema 7f15767faf message: fields: rationalize flags
Improve naming.
2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema d4285975b3 message: contact: remove ::Type, use Field
Don't need a special Type {} in Contact, when we have more-or-less the same info
in Field.
2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema a23c99ff7e utils: add some handy STL conveniences 2022-03-26 17:19:10 +02:00
Dirk-Jan C. Binnema e0096c3dee utils: improve split / join 2022-03-19 10:58:13 +02:00
Dirk-Jan C. Binnema 056fecd6aa store::for_each_term: use field-id
We were trying to convert a field (string) to a xapian prefix back to a
field (enum). That's unnecessarily complicated and worse, step 2 won't work.
2022-03-14 09:38:59 +02:00
Dirk-Jan C. Binnema 2fb6356ab6 xapian-utils: xapian_try: also catch std::exception 2022-03-13 07:49:31 +02:00
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