Dirk-Jan C. Binnema
6e37790012
mu: improve error reporting
2022-05-15 13:40:44 +03:00
Dirk-Jan C. Binnema
9e78d3d13f
utils: insist on semicolon after MU_ENABLE_BITOPS
2022-05-14 12:47:26 +03:00
Dirk-Jan C. Binnema
34c5ca1627
mu-error: encode retval/flags in enum
2022-05-12 08:56:13 +03:00
Dirk-Jan C. Binnema
da8489d0f6
sexp: allow for some prettified string output
...
Allow for adding newlines between list items
2022-05-06 22:17:53 +03:00
Dirk-Jan C. Binnema
6126d7ee62
store: ensure updates update message sexp too
...
And turn all "add" into "replace" so old messages get removed.
Update tests too.
2022-05-05 01:40:17 +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
b7a30c0a36
utils: update date/size parsing, factor out format
...
And update tests
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
9e9e16a7ec
lib/tests: rework in terms of Mu::Message
2022-04-30 10:40:45 +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
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
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
43c71c7698
error: Add crypto error code
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
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
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
55402622b9
result: add Err which takes a GError
...
Convenience
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
33dbcbb25f
mu-error: fix typo
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
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
00d9fb121f
utils: add rename has_flag into one_if in BITOPS
2022-03-07 06:50:18 +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
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
69a465d849
mu-sexp: add some small conveniences
2022-02-20 14:08:53 +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
4eabf1a64a
*: update for for mu-maildir changes
...
Update the dependencies.
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
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
23fc8bdba8
update code for Mu::MessagePriority
...
Update dependent code
2022-02-14 11:12:26 +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
08dc66a525
mu-utils: Fix compiler warning
2022-01-14 17:10:16 +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
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
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
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
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
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
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
b8f8ffa967
mu-sexp: make lists printable
...
And some typo fixes
2021-05-02 23:30:32 +03:00
Derek Zhou
dc6f76d74d
seperate Mu::format and Mu::vformat
2021-04-22 18:32:38 +00: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
7a70942e67
build: experimental support for the meson build system
2021-02-12 00:49:35 +02:00
Dirk-Jan C. Binnema
98744c66f7
remove some dead code
2021-01-22 23:24:53 +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
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
Dirk-Jan C. Binnema
c8b507f826
mu: remove obsolete MU_FEATURE_CRYPTO
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
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
69b157a346
lib: improve error handling, cleanups
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
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
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
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
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
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
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
a9fab4abcc
mu: convert command-line tools to c++
2020-06-13 16:56:41 +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
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
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